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

of/irq: Rename of_irq_map_* functions to of_irq_parse_*

The OF irq handling code has been overloading the term 'map' to refer to
both parsing the data in the device tree and mapping it to the internal
linux irq system. This is probably because the device tree does have the
concept of an 'interrupt-map' function for translating interrupt
references from one node to another, but 'map' is still confusing when
the primary purpose of some of the functions are to parse the DT data.

This patch renames all the of_irq_map_* functions to of_irq_parse_*
which makes it clear that there is a difference between the parsing
phase and the mapping phase. Kernel code can make use of just the
parsing or just the mapping support as needed by the subsystem.

The patch was generated mechanically with a handful of sed commands.

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

+42 -42
+2 -2
arch/arm/mach-integrator/pci_v3.c
··· 840 840 struct of_irq oirq; 841 841 int ret; 842 842 843 - ret = of_irq_map_pci(dev, &oirq); 843 + ret = of_irq_parse_pci(dev, &oirq); 844 844 if (ret) { 845 - dev_err(&dev->dev, "of_irq_map_pci() %d\n", ret); 845 + dev_err(&dev->dev, "of_irq_parse_pci() %d\n", ret); 846 846 /* Proper return code 0 == NO_IRQ */ 847 847 return 0; 848 848 }
+1 -1
arch/microblaze/pci/pci-common.c
··· 217 217 memset(&oirq, 0xff, sizeof(oirq)); 218 218 #endif 219 219 /* Try to get a mapping from the device-tree */ 220 - if (of_irq_map_pci(pci_dev, &oirq)) { 220 + if (of_irq_parse_pci(pci_dev, &oirq)) { 221 221 u8 line, pin; 222 222 223 223 /* If that fails, lets fallback to what is in the config
+1 -1
arch/mips/pci/fixup-lantiq.c
··· 28 28 struct of_irq dev_irq; 29 29 int irq; 30 30 31 - if (of_irq_map_pci(dev, &dev_irq)) { 31 + if (of_irq_parse_pci(dev, &dev_irq)) { 32 32 dev_err(&dev->dev, "trying to map irq for unknown slot:%d pin:%d\n", 33 33 slot, pin); 34 34 return 0;
+1 -1
arch/mips/pci/pci-rt3883.c
··· 587 587 int err; 588 588 int irq; 589 589 590 - err = of_irq_map_pci(dev, &dev_irq); 590 + err = of_irq_parse_pci(dev, &dev_irq); 591 591 if (err) { 592 592 pr_err("pci %s: unable to get irq map, err=%d\n", 593 593 pci_name((struct pci_dev *) dev), err);
+1 -1
arch/powerpc/kernel/pci-common.c
··· 237 237 memset(&oirq, 0xff, sizeof(oirq)); 238 238 #endif 239 239 /* Try to get a mapping from the device-tree */ 240 - if (of_irq_map_pci(pci_dev, &oirq)) { 240 + if (of_irq_parse_pci(pci_dev, &oirq)) { 241 241 u8 line, pin; 242 242 243 243 /* If that fails, lets fallback to what is in the config
+1 -1
arch/powerpc/platforms/cell/celleb_scc_pciex.c
··· 507 507 phb->ops = &scc_pciex_pci_ops; 508 508 509 509 /* internal interrupt handler */ 510 - if (of_irq_map_one(node, 1, &oirq)) { 510 + if (of_irq_parse_one(node, 1, &oirq)) { 511 511 pr_err("PCIEXC:Failed to map irq\n"); 512 512 goto error; 513 513 }
+1 -1
arch/powerpc/platforms/cell/celleb_scc_sio.c
··· 53 53 if (!(txx9_serial_bitmap & (1<<i))) 54 54 continue; 55 55 56 - if (of_irq_map_one(node, i, &irq)) 56 + if (of_irq_parse_one(node, i, &irq)) 57 57 continue; 58 58 if (of_address_to_resource(node, 59 59 txx9_scc_tab[i].index, &res))
+1 -1
arch/powerpc/platforms/cell/spider-pic.c
··· 236 236 * tree in case the device-tree is ever fixed 237 237 */ 238 238 struct of_irq oirq; 239 - if (of_irq_map_one(pic->host->of_node, 0, &oirq) == 0) { 239 + if (of_irq_parse_one(pic->host->of_node, 0, &oirq) == 0) { 240 240 virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 241 241 oirq.size); 242 242 return virq;
+1 -1
arch/powerpc/platforms/cell/spu_manage.c
··· 182 182 int i; 183 183 184 184 for (i=0; i < 3; i++) { 185 - ret = of_irq_map_one(np, i, &oirq); 185 + ret = of_irq_parse_one(np, i, &oirq); 186 186 if (ret) { 187 187 pr_debug("spu_new: failed to get irq %d\n", i); 188 188 goto err;
+1 -1
arch/powerpc/platforms/fsl_uli1575.c
··· 333 333 334 334 laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(31, 0) << 8); 335 335 laddr[1] = laddr[2] = 0; 336 - of_irq_map_raw(hosenode, &pin, 1, laddr, &oirq); 336 + of_irq_parse_raw(hosenode, &pin, 1, laddr, &oirq); 337 337 virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 338 338 oirq.size); 339 339 dev->irq = virq;
+1 -1
arch/powerpc/platforms/powermac/pic.c
··· 393 393 #endif 394 394 } 395 395 396 - int of_irq_map_oldworld(struct device_node *device, int index, 396 + int of_irq_parse_oldworld(struct device_node *device, int index, 397 397 struct of_irq *out_irq) 398 398 { 399 399 const u32 *ints = NULL;
+1 -1
arch/powerpc/platforms/pseries/event_sources.c
··· 55 55 /* Else use normal interrupt tree parsing */ 56 56 else { 57 57 /* First try to do a proper OF tree parsing */ 58 - for (index = 0; of_irq_map_one(np, index, &oirq) == 0; 58 + for (index = 0; of_irq_parse_one(np, index, &oirq) == 0; 59 59 index++) { 60 60 if (count > 15) 61 61 break;
+1 -1
arch/powerpc/sysdev/mpic_msi.c
··· 63 63 pr_debug("mpic: mapping hwirqs for %s\n", np->full_name); 64 64 65 65 index = 0; 66 - while (of_irq_map_one(np, index++, &oirq) == 0) { 66 + while (of_irq_parse_one(np, index++, &oirq) == 0) { 67 67 ops->xlate(mpic->irqhost, NULL, oirq.specifier, 68 68 oirq.size, &hwirq, &flags); 69 69 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, hwirq);
+1 -1
arch/x86/kernel/devicetree.c
··· 116 116 if (!pin) 117 117 return 0; 118 118 119 - ret = of_irq_map_pci(dev, &oirq); 119 + ret = of_irq_parse_pci(dev, &oirq); 120 120 if (ret) 121 121 return ret; 122 122
+2 -2
drivers/of/address.c
··· 532 532 pbus->count_cells(dev, &pna, &pns); 533 533 if (!OF_CHECK_COUNTS(pna, pns)) { 534 534 printk(KERN_ERR "prom_parse: Bad cell count for %s\n", 535 - dev->full_name); 535 + of_node_full_name(dev)); 536 536 break; 537 537 } 538 538 539 539 pr_debug("OF: parent bus is %s (na=%d, ns=%d) on %s\n", 540 - pbus->name, pna, pns, parent->full_name); 540 + pbus->name, pna, pns, of_node_full_name(parent)); 541 541 542 542 /* Apply bus translation */ 543 543 if (of_translate_one(dev, bus, pbus, addr, na, ns, pna, rprop))
+14 -14
drivers/of/irq.c
··· 31 31 * @dev: Device node of the device whose interrupt is to be mapped 32 32 * @index: Index of the interrupt to map 33 33 * 34 - * This function is a wrapper that chains of_irq_map_one() and 34 + * This function is a wrapper that chains of_irq_parse_one() and 35 35 * irq_create_of_mapping() to make things easier to callers 36 36 */ 37 37 unsigned int irq_of_parse_and_map(struct device_node *dev, int index) 38 38 { 39 39 struct of_irq oirq; 40 40 41 - if (of_irq_map_one(dev, index, &oirq)) 41 + if (of_irq_parse_one(dev, index, &oirq)) 42 42 return 0; 43 43 44 44 return irq_create_of_mapping(oirq.controller, oirq.specifier, ··· 79 79 } 80 80 81 81 /** 82 - * of_irq_map_raw - Low level interrupt tree parsing 82 + * of_irq_parse_raw - Low level interrupt tree parsing 83 83 * @parent: the device interrupt parent 84 84 * @intspec: interrupt specifier ("interrupts" property of the device) 85 85 * @ointsize: size of the passed in interrupt specifier ··· 93 93 * properties, for example when resolving PCI interrupts when no device 94 94 * node exist for the parent. 95 95 */ 96 - int of_irq_map_raw(struct device_node *parent, const __be32 *intspec, 96 + int of_irq_parse_raw(struct device_node *parent, const __be32 *intspec, 97 97 u32 ointsize, const __be32 *addr, struct of_irq *out_irq) 98 98 { 99 99 struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; ··· 101 101 u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; 102 102 int imaplen, match, i; 103 103 104 - pr_debug("of_irq_map_raw: par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n", 104 + pr_debug("of_irq_parse_raw: par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n", 105 105 of_node_full_name(parent), be32_to_cpup(intspec), 106 106 be32_to_cpup(intspec + 1), ointsize); 107 107 ··· 126 126 goto fail; 127 127 } 128 128 129 - pr_debug("of_irq_map_raw: ipar=%s, size=%d\n", of_node_full_name(ipar), intsize); 129 + pr_debug("of_irq_parse_raw: ipar=%s, size=%d\n", of_node_full_name(ipar), intsize); 130 130 131 131 if (ointsize != intsize) 132 132 return -EINVAL; ··· 269 269 270 270 return -EINVAL; 271 271 } 272 - EXPORT_SYMBOL_GPL(of_irq_map_raw); 272 + EXPORT_SYMBOL_GPL(of_irq_parse_raw); 273 273 274 274 /** 275 - * of_irq_map_one - Resolve an interrupt for a device 275 + * of_irq_parse_one - Resolve an interrupt for a device 276 276 * @device: the device whose interrupt is to be resolved 277 277 * @index: index of the interrupt to resolve 278 278 * @out_irq: structure of_irq filled by this function 279 279 * 280 280 * This function resolves an interrupt, walking the tree, for a given 281 - * device-tree node. It's the high level pendant to of_irq_map_raw(). 281 + * device-tree node. It's the high level pendant to of_irq_parse_raw(). 282 282 */ 283 - int of_irq_map_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_irq *out_irq) 284 284 { 285 285 struct device_node *p; 286 286 const __be32 *intspec, *tmp, *addr; 287 287 u32 intsize, intlen; 288 288 int res = -EINVAL; 289 289 290 - pr_debug("of_irq_map_one: dev=%s, index=%d\n", of_node_full_name(device), index); 290 + pr_debug("of_irq_parse_one: dev=%s, index=%d\n", of_node_full_name(device), index); 291 291 292 292 /* OldWorld mac stuff is "special", handle out of line */ 293 293 if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC) 294 - return of_irq_map_oldworld(device, index, out_irq); 294 + return of_irq_parse_oldworld(device, index, out_irq); 295 295 296 296 /* Get the interrupts property */ 297 297 intspec = of_get_property(device, "interrupts", &intlen); ··· 322 322 goto out; 323 323 324 324 /* Get new specifier and map it */ 325 - res = of_irq_map_raw(p, intspec + index * intsize, intsize, 325 + res = of_irq_parse_raw(p, intspec + index * intsize, intsize, 326 326 addr, out_irq); 327 327 out: 328 328 of_node_put(p); 329 329 return res; 330 330 } 331 - EXPORT_SYMBOL_GPL(of_irq_map_one); 331 + EXPORT_SYMBOL_GPL(of_irq_parse_one); 332 332 333 333 /** 334 334 * of_irq_to_resource - Decode a node's IRQ and return it as a resource
+5 -5
drivers/of/of_pci_irq.c
··· 5 5 #include <asm/prom.h> 6 6 7 7 /** 8 - * of_irq_map_pci - Resolve the interrupt for a PCI device 8 + * of_irq_parse_pci - Resolve the interrupt for a PCI device 9 9 * @pdev: the device whose interrupt is to be resolved 10 10 * @out_irq: structure of_irq filled by this function 11 11 * ··· 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_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq) 18 + int of_irq_parse_pci(const struct pci_dev *pdev, struct of_irq *out_irq) 19 19 { 20 20 struct device_node *dn, *ppnode; 21 21 struct pci_dev *ppdev; ··· 30 30 */ 31 31 dn = pci_device_to_OF_node(pdev); 32 32 if (dn) { 33 - rc = of_irq_map_one(dn, 0, out_irq); 33 + rc = of_irq_parse_one(dn, 0, out_irq); 34 34 if (!rc) 35 35 return rc; 36 36 } ··· 88 88 lspec_be = cpu_to_be32(lspec); 89 89 laddr[0] = cpu_to_be32((pdev->bus->number << 16) | (pdev->devfn << 8)); 90 90 laddr[1] = laddr[2] = cpu_to_be32(0); 91 - return of_irq_map_raw(ppnode, &lspec_be, 1, laddr, out_irq); 91 + return of_irq_parse_raw(ppnode, &lspec_be, 1, laddr, out_irq); 92 92 } 93 - EXPORT_SYMBOL_GPL(of_irq_map_pci); 93 + EXPORT_SYMBOL_GPL(of_irq_parse_pci);
+1 -1
drivers/pci/host/pci-mvebu.c
··· 650 650 struct of_irq oirq; 651 651 int ret; 652 652 653 - ret = of_irq_map_pci(dev, &oirq); 653 + ret = of_irq_parse_pci(dev, &oirq); 654 654 if (ret) 655 655 return ret; 656 656
+4 -4
include/linux/of_irq.h
··· 35 35 #if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC) 36 36 extern unsigned int of_irq_workarounds; 37 37 extern struct device_node *of_irq_dflt_pic; 38 - extern int of_irq_map_oldworld(struct device_node *device, int index, 38 + extern int of_irq_parse_oldworld(struct device_node *device, int index, 39 39 struct of_irq *out_irq); 40 40 #else /* CONFIG_PPC32 && CONFIG_PPC_PMAC */ 41 41 #define of_irq_workarounds (0) 42 42 #define of_irq_dflt_pic (NULL) 43 - static inline int of_irq_map_oldworld(struct device_node *device, int index, 43 + static inline int of_irq_parse_oldworld(struct device_node *device, int index, 44 44 struct of_irq *out_irq) 45 45 { 46 46 return -EINVAL; ··· 48 48 #endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */ 49 49 50 50 51 - extern int of_irq_map_raw(struct device_node *parent, const __be32 *intspec, 51 + extern int of_irq_parse_raw(struct device_node *parent, const __be32 *intspec, 52 52 u32 ointsize, const __be32 *addr, 53 53 struct of_irq *out_irq); 54 - extern int of_irq_map_one(struct device_node *device, int index, 54 + extern int of_irq_parse_one(struct device_node *device, int index, 55 55 struct of_irq *out_irq); 56 56 extern unsigned int irq_create_of_mapping(struct device_node *controller, 57 57 const u32 *intspec,
+1 -1
include/linux/of_pci.h
··· 6 6 7 7 struct pci_dev; 8 8 struct of_irq; 9 - int of_irq_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq); 9 + int of_irq_parse_pci(const struct pci_dev *pdev, struct of_irq *out_irq); 10 10 11 11 struct device_node; 12 12 struct device_node *of_pci_find_child_device(struct device_node *parent,