diff mbox series

[5/9] PCI: faraday: Use pci_alloc_intx_irqd() helper to get irq domain for INTx

Message ID 1524817438-239391-1-git-send-email-shawn.lin@rock-chips.com
State Superseded
Delegated to: Lorenzo Pieralisi
Headers show
Series Add new helper to allocate irq domain for hosts | expand

Commit Message

Shawn Lin April 27, 2018, 8:23 a.m. UTC
Just avoid code duplication, but no functional change intended.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 drivers/pci/host/pci-ftpci100.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

Comments

kernel test robot April 28, 2018, 11:32 p.m. UTC | #1
Hi Shawn,

I love your patch! Yet something to improve:

[auto build test ERROR on pci/next]
[also build test ERROR on v4.17-rc2 next-20180426]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Shawn-Lin/Add-new-helper-to-allocate-irq-domain-for-hosts/20180429-053656
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   drivers/pci/host/pci-ftpci100.c: In function 'faraday_pci_setup_cascaded_irq':
>> drivers/pci/host/pci-ftpci100.c:349:2: error: expected ';' before 'if'
     if (IS_ERR(p->irqdomain))
     ^~

vim +349 drivers/pci/host/pci-ftpci100.c

   340	
   341	static int faraday_pci_setup_cascaded_irq(struct faraday_pci *p)
   342	{
   343		struct device_node *intc = of_get_next_child(p->dev->of_node, NULL);
   344		int irq;
   345		int i;
   346	
   347		p->irqdomain = pci_alloc_intx_irqd(p->dev, p, false,
   348						   &faraday_pci_irqdomain_ops, intc)
 > 349		if (IS_ERR(p->irqdomain))
   350			return PTR_ERR(p->irqdomain);
   351	
   352		/* All PCI IRQs cascade off this one */
   353		irq = of_irq_get(intc, 0);
   354		if (irq <= 0) {
   355			dev_err(p->dev, "failed to get parent IRQ\n");
   356			irq_domain_remove(p->irqdomain);
   357			return irq ?: -EINVAL;
   358		}
   359	
   360	
   361		irq_set_chained_handler_and_data(irq, faraday_pci_irq_handler, p);
   362	
   363		for (i = 0; i < 4; i++)
   364			irq_create_mapping(p->irqdomain, i);
   365	
   366		return 0;
   367	}
   368	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox series

Patch

diff --git a/drivers/pci/host/pci-ftpci100.c b/drivers/pci/host/pci-ftpci100.c
index 5008fd8..018e4f4 100644
--- a/drivers/pci/host/pci-ftpci100.c
+++ b/drivers/pci/host/pci-ftpci100.c
@@ -344,24 +344,19 @@  static int faraday_pci_setup_cascaded_irq(struct faraday_pci *p)
 	int irq;
 	int i;
 
-	if (!intc) {
-		dev_err(p->dev, "missing child interrupt-controller node\n");
-		return -EINVAL;
-	}
+	p->irqdomain = pci_alloc_intx_irqd(p->dev, p, false,
+					   &faraday_pci_irqdomain_ops, intc)
+	if (IS_ERR(p->irqdomain))
+		return PTR_ERR(p->irqdomain);
 
 	/* All PCI IRQs cascade off this one */
 	irq = of_irq_get(intc, 0);
 	if (irq <= 0) {
 		dev_err(p->dev, "failed to get parent IRQ\n");
+		irq_domain_remove(p->irqdomain);
 		return irq ?: -EINVAL;
 	}
 
-	p->irqdomain = irq_domain_add_linear(intc, PCI_NUM_INTX,
-					     &faraday_pci_irqdomain_ops, p);
-	if (!p->irqdomain) {
-		dev_err(p->dev, "failed to create Gemini PCI IRQ domain\n");
-		return -EINVAL;
-	}
 
 	irq_set_chained_handler_and_data(irq, faraday_pci_irq_handler, p);