diff mbox series

[v6,2/2] PCI: altera: support dt binding update

Message ID 20240611163525.4156688-2-matthew.gerlach@linux.intel.com (mailing list archive)
State Superseded
Delegated to: Krzysztof WilczyƄski
Headers show
Series [v6,1/2] dt-bindings: PCI: altera: Convert to YAML | expand

Commit Message

Matthew Gerlach June 11, 2024, 4:35 p.m. UTC
From: Matthew Gerlach <matthew.gerlach@linux.intel.com>

Add support for the device tree binding update. As part of
converting the binding document from text to yaml, with schema
validation, a device tree subnode was added to properly map
legacy interrupts. Maintain backward compatibility with previous binding.

Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
---
 drivers/pci/controller/pcie-altera.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Comments

Bjorn Helgaas June 11, 2024, 5:04 p.m. UTC | #1
On Tue, Jun 11, 2024 at 11:35:25AM -0500, matthew.gerlach@linux.intel.com wrote:
> From: Matthew Gerlach <matthew.gerlach@linux.intel.com>
> 
> Add support for the device tree binding update. As part of
> converting the binding document from text to yaml, with schema
> validation, a device tree subnode was added to properly map
> legacy interrupts. Maintain backward compatibility with previous binding.

If something was *added* to the binding, I think it would be helpful
to split that into two patches: (1) convert to YAML with zero
functional changes, (2) add the new stuff.  Adding something at the
same time as changing the format makes it hard to review.

Then we could have a more specific subject and commit log for *this*
patch.

> Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
> ---
>  drivers/pci/controller/pcie-altera.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-altera.c b/drivers/pci/controller/pcie-altera.c
> index a9536dc4bf96..88511fa2f078 100644
> --- a/drivers/pci/controller/pcie-altera.c
> +++ b/drivers/pci/controller/pcie-altera.c
> @@ -667,11 +667,20 @@ static void altera_pcie_isr(struct irq_desc *desc)
>  static int altera_pcie_init_irq_domain(struct altera_pcie *pcie)
>  {
>  	struct device *dev = &pcie->pdev->dev;
> -	struct device_node *node = dev->of_node;
> +	struct device_node *node, *child;
>  
>  	/* Setup INTx */
> +	child = of_get_next_child(dev->of_node, NULL);
> +	if (child)
> +		node = child;
> +	else
> +		node = dev->of_node;
> +
>  	pcie->irq_domain = irq_domain_add_linear(node, PCI_NUM_INTX,
> -					&intx_domain_ops, pcie);
> +						 &intx_domain_ops, pcie);
> +	if (child)
> +		of_node_put(child);
> +
>  	if (!pcie->irq_domain) {
>  		dev_err(dev, "Failed to get a INTx IRQ domain\n");
>  		return -ENOMEM;
> -- 
> 2.34.1
>
Matthew Gerlach June 12, 2024, 3:12 p.m. UTC | #2
On Tue, 11 Jun 2024, Bjorn Helgaas wrote:

> On Tue, Jun 11, 2024 at 11:35:25AM -0500, matthew.gerlach@linux.intel.com wrote:
>> From: Matthew Gerlach <matthew.gerlach@linux.intel.com>
>>
>> Add support for the device tree binding update. As part of
>> converting the binding document from text to yaml, with schema
>> validation, a device tree subnode was added to properly map
>> legacy interrupts. Maintain backward compatibility with previous binding.
>
> If something was *added* to the binding, I think it would be helpful
> to split that into two patches: (1) convert to YAML with zero
> functional changes, (2) add the new stuff.  Adding something at the
> same time as changing the format makes it hard to review.

Thanks for feedback. It was during the conversion to YAML that a problem 
with the original binding was discovered. As Rob Herring pointed out in
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240513205913.313592-1-matthew.gerlach@linux.intel.com/

"Making the PCI host the interrupt parent didn't even work in the kernel
  until somewhat recently (maybe a few years now). That's why a bunch of PCI
  hosts have an interrupt-controller child node."

This was an attempt to fix the problem. I can resubmit a conversion to YAML 
with zero functional changes.

Matthew Gerlach


>
> Then we could have a more specific subject and commit log for *this*
> patch.
>
>> Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
>> ---
>>  drivers/pci/controller/pcie-altera.c | 13 +++++++++++--
>>  1 file changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/pci/controller/pcie-altera.c b/drivers/pci/controller/pcie-altera.c
>> index a9536dc4bf96..88511fa2f078 100644
>> --- a/drivers/pci/controller/pcie-altera.c
>> +++ b/drivers/pci/controller/pcie-altera.c
>> @@ -667,11 +667,20 @@ static void altera_pcie_isr(struct irq_desc *desc)
>>  static int altera_pcie_init_irq_domain(struct altera_pcie *pcie)
>>  {
>>  	struct device *dev = &pcie->pdev->dev;
>> -	struct device_node *node = dev->of_node;
>> +	struct device_node *node, *child;
>>
>>  	/* Setup INTx */
>> +	child = of_get_next_child(dev->of_node, NULL);
>> +	if (child)
>> +		node = child;
>> +	else
>> +		node = dev->of_node;
>> +
>>  	pcie->irq_domain = irq_domain_add_linear(node, PCI_NUM_INTX,
>> -					&intx_domain_ops, pcie);
>> +						 &intx_domain_ops, pcie);
>> +	if (child)
>> +		of_node_put(child);
>> +
>>  	if (!pcie->irq_domain) {
>>  		dev_err(dev, "Failed to get a INTx IRQ domain\n");
>>  		return -ENOMEM;
>> --
>> 2.34.1
>>
>
Rob Herring (Arm) June 13, 2024, 5:51 p.m. UTC | #3
On Wed, Jun 12, 2024 at 08:12:05AM -0700, matthew.gerlach@linux.intel.com wrote:
> 
> 
> On Tue, 11 Jun 2024, Bjorn Helgaas wrote:
> 
> > On Tue, Jun 11, 2024 at 11:35:25AM -0500, matthew.gerlach@linux.intel.com wrote:
> > > From: Matthew Gerlach <matthew.gerlach@linux.intel.com>
> > > 
> > > Add support for the device tree binding update. As part of
> > > converting the binding document from text to yaml, with schema
> > > validation, a device tree subnode was added to properly map
> > > legacy interrupts. Maintain backward compatibility with previous binding.
> > 
> > If something was *added* to the binding, I think it would be helpful
> > to split that into two patches: (1) convert to YAML with zero
> > functional changes, (2) add the new stuff.  Adding something at the
> > same time as changing the format makes it hard to review.

The policy for conversions is changes to match reality are fine, just 
need to be noted in the commit message. That generally implies no driver 
or dts changes which is not the case here. 

> Thanks for feedback. It was during the conversion to YAML that a problem
> with the original binding was discovered. As Rob Herring pointed out in
> https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240513205913.313592-1-matthew.gerlach@linux.intel.com/
> 
> "Making the PCI host the interrupt parent didn't even work in the kernel
>  until somewhat recently (maybe a few years now). That's why a bunch of PCI
>  hosts have an interrupt-controller child node."
> 
> This was an attempt to fix the problem. I can resubmit a conversion to YAML
> with zero functional changes.

I wasn't suggesting you fix it. Just something I noticed looking at 
the other issue. If no one noticed or cared, why bother? It should work 
fine for recent kernels.

Rob
Matthew Gerlach June 13, 2024, 8:13 p.m. UTC | #4
On Thu, 13 Jun 2024, Rob Herring wrote:

> On Wed, Jun 12, 2024 at 08:12:05AM -0700, matthew.gerlach@linux.intel.com wrote:
>>
>>
>> On Tue, 11 Jun 2024, Bjorn Helgaas wrote:
>>
>>> On Tue, Jun 11, 2024 at 11:35:25AM -0500, matthew.gerlach@linux.intel.com wrote:
>>>> From: Matthew Gerlach <matthew.gerlach@linux.intel.com>
>>>>
>>>> Add support for the device tree binding update. As part of
>>>> converting the binding document from text to yaml, with schema
>>>> validation, a device tree subnode was added to properly map
>>>> legacy interrupts. Maintain backward compatibility with previous binding.
>>>
>>> If something was *added* to the binding, I think it would be helpful
>>> to split that into two patches: (1) convert to YAML with zero
>>> functional changes, (2) add the new stuff.  Adding something at the
>>> same time as changing the format makes it hard to review.
>
> The policy for conversions is changes to match reality are fine, just
> need to be noted in the commit message. That generally implies no driver
> or dts changes which is not the case here.
>
>> Thanks for feedback. It was during the conversion to YAML that a problem
>> with the original binding was discovered. As Rob Herring pointed out in
>> https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240513205913.313592-1-matthew.gerlach@linux.intel.com/
>>
>> "Making the PCI host the interrupt parent didn't even work in the kernel
>>  until somewhat recently (maybe a few years now). That's why a bunch of PCI
>>  hosts have an interrupt-controller child node."
>>
>> This was an attempt to fix the problem. I can resubmit a conversion to YAML
>> with zero functional changes.
>
> I wasn't suggesting you fix it. Just something I noticed looking at
> the other issue. If no one noticed or cared, why bother? It should work
> fine for recent kernels.

Thanks for the feedback. I can resubmit a single conversion commit that 
passes the schema check by adding 3 address fields as you suggested. I 
will also mention this slight modification in the commit message.

Matthew

>
> Rob
>
diff mbox series

Patch

diff --git a/drivers/pci/controller/pcie-altera.c b/drivers/pci/controller/pcie-altera.c
index a9536dc4bf96..88511fa2f078 100644
--- a/drivers/pci/controller/pcie-altera.c
+++ b/drivers/pci/controller/pcie-altera.c
@@ -667,11 +667,20 @@  static void altera_pcie_isr(struct irq_desc *desc)
 static int altera_pcie_init_irq_domain(struct altera_pcie *pcie)
 {
 	struct device *dev = &pcie->pdev->dev;
-	struct device_node *node = dev->of_node;
+	struct device_node *node, *child;
 
 	/* Setup INTx */
+	child = of_get_next_child(dev->of_node, NULL);
+	if (child)
+		node = child;
+	else
+		node = dev->of_node;
+
 	pcie->irq_domain = irq_domain_add_linear(node, PCI_NUM_INTX,
-					&intx_domain_ops, pcie);
+						 &intx_domain_ops, pcie);
+	if (child)
+		of_node_put(child);
+
 	if (!pcie->irq_domain) {
 		dev_err(dev, "Failed to get a INTx IRQ domain\n");
 		return -ENOMEM;