diff options
author | Grant Likely <grant.likely@linaro.org> | 2013-09-19 17:44:55 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@linaro.org> | 2013-10-24 06:50:36 -0400 |
commit | 16b84e5a505c790538e534ad8dfda9c288691e40 (patch) | |
tree | 887e4da0c9cdf408350230165cf72730cec599e6 /arch/mips | |
parent | f7578496a671a96e501f16a5104893275e32c33a (diff) |
of/irq: Create of_irq_parse_and_map_pci() to consolidate arch code.
Several architectures open code effectively the same code block for
finding and mapping PCI irqs. This patch consolidates it down to a
single function.
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Acked-by: Michal Simek <monstr@monstr.eu>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/pci/fixup-lantiq.c | 12 | ||||
-rw-r--r-- | arch/mips/pci/pci-rt3883.c | 22 |
2 files changed, 2 insertions, 32 deletions
diff --git a/arch/mips/pci/fixup-lantiq.c b/arch/mips/pci/fixup-lantiq.c index aef60e75003e..c2ce41ea61d7 100644 --- a/arch/mips/pci/fixup-lantiq.c +++ b/arch/mips/pci/fixup-lantiq.c | |||
@@ -25,15 +25,5 @@ int pcibios_plat_dev_init(struct pci_dev *dev) | |||
25 | 25 | ||
26 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 26 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
27 | { | 27 | { |
28 | struct of_phandle_args dev_irq; | 28 | return of_irq_parse_and_map_pci(dev, slot, pin); |
29 | int irq; | ||
30 | |||
31 | if (of_irq_parse_pci(dev, &dev_irq)) { | ||
32 | dev_err(&dev->dev, "trying to map irq for unknown slot:%d pin:%d\n", | ||
33 | slot, pin); | ||
34 | return 0; | ||
35 | } | ||
36 | irq = irq_create_of_mapping(&dev_irq); | ||
37 | dev_info(&dev->dev, "SLOT:%d PIN:%d IRQ:%d\n", slot, pin, irq); | ||
38 | return irq; | ||
39 | } | 29 | } |
diff --git a/arch/mips/pci/pci-rt3883.c b/arch/mips/pci/pci-rt3883.c index eadc4310cd36..adeff2bfe4cd 100644 --- a/arch/mips/pci/pci-rt3883.c +++ b/arch/mips/pci/pci-rt3883.c | |||
@@ -583,27 +583,7 @@ err_put_intc_node: | |||
583 | 583 | ||
584 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 584 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
585 | { | 585 | { |
586 | struct of_phandle_args dev_irq; | 586 | return of_irq_parse_and_map_pci(dev, slot, pin); |
587 | int err; | ||
588 | int irq; | ||
589 | |||
590 | err = of_irq_parse_pci(dev, &dev_irq); | ||
591 | if (err) { | ||
592 | pr_err("pci %s: unable to get irq map, err=%d\n", | ||
593 | pci_name((struct pci_dev *) dev), err); | ||
594 | return 0; | ||
595 | } | ||
596 | |||
597 | irq = irq_create_of_mapping(&dev_irq); | ||
598 | |||
599 | if (irq == 0) | ||
600 | pr_crit("pci %s: no irq found for pin %u\n", | ||
601 | pci_name((struct pci_dev *) dev), pin); | ||
602 | else | ||
603 | pr_info("pci %s: using irq %d for pin %u\n", | ||
604 | pci_name((struct pci_dev *) dev), irq, pin); | ||
605 | |||
606 | return irq; | ||
607 | } | 587 | } |
608 | 588 | ||
609 | int pcibios_plat_dev_init(struct pci_dev *dev) | 589 | int pcibios_plat_dev_init(struct pci_dev *dev) |