From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lucky1.263xmail.com ([211.157.147.134]:60898 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757709AbeD0Ibu (ORCPT ); Fri, 27 Apr 2018 04:31:50 -0400 From: Shawn Lin To: Lorenzo Pieralisi , Bjorn Helgaas Cc: linux-pci@vger.kernel.org, Shawn Lin Subject: [PATCH 5/9] PCI: faraday: Use pci_alloc_intx_irqd() helper to get irq domain for INTx Date: Fri, 27 Apr 2018 16:23:58 +0800 Message-Id: <1524817438-239391-1-git-send-email-shawn.lin@rock-chips.com> In-Reply-To: <1524817322-239028-1-git-send-email-shawn.lin@rock-chips.com> References: <1524817322-239028-1-git-send-email-shawn.lin@rock-chips.com> Sender: linux-pci-owner@vger.kernel.org List-ID: Just avoid code duplication, but no functional change intended. Signed-off-by: Shawn Lin --- drivers/pci/host/pci-ftpci100.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) 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); -- 1.9.1