1 From 1baf727ee1d863a0eacd249cff6afc99022593c2 Mon Sep 17 00:00:00 2001
2 From: Grant Likely <grant.likely@linaro.org>
3 Date: Thu, 19 Dec 2013 09:30:55 -0300
4 Subject: [PATCH 184/203] of/irq: Replace of_irq with of_phandle_args
6 struct of_irq and struct of_phandle_args are exactly the same structure.
7 This patch makes the kernel use of_phandle_args everywhere. This in
8 itself isn't a big deal, but it makes some follow-on patches simpler.
10 Signed-off-by: Grant Likely <grant.likely@linaro.org>
11 Acked-by: Michal Simek <monstr@monstr.eu>
12 Acked-by: Tony Lindgren <tony@atomide.com>
13 Cc: Russell King <linux@arm.linux.org.uk>
14 Cc: Ralf Baechle <ralf@linux-mips.org>
15 Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
18 arch/mips/pci/pci-rt3883.c
20 arch/arm/mach-integrator/pci_v3.c | 5 ++---
21 arch/microblaze/pci/pci-common.c | 9 ++++-----
22 arch/mips/pci/fixup-lantiq.c | 5 ++---
23 arch/powerpc/kernel/pci-common.c | 9 ++++-----
24 arch/powerpc/platforms/cell/celleb_scc_pciex.c | 5 ++---
25 arch/powerpc/platforms/cell/celleb_scc_sio.c | 5 ++---
26 arch/powerpc/platforms/cell/spider-pic.c | 6 +++---
27 arch/powerpc/platforms/cell/spu_manage.c | 12 ++++++------
28 arch/powerpc/platforms/fsl_uli1575.c | 8 +++-----
29 arch/powerpc/platforms/powermac/pic.c | 8 ++++----
30 arch/powerpc/platforms/pseries/event_sources.c | 7 +++----
31 arch/powerpc/sysdev/mpic_msi.c | 6 +++---
32 arch/x86/kernel/devicetree.c | 5 ++---
33 drivers/of/irq.c | 15 +++++++--------
34 drivers/of/of_pci_irq.c | 2 +-
35 drivers/pci/host/pci-mvebu.c | 5 ++---
36 include/linux/of_irq.h | 24 ++++--------------------
37 include/linux/of_pci.h | 4 ++--
38 18 files changed, 56 insertions(+), 84 deletions(-)
40 --- a/arch/arm/mach-integrator/pci_v3.c
41 +++ b/arch/arm/mach-integrator/pci_v3.c
42 @@ -684,7 +684,7 @@ static struct hw_pci pci_v3 __initdata =
44 static int __init pci_v3_map_irq_dt(const struct pci_dev *dev, u8 slot, u8 pin)
47 + struct of_phandle_args oirq;
50 ret = of_irq_parse_pci(dev, &oirq);
51 @@ -694,8 +694,7 @@ static int __init pci_v3_map_irq_dt(cons
55 - return irq_create_of_mapping(oirq.controller, oirq.specifier,
57 + return irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count);
60 static int __init pci_v3_dtprobe(struct platform_device *pdev,
61 --- a/arch/microblaze/pci/pci-common.c
62 +++ b/arch/microblaze/pci/pci-common.c
63 @@ -199,7 +199,7 @@ void pcibios_set_master(struct pci_dev *
65 int pci_read_irq_line(struct pci_dev *pci_dev)
68 + struct of_phandle_args oirq;
71 /* The current device-tree that iSeries generates from the HV
72 @@ -243,11 +243,10 @@ int pci_read_irq_line(struct pci_dev *pc
73 irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW);
75 pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n",
76 - oirq.size, oirq.specifier[0], oirq.specifier[1],
77 - of_node_full_name(oirq.controller));
78 + oirq.args_count, oirq.args[0], oirq.args[1],
79 + of_node_full_name(oirq.np));
81 - virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
83 + virq = irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count);
86 pr_debug(" Failed to map !\n");
87 --- a/arch/mips/pci/fixup-lantiq.c
88 +++ b/arch/mips/pci/fixup-lantiq.c
89 @@ -25,7 +25,7 @@ int pcibios_plat_dev_init(struct pci_dev
91 int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
93 - struct of_irq dev_irq;
94 + struct of_phandle_args dev_irq;
97 if (of_irq_parse_pci(dev, &dev_irq)) {
98 @@ -33,8 +33,7 @@ int __init pcibios_map_irq(const struct
102 - irq = irq_create_of_mapping(dev_irq.controller, dev_irq.specifier,
104 + irq = irq_create_of_mapping(dev_irq.np, dev_irq.args, dev_irq.args_count);
105 dev_info(&dev->dev, "SLOT:%d PIN:%d IRQ:%d\n", slot, pin, irq);
108 --- a/arch/powerpc/kernel/pci-common.c
109 +++ b/arch/powerpc/kernel/pci-common.c
110 @@ -228,7 +228,7 @@ int pcibios_add_platform_entries(struct
112 static int pci_read_irq_line(struct pci_dev *pci_dev)
114 - struct of_irq oirq;
115 + struct of_phandle_args oirq;
118 pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev));
119 @@ -263,11 +263,10 @@ static int pci_read_irq_line(struct pci_
120 irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW);
122 pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n",
123 - oirq.size, oirq.specifier[0], oirq.specifier[1],
124 - of_node_full_name(oirq.controller));
125 + oirq.args_count, oirq.args[0], oirq.args[1],
126 + of_node_full_name(oirq.np));
128 - virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
130 + virq = irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count);
133 pr_debug(" Failed to map !\n");
134 --- a/arch/powerpc/platforms/cell/celleb_scc_pciex.c
135 +++ b/arch/powerpc/platforms/cell/celleb_scc_pciex.c
136 @@ -486,7 +486,7 @@ static __init int celleb_setup_pciex(str
137 struct pci_controller *phb)
140 - struct of_irq oirq;
141 + struct of_phandle_args oirq;
144 /* SMMIO registers; used inside this file */
145 @@ -511,8 +511,7 @@ static __init int celleb_setup_pciex(str
146 pr_err("PCIEXC:Failed to map irq\n");
149 - virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
151 + virq = irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count);
152 if (request_irq(virq, pciex_handle_internal_irq,
153 0, "pciex", (void *)phb)) {
154 pr_err("PCIEXC:Failed to request irq\n");
155 --- a/arch/powerpc/platforms/cell/celleb_scc_sio.c
156 +++ b/arch/powerpc/platforms/cell/celleb_scc_sio.c
157 @@ -45,7 +45,7 @@ static int __init txx9_serial_init(void)
158 struct device_node *node;
160 struct uart_port req;
162 + struct of_phandle_args irq;
165 for_each_compatible_node(node, "serial", "toshiba,sio-scc") {
166 @@ -66,8 +66,7 @@ static int __init txx9_serial_init(void)
167 #ifdef CONFIG_SERIAL_TXX9_CONSOLE
168 req.membase = ioremap(req.mapbase, 0x24);
170 - req.irq = irq_create_of_mapping(irq.controller,
171 - irq.specifier, irq.size);
172 + req.irq = irq_create_of_mapping(irq.np, irq.args, irq.args_count);
173 req.flags |= UPF_IOREMAP | UPF_BUGGY_UART
175 req.uartclk = 83300000;
176 --- a/arch/powerpc/platforms/cell/spider-pic.c
177 +++ b/arch/powerpc/platforms/cell/spider-pic.c
178 @@ -235,10 +235,10 @@ static unsigned int __init spider_find_c
179 /* First, we check whether we have a real "interrupts" in the device
180 * tree in case the device-tree is ever fixed
182 - struct of_irq oirq;
183 + struct of_phandle_args oirq;
184 if (of_irq_parse_one(pic->host->of_node, 0, &oirq) == 0) {
185 - virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
187 + virq = irq_create_of_mapping(oirq.np, oirq.args,
192 --- a/arch/powerpc/platforms/cell/spu_manage.c
193 +++ b/arch/powerpc/platforms/cell/spu_manage.c
194 @@ -177,7 +177,7 @@ out:
196 static int __init spu_map_interrupts(struct spu *spu, struct device_node *np)
198 - struct of_irq oirq;
199 + struct of_phandle_args oirq;
203 @@ -188,10 +188,10 @@ static int __init spu_map_interrupts(str
207 - pr_debug(" irq %d no 0x%x on %s\n", i, oirq.specifier[0],
208 - oirq.controller->full_name);
209 - spu->irqs[i] = irq_create_of_mapping(oirq.controller,
210 - oirq.specifier, oirq.size);
211 + pr_debug(" irq %d no 0x%x on %s\n", i, oirq.args[0],
212 + oirq.np->full_name);
213 + spu->irqs[i] = irq_create_of_mapping(oirq.np,
214 + oirq.args, oirq.args_count);
215 if (spu->irqs[i] == NO_IRQ) {
216 pr_debug("spu_new: failed to map it !\n");
218 @@ -200,7 +200,7 @@ static int __init spu_map_interrupts(str
222 - pr_debug("failed to map irq %x for spu %s\n", *oirq.specifier,
223 + pr_debug("failed to map irq %x for spu %s\n", *oirq.args,
225 for (; i >= 0; i--) {
226 if (spu->irqs[i] != NO_IRQ)
227 --- a/arch/powerpc/platforms/fsl_uli1575.c
228 +++ b/arch/powerpc/platforms/fsl_uli1575.c
229 @@ -321,8 +321,8 @@ static void hpcd_final_uli5288(struct pc
231 struct pci_controller *hose = pci_bus_to_host(dev->bus);
232 struct device_node *hosenode = hose ? hose->dn : NULL;
233 - struct of_irq oirq;
235 + struct of_phandle_args oirq;
239 if (!machine_is(mpc86xx_hpcd))
240 @@ -334,9 +334,7 @@ static void hpcd_final_uli5288(struct pc
241 laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(31, 0) << 8);
242 laddr[1] = laddr[2] = 0;
243 of_irq_parse_raw(hosenode, &pin, 1, laddr, &oirq);
244 - virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
247 + dev->irq = irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count);
250 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, hpcd_quirk_uli1575);
251 --- a/arch/powerpc/platforms/powermac/pic.c
252 +++ b/arch/powerpc/platforms/powermac/pic.c
253 @@ -394,7 +394,7 @@ static void __init pmac_pic_probe_oldsty
256 int of_irq_parse_oldworld(struct device_node *device, int index,
257 - struct of_irq *out_irq)
258 + struct of_phandle_args *out_irq)
260 const u32 *ints = NULL;
262 @@ -422,9 +422,9 @@ int of_irq_parse_oldworld(struct device_
266 - out_irq->controller = NULL;
267 - out_irq->specifier[0] = ints[index];
269 + out_irq->np = NULL;
270 + out_irq->args[0] = ints[index];
271 + out_irq->args_count = 1;
275 --- a/arch/powerpc/platforms/pseries/event_sources.c
276 +++ b/arch/powerpc/platforms/pseries/event_sources.c
277 @@ -25,7 +25,7 @@ void request_event_sources_irqs(struct d
280 int i, index, count = 0;
281 - struct of_irq oirq;
282 + struct of_phandle_args oirq;
284 unsigned int opicplen;
285 unsigned int virqs[16];
286 @@ -59,9 +59,8 @@ void request_event_sources_irqs(struct d
290 - virqs[count] = irq_create_of_mapping(oirq.controller,
293 + virqs[count] = irq_create_of_mapping(oirq.np, oirq.args,
295 if (virqs[count] == NO_IRQ) {
296 pr_err("event-sources: Unable to allocate "
297 "interrupt number for %s\n",
298 --- a/arch/powerpc/sysdev/mpic_msi.c
299 +++ b/arch/powerpc/sysdev/mpic_msi.c
300 @@ -35,7 +35,7 @@ static int mpic_msi_reserve_u3_hwirqs(st
301 const struct irq_domain_ops *ops = mpic->irqhost->ops;
302 struct device_node *np;
304 - struct of_irq oirq;
305 + struct of_phandle_args oirq;
307 pr_debug("mpic: found U3, guessing msi allocator setup\n");
309 @@ -64,8 +64,8 @@ static int mpic_msi_reserve_u3_hwirqs(st
312 while (of_irq_parse_one(np, index++, &oirq) == 0) {
313 - ops->xlate(mpic->irqhost, NULL, oirq.specifier,
314 - oirq.size, &hwirq, &flags);
315 + ops->xlate(mpic->irqhost, NULL, oirq.args,
316 + oirq.args_count, &hwirq, &flags);
317 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, hwirq);
320 --- a/arch/x86/kernel/devicetree.c
321 +++ b/arch/x86/kernel/devicetree.c
322 @@ -106,7 +106,7 @@ struct device_node *pcibios_get_phb_of_n
324 static int x86_of_pci_irq_enable(struct pci_dev *dev)
326 - struct of_irq oirq;
327 + struct of_phandle_args oirq;
331 @@ -121,8 +121,7 @@ static int x86_of_pci_irq_enable(struct
335 - virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
337 + virq = irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count);
341 --- a/drivers/of/irq.c
342 +++ b/drivers/of/irq.c
345 unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
347 - struct of_irq oirq;
348 + struct of_phandle_args oirq;
350 if (of_irq_parse_one(dev, index, &oirq))
353 - return irq_create_of_mapping(oirq.controller, oirq.specifier,
355 + return irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count);
357 EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
359 @@ -94,7 +93,7 @@ struct device_node *of_irq_find_parent(s
360 * node exist for the parent.
362 int of_irq_parse_raw(struct device_node *parent, const __be32 *intspec,
363 - u32 ointsize, const __be32 *addr, struct of_irq *out_irq)
364 + u32 ointsize, const __be32 *addr, struct of_phandle_args *out_irq)
366 struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
367 const __be32 *tmp, *imap, *imask;
368 @@ -156,10 +155,10 @@ int of_irq_parse_raw(struct device_node
370 pr_debug(" -> got it !\n");
371 for (i = 0; i < intsize; i++)
372 - out_irq->specifier[i] =
374 of_read_number(intspec +i, 1);
375 - out_irq->size = intsize;
376 - out_irq->controller = ipar;
377 + out_irq->args_count = intsize;
378 + out_irq->np = ipar;
382 @@ -280,7 +279,7 @@ EXPORT_SYMBOL_GPL(of_irq_parse_raw);
383 * This function resolves an interrupt, walking the tree, for a given
384 * device-tree node. It's the high level pendant to of_irq_parse_raw().
386 -int of_irq_parse_one(struct device_node *device, int index, struct of_irq *out_irq)
387 +int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_args *out_irq)
389 struct device_node *p;
390 const __be32 *intspec, *tmp, *addr;
391 --- a/drivers/of/of_pci_irq.c
392 +++ b/drivers/of/of_pci_irq.c
394 * PCI tree until an device-node is found, at which point it will finish
395 * resolving using the OF tree walking.
397 -int of_irq_parse_pci(const struct pci_dev *pdev, struct of_irq *out_irq)
398 +int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq)
400 struct device_node *dn, *ppnode;
401 struct pci_dev *ppdev;
402 --- a/drivers/pci/host/pci-mvebu.c
403 +++ b/drivers/pci/host/pci-mvebu.c
404 @@ -649,15 +649,14 @@ static int __init mvebu_pcie_setup(int n
406 static int __init mvebu_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
408 - struct of_irq oirq;
409 + struct of_phandle_args oirq;
412 ret = of_irq_parse_pci(dev, &oirq);
416 - return irq_create_of_mapping(oirq.controller, oirq.specifier,
418 + return irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count);
421 static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys)
422 --- a/include/linux/of_irq.h
423 +++ b/include/linux/of_irq.h
425 #include <linux/ioport.h>
426 #include <linux/of.h>
429 - * of_irq - container for device_node/irq_specifier pair for an irq controller
430 - * @controller: pointer to interrupt controller device tree node
431 - * @size: size of interrupt specifier
432 - * @specifier: array of cells @size long specifing the specific interrupt
434 - * This structure is returned when an interrupt is mapped. The controller
435 - * field needs to be put() after use
437 -#define OF_MAX_IRQ_SPEC 4 /* We handle specifiers of at most 4 cells */
439 - struct device_node *controller; /* Interrupt controller node */
440 - u32 size; /* Specifier size */
441 - u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
444 typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
447 @@ -36,12 +20,12 @@ typedef int (*of_irq_init_cb_t)(struct d
448 extern unsigned int of_irq_workarounds;
449 extern struct device_node *of_irq_dflt_pic;
450 extern int of_irq_parse_oldworld(struct device_node *device, int index,
451 - struct of_irq *out_irq);
452 + struct of_phandle_args *out_irq);
453 #else /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
454 #define of_irq_workarounds (0)
455 #define of_irq_dflt_pic (NULL)
456 static inline int of_irq_parse_oldworld(struct device_node *device, int index,
457 - struct of_irq *out_irq)
458 + struct of_phandle_args *out_irq)
462 @@ -50,9 +34,9 @@ static inline int of_irq_parse_oldworld(
464 extern int of_irq_parse_raw(struct device_node *parent, const __be32 *intspec,
465 u32 ointsize, const __be32 *addr,
466 - struct of_irq *out_irq);
467 + struct of_phandle_args *out_irq);
468 extern int of_irq_parse_one(struct device_node *device, int index,
469 - struct of_irq *out_irq);
470 + struct of_phandle_args *out_irq);
471 extern unsigned int irq_create_of_mapping(struct device_node *controller,
473 unsigned int intsize);
474 --- a/include/linux/of_pci.h
475 +++ b/include/linux/of_pci.h
477 #include <linux/msi.h>
481 -int of_irq_parse_pci(const struct pci_dev *pdev, struct of_irq *out_irq);
482 +struct of_phandle_args;
483 +int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq);
486 struct device_node *of_pci_find_child_device(struct device_node *parent,