Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

of/irq: Replace of_irq with of_phandle_args

struct of_irq and struct of_phandle_args are exactly the same structure.
This patch makes the kernel use of_phandle_args everywhere. This in
itself isn't a big deal, but it makes some follow-on patches simpler.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
Acked-by: Michal Simek <monstr@monstr.eu>
Acked-by: Tony Lindgren <tony@atomide.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>

+58 -88
+2 -3
arch/arm/mach-integrator/pci_v3.c
··· 837 837 838 838 static int __init pci_v3_map_irq_dt(const struct pci_dev *dev, u8 slot, u8 pin) 839 839 { 840 - struct of_irq oirq; 840 + struct of_phandle_args oirq; 841 841 int ret; 842 842 843 843 ret = of_irq_parse_pci(dev, &oirq); ··· 847 847 return 0; 848 848 } 849 849 850 - return irq_create_of_mapping(oirq.controller, oirq.specifier, 851 - oirq.size); 850 + return irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count); 852 851 } 853 852 854 853 static int __init pci_v3_dtprobe(struct platform_device *pdev,
+4 -5
arch/microblaze/pci/pci-common.c
··· 199 199 */ 200 200 int pci_read_irq_line(struct pci_dev *pci_dev) 201 201 { 202 - struct of_irq oirq; 202 + struct of_phandle_args oirq; 203 203 unsigned int virq; 204 204 205 205 /* The current device-tree that iSeries generates from the HV ··· 243 243 irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW); 244 244 } else { 245 245 pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n", 246 - oirq.size, oirq.specifier[0], oirq.specifier[1], 247 - of_node_full_name(oirq.controller)); 246 + oirq.args_count, oirq.args[0], oirq.args[1], 247 + of_node_full_name(oirq.np)); 248 248 249 - virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 250 - oirq.size); 249 + virq = irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count); 251 250 } 252 251 if (!virq) { 253 252 pr_debug(" Failed to map !\n");
+2 -3
arch/mips/pci/fixup-lantiq.c
··· 25 25 26 26 int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 27 27 { 28 - struct of_irq dev_irq; 28 + struct of_phandle_args dev_irq; 29 29 int irq; 30 30 31 31 if (of_irq_parse_pci(dev, &dev_irq)) { ··· 33 33 slot, pin); 34 34 return 0; 35 35 } 36 - irq = irq_create_of_mapping(dev_irq.controller, dev_irq.specifier, 37 - dev_irq.size); 36 + irq = irq_create_of_mapping(dev_irq.np, dev_irq.args, dev_irq.args_count); 38 37 dev_info(&dev->dev, "SLOT:%d PIN:%d IRQ:%d\n", slot, pin, irq); 39 38 return irq; 40 39 }
+2 -4
arch/mips/pci/pci-rt3883.c
··· 583 583 584 584 int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 585 585 { 586 - struct of_irq dev_irq; 586 + struct of_phandle_args dev_irq; 587 587 int err; 588 588 int irq; 589 589 ··· 594 594 return 0; 595 595 } 596 596 597 - irq = irq_create_of_mapping(dev_irq.controller, 598 - dev_irq.specifier, 599 - dev_irq.size); 597 + irq = irq_create_of_mapping(dev_irq.np, dev_irq.args, dev_irq.args_count); 600 598 601 599 if (irq == 0) 602 600 pr_crit("pci %s: no irq found for pin %u\n",
+4 -5
arch/powerpc/kernel/pci-common.c
··· 228 228 */ 229 229 static int pci_read_irq_line(struct pci_dev *pci_dev) 230 230 { 231 - struct of_irq oirq; 231 + struct of_phandle_args oirq; 232 232 unsigned int virq; 233 233 234 234 pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev)); ··· 263 263 irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW); 264 264 } else { 265 265 pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n", 266 - oirq.size, oirq.specifier[0], oirq.specifier[1], 267 - of_node_full_name(oirq.controller)); 266 + oirq.args_count, oirq.args[0], oirq.args[1], 267 + of_node_full_name(oirq.np)); 268 268 269 - virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 270 - oirq.size); 269 + virq = irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count); 271 270 } 272 271 if(virq == NO_IRQ) { 273 272 pr_debug(" Failed to map !\n");
+2 -3
arch/powerpc/platforms/cell/celleb_scc_pciex.c
··· 486 486 struct pci_controller *phb) 487 487 { 488 488 struct resource r; 489 - struct of_irq oirq; 489 + struct of_phandle_args oirq; 490 490 int virq; 491 491 492 492 /* SMMIO registers; used inside this file */ ··· 511 511 pr_err("PCIEXC:Failed to map irq\n"); 512 512 goto error; 513 513 } 514 - virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 515 - oirq.size); 514 + virq = irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count); 516 515 if (request_irq(virq, pciex_handle_internal_irq, 517 516 0, "pciex", (void *)phb)) { 518 517 pr_err("PCIEXC:Failed to request irq\n");
+2 -3
arch/powerpc/platforms/cell/celleb_scc_sio.c
··· 45 45 struct device_node *node; 46 46 int i; 47 47 struct uart_port req; 48 - struct of_irq irq; 48 + struct of_phandle_args irq; 49 49 struct resource res; 50 50 51 51 for_each_compatible_node(node, "serial", "toshiba,sio-scc") { ··· 66 66 #ifdef CONFIG_SERIAL_TXX9_CONSOLE 67 67 req.membase = ioremap(req.mapbase, 0x24); 68 68 #endif 69 - req.irq = irq_create_of_mapping(irq.controller, 70 - irq.specifier, irq.size); 69 + req.irq = irq_create_of_mapping(irq.np, irq.args, irq.args_count); 71 70 req.flags |= UPF_IOREMAP | UPF_BUGGY_UART 72 71 /*HAVE_CTS_LINE*/; 73 72 req.uartclk = 83300000;
+3 -3
arch/powerpc/platforms/cell/spider-pic.c
··· 235 235 /* First, we check whether we have a real "interrupts" in the device 236 236 * tree in case the device-tree is ever fixed 237 237 */ 238 - struct of_irq oirq; 238 + struct of_phandle_args oirq; 239 239 if (of_irq_parse_one(pic->host->of_node, 0, &oirq) == 0) { 240 - virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 241 - oirq.size); 240 + virq = irq_create_of_mapping(oirq.np, oirq.args, 241 + oirq.args_count); 242 242 return virq; 243 243 } 244 244
+6 -6
arch/powerpc/platforms/cell/spu_manage.c
··· 177 177 178 178 static int __init spu_map_interrupts(struct spu *spu, struct device_node *np) 179 179 { 180 - struct of_irq oirq; 180 + struct of_phandle_args oirq; 181 181 int ret; 182 182 int i; 183 183 ··· 188 188 goto err; 189 189 } 190 190 ret = -EINVAL; 191 - pr_debug(" irq %d no 0x%x on %s\n", i, oirq.specifier[0], 192 - oirq.controller->full_name); 193 - spu->irqs[i] = irq_create_of_mapping(oirq.controller, 194 - oirq.specifier, oirq.size); 191 + pr_debug(" irq %d no 0x%x on %s\n", i, oirq.args[0], 192 + oirq.np->full_name); 193 + spu->irqs[i] = irq_create_of_mapping(oirq.np, 194 + oirq.args, oirq.args_count); 195 195 if (spu->irqs[i] == NO_IRQ) { 196 196 pr_debug("spu_new: failed to map it !\n"); 197 197 goto err; ··· 200 200 return 0; 201 201 202 202 err: 203 - pr_debug("failed to map irq %x for spu %s\n", *oirq.specifier, 203 + pr_debug("failed to map irq %x for spu %s\n", *oirq.args, 204 204 spu->name); 205 205 for (; i >= 0; i--) { 206 206 if (spu->irqs[i] != NO_IRQ)
+3 -5
arch/powerpc/platforms/fsl_uli1575.c
··· 321 321 { 322 322 struct pci_controller *hose = pci_bus_to_host(dev->bus); 323 323 struct device_node *hosenode = hose ? hose->dn : NULL; 324 - struct of_irq oirq; 325 - int virq, pin = 2; 324 + struct of_phandle_args oirq; 325 + int pin = 2; 326 326 u32 laddr[3]; 327 327 328 328 if (!machine_is(mpc86xx_hpcd)) ··· 334 334 laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(31, 0) << 8); 335 335 laddr[1] = laddr[2] = 0; 336 336 of_irq_parse_raw(hosenode, &pin, 1, laddr, &oirq); 337 - virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 338 - oirq.size); 339 - dev->irq = virq; 337 + dev->irq = irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count); 340 338 } 341 339 342 340 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, hpcd_quirk_uli1575);
+4 -4
arch/powerpc/platforms/powermac/pic.c
··· 394 394 } 395 395 396 396 int of_irq_parse_oldworld(struct device_node *device, int index, 397 - struct of_irq *out_irq) 397 + struct of_phandle_args *out_irq) 398 398 { 399 399 const u32 *ints = NULL; 400 400 int intlen; ··· 422 422 if (index >= intlen) 423 423 return -EINVAL; 424 424 425 - out_irq->controller = NULL; 426 - out_irq->specifier[0] = ints[index]; 427 - out_irq->size = 1; 425 + out_irq->np = NULL; 426 + out_irq->args[0] = ints[index]; 427 + out_irq->args_count = 1; 428 428 429 429 return 0; 430 430 }
+3 -4
arch/powerpc/platforms/pseries/event_sources.c
··· 25 25 const char *name) 26 26 { 27 27 int i, index, count = 0; 28 - struct of_irq oirq; 28 + struct of_phandle_args oirq; 29 29 const u32 *opicprop; 30 30 unsigned int opicplen; 31 31 unsigned int virqs[16]; ··· 59 59 index++) { 60 60 if (count > 15) 61 61 break; 62 - virqs[count] = irq_create_of_mapping(oirq.controller, 63 - oirq.specifier, 64 - oirq.size); 62 + virqs[count] = irq_create_of_mapping(oirq.np, oirq.args, 63 + oirq.args_count); 65 64 if (virqs[count] == NO_IRQ) { 66 65 pr_err("event-sources: Unable to allocate " 67 66 "interrupt number for %s\n",
+3 -3
arch/powerpc/sysdev/mpic_msi.c
··· 35 35 const struct irq_domain_ops *ops = mpic->irqhost->ops; 36 36 struct device_node *np; 37 37 int flags, index, i; 38 - struct of_irq oirq; 38 + struct of_phandle_args oirq; 39 39 40 40 pr_debug("mpic: found U3, guessing msi allocator setup\n"); 41 41 ··· 64 64 65 65 index = 0; 66 66 while (of_irq_parse_one(np, index++, &oirq) == 0) { 67 - ops->xlate(mpic->irqhost, NULL, oirq.specifier, 68 - oirq.size, &hwirq, &flags); 67 + ops->xlate(mpic->irqhost, NULL, oirq.args, 68 + oirq.args_count, &hwirq, &flags); 69 69 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, hwirq); 70 70 } 71 71 }
+2 -3
arch/x86/kernel/devicetree.c
··· 105 105 106 106 static int x86_of_pci_irq_enable(struct pci_dev *dev) 107 107 { 108 - struct of_irq oirq; 108 + struct of_phandle_args oirq; 109 109 u32 virq; 110 110 int ret; 111 111 u8 pin; ··· 120 120 if (ret) 121 121 return ret; 122 122 123 - virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 124 - oirq.size); 123 + virq = irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count); 125 124 if (virq == 0) 126 125 return -EINVAL; 127 126 dev->irq = virq;
+7 -8
drivers/of/irq.c
··· 36 36 */ 37 37 unsigned int irq_of_parse_and_map(struct device_node *dev, int index) 38 38 { 39 - struct of_irq oirq; 39 + struct of_phandle_args oirq; 40 40 41 41 if (of_irq_parse_one(dev, index, &oirq)) 42 42 return 0; 43 43 44 - return irq_create_of_mapping(oirq.controller, oirq.specifier, 45 - oirq.size); 44 + return irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count); 46 45 } 47 46 EXPORT_SYMBOL_GPL(irq_of_parse_and_map); 48 47 ··· 93 94 * node exist for the parent. 94 95 */ 95 96 int of_irq_parse_raw(struct device_node *parent, const __be32 *intspec, 96 - u32 ointsize, const __be32 *addr, struct of_irq *out_irq) 97 + u32 ointsize, const __be32 *addr, struct of_phandle_args *out_irq) 97 98 { 98 99 struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; 99 100 const __be32 *tmp, *imap, *imask; ··· 155 156 NULL) { 156 157 pr_debug(" -> got it !\n"); 157 158 for (i = 0; i < intsize; i++) 158 - out_irq->specifier[i] = 159 + out_irq->args[i] = 159 160 of_read_number(intspec +i, 1); 160 - out_irq->size = intsize; 161 - out_irq->controller = ipar; 161 + out_irq->args_count = intsize; 162 + out_irq->np = ipar; 162 163 of_node_put(old); 163 164 return 0; 164 165 } ··· 279 280 * This function resolves an interrupt, walking the tree, for a given 280 281 * device-tree node. It's the high level pendant to of_irq_parse_raw(). 281 282 */ 282 - int of_irq_parse_one(struct device_node *device, int index, struct of_irq *out_irq) 283 + int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_args *out_irq) 283 284 { 284 285 struct device_node *p; 285 286 const __be32 *intspec, *tmp, *addr;
+1 -1
drivers/of/of_pci_irq.c
··· 15 15 * PCI tree until an device-node is found, at which point it will finish 16 16 * resolving using the OF tree walking. 17 17 */ 18 - int of_irq_parse_pci(const struct pci_dev *pdev, struct of_irq *out_irq) 18 + int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) 19 19 { 20 20 struct device_node *dn, *ppnode; 21 21 struct pci_dev *ppdev;
+2 -3
drivers/pci/host/pci-mvebu.c
··· 647 647 648 648 static int __init mvebu_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 649 649 { 650 - struct of_irq oirq; 650 + struct of_phandle_args oirq; 651 651 int ret; 652 652 653 653 ret = of_irq_parse_pci(dev, &oirq); 654 654 if (ret) 655 655 return ret; 656 656 657 - return irq_create_of_mapping(oirq.controller, oirq.specifier, 658 - oirq.size); 657 + return irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count); 659 658 } 660 659 661 660 static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys)
+4 -20
include/linux/of_irq.h
··· 8 8 #include <linux/ioport.h> 9 9 #include <linux/of.h> 10 10 11 - /** 12 - * of_irq - container for device_node/irq_specifier pair for an irq controller 13 - * @controller: pointer to interrupt controller device tree node 14 - * @size: size of interrupt specifier 15 - * @specifier: array of cells @size long specifing the specific interrupt 16 - * 17 - * This structure is returned when an interrupt is mapped. The controller 18 - * field needs to be put() after use 19 - */ 20 - #define OF_MAX_IRQ_SPEC 4 /* We handle specifiers of at most 4 cells */ 21 - struct of_irq { 22 - struct device_node *controller; /* Interrupt controller node */ 23 - u32 size; /* Specifier size */ 24 - u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */ 25 - }; 26 - 27 11 typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *); 28 12 29 13 /* ··· 20 36 extern unsigned int of_irq_workarounds; 21 37 extern struct device_node *of_irq_dflt_pic; 22 38 extern int of_irq_parse_oldworld(struct device_node *device, int index, 23 - struct of_irq *out_irq); 39 + struct of_phandle_args *out_irq); 24 40 #else /* CONFIG_PPC32 && CONFIG_PPC_PMAC */ 25 41 #define of_irq_workarounds (0) 26 42 #define of_irq_dflt_pic (NULL) 27 43 static inline int of_irq_parse_oldworld(struct device_node *device, int index, 28 - struct of_irq *out_irq) 44 + struct of_phandle_args *out_irq) 29 45 { 30 46 return -EINVAL; 31 47 } ··· 34 50 35 51 extern int of_irq_parse_raw(struct device_node *parent, const __be32 *intspec, 36 52 u32 ointsize, const __be32 *addr, 37 - struct of_irq *out_irq); 53 + struct of_phandle_args *out_irq); 38 54 extern int of_irq_parse_one(struct device_node *device, int index, 39 - struct of_irq *out_irq); 55 + struct of_phandle_args *out_irq); 40 56 extern unsigned int irq_create_of_mapping(struct device_node *controller, 41 57 const u32 *intspec, 42 58 unsigned int intsize);
+2 -2
include/linux/of_pci.h
··· 5 5 #include <linux/msi.h> 6 6 7 7 struct pci_dev; 8 - struct of_irq; 9 - int of_irq_parse_pci(const struct pci_dev *pdev, struct of_irq *out_irq); 8 + struct of_phandle_args; 9 + int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq); 10 10 11 11 struct device_node; 12 12 struct device_node *of_pci_find_child_device(struct device_node *parent,