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

of: eliminate of_device->node and dev_archdata->{of,prom}_node

This patch eliminates the node pointer from struct of_device and the
of_node (or prom_node) pointer from struct dev_archdata since the node
pointer is now part of struct device proper when CONFIG_OF is set, and
all users of the old pointer locations have already been converted over
to use device->of_node.

Also remove dev_archdata_{get,set}_node() as it is no longer used by
anything.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

+16 -80
-15
arch/microblaze/include/asm/device.h
··· 12 12 struct device_node; 13 13 14 14 struct dev_archdata { 15 - /* Optional pointer to an OF device node */ 16 - struct device_node *of_node; 17 - 18 15 /* DMA operations on that device */ 19 16 struct dma_map_ops *dma_ops; 20 17 void *dma_data; ··· 19 22 20 23 struct pdev_archdata { 21 24 }; 22 - 23 - static inline void dev_archdata_set_node(struct dev_archdata *ad, 24 - struct device_node *np) 25 - { 26 - ad->of_node = np; 27 - } 28 - 29 - static inline struct device_node * 30 - dev_archdata_get_node(const struct dev_archdata *ad) 31 - { 32 - return ad->of_node; 33 - } 34 25 35 26 #endif /* _ASM_MICROBLAZE_DEVICE_H */ 36 27
-1
arch/microblaze/include/asm/of_device.h
··· 21 21 * probed using OF properties. 22 22 */ 23 23 struct of_device { 24 - struct device_node *node; /* to be obsoleted */ 25 24 u64 dma_mask; /* DMA mask */ 26 25 struct device dev; /* Generic device interface */ 27 26 };
+1 -3
arch/microblaze/kernel/of_device.c
··· 49 49 if (!dev) 50 50 return NULL; 51 51 52 - dev->node = of_node_get(np); 52 + dev->dev.of_node = of_node_get(np); 53 53 dev->dev.dma_mask = &dev->dma_mask; 54 54 dev->dev.parent = parent; 55 55 dev->dev.release = of_release_dev; 56 - dev->dev.archdata.of_node = np; 57 - dev->dev.of_node = np; 58 56 59 57 if (bus_id) 60 58 dev_set_name(&dev->dev, bus_id);
-15
arch/powerpc/include/asm/device.h
··· 10 10 struct device_node; 11 11 12 12 struct dev_archdata { 13 - /* Optional pointer to an OF device node */ 14 - struct device_node *of_node; 15 - 16 13 /* DMA operations on that device */ 17 14 struct dma_map_ops *dma_ops; 18 15 ··· 26 29 dma_addr_t max_direct_dma_addr; 27 30 #endif 28 31 }; 29 - 30 - static inline void dev_archdata_set_node(struct dev_archdata *ad, 31 - struct device_node *np) 32 - { 33 - ad->of_node = np; 34 - } 35 - 36 - static inline struct device_node * 37 - dev_archdata_get_node(const struct dev_archdata *ad) 38 - { 39 - return ad->of_node; 40 - } 41 32 42 33 struct pdev_archdata { 43 34 };
-1
arch/powerpc/include/asm/of_device.h
··· 12 12 */ 13 13 struct of_device 14 14 { 15 - struct device_node *node; /* to be obsoleted */ 16 15 u64 dma_mask; /* DMA mask */ 17 16 struct device dev; /* Generic device interface */ 18 17 };
+1 -3
arch/powerpc/kernel/of_device.c
··· 69 69 if (!dev) 70 70 return NULL; 71 71 72 - dev->node = of_node_get(np); 72 + dev->dev.of_node = of_node_get(np); 73 73 dev->dev.dma_mask = &dev->dma_mask; 74 74 dev->dev.parent = parent; 75 75 dev->dev.release = of_release_dev; 76 - dev->dev.archdata.of_node = np; 77 - dev->dev.of_node = np; 78 76 79 77 if (bus_id) 80 78 dev_set_name(&dev->dev, "%s", bus_id);
-1
arch/powerpc/kernel/pci-common.c
··· 1098 1098 continue; 1099 1099 1100 1100 /* Setup OF node pointer in the device */ 1101 - sd->of_node = pci_device_to_OF_node(dev); 1102 1101 dev->dev.of_node = pci_device_to_OF_node(dev); 1103 1102 1104 1103 /* Fixup NUMA node as it may not be setup yet by the generic
+8 -9
arch/powerpc/kernel/vio.c
··· 705 705 * Check to see that device has a DMA window and configure 706 706 * entitlement for the device. 707 707 */ 708 - if (of_get_property(viodev->dev.archdata.of_node, 708 + if (of_get_property(viodev->dev.of_node, 709 709 "ibm,my-dma-window", NULL)) { 710 710 /* Check that the driver is CMO enabled and get desired DMA */ 711 711 if (!viodrv->get_desired_dma) { ··· 1049 1049 if (firmware_has_feature(FW_FEATURE_ISERIES)) 1050 1050 return vio_build_iommu_table_iseries(dev); 1051 1051 1052 - dma_window = of_get_property(dev->dev.archdata.of_node, 1052 + dma_window = of_get_property(dev->dev.of_node, 1053 1053 "ibm,my-dma-window", NULL); 1054 1054 if (!dma_window) 1055 1055 return NULL; ··· 1058 1058 if (tbl == NULL) 1059 1059 return NULL; 1060 1060 1061 - of_parse_dma_window(dev->dev.archdata.of_node, dma_window, 1061 + of_parse_dma_window(dev->dev.of_node, dma_window, 1062 1062 &tbl->it_index, &offset, &size); 1063 1063 1064 1064 /* TCE table size - measured in tce entries */ ··· 1086 1086 { 1087 1087 while (ids->type[0] != '\0') { 1088 1088 if ((strncmp(dev->type, ids->type, strlen(ids->type)) == 0) && 1089 - of_device_is_compatible(dev->dev.archdata.of_node, 1089 + of_device_is_compatible(dev->dev.of_node, 1090 1090 ids->compat)) 1091 1091 return ids; 1092 1092 ids++; ··· 1179 1179 static void __devinit vio_dev_release(struct device *dev) 1180 1180 { 1181 1181 /* XXX should free TCE table */ 1182 - of_node_put(dev->archdata.of_node); 1182 + of_node_put(dev->of_node); 1183 1183 kfree(to_vio_dev(dev)); 1184 1184 } 1185 1185 ··· 1231 1231 viodev->unit_address = *unit_address; 1232 1232 } 1233 1233 viodev->dev.of_node = of_node_get(of_node); 1234 - viodev->dev.archdata.of_node = viodev->dev.of_node; 1235 1234 1236 1235 if (firmware_has_feature(FW_FEATURE_CMO)) 1237 1236 vio_cmo_set_dma_ops(viodev); ··· 1315 1316 static ssize_t devspec_show(struct device *dev, 1316 1317 struct device_attribute *attr, char *buf) 1317 1318 { 1318 - struct device_node *of_node = dev->archdata.of_node; 1319 + struct device_node *of_node = dev->of_node; 1319 1320 1320 1321 return sprintf(buf, "%s\n", of_node ? of_node->full_name : "none"); 1321 1322 } ··· 1347 1348 struct device_node *dn; 1348 1349 const char *cp; 1349 1350 1350 - dn = dev->archdata.of_node; 1351 + dn = dev->of_node; 1351 1352 if (!dn) 1352 1353 return -ENODEV; 1353 1354 cp = of_get_property(dn, "compatible", NULL); ··· 1378 1379 */ 1379 1380 const void *vio_get_attribute(struct vio_dev *vdev, char *which, int *length) 1380 1381 { 1381 - return of_get_property(vdev->dev.archdata.of_node, which, length); 1382 + return of_get_property(vdev->dev.of_node, which, length); 1382 1383 } 1383 1384 EXPORT_SYMBOL(vio_get_attribute); 1384 1385
+2 -3
arch/powerpc/platforms/cell/iommu.c
··· 545 545 { 546 546 struct iommu_window *window; 547 547 struct cbe_iommu *iommu; 548 - struct dev_archdata *archdata = &dev->archdata; 549 548 550 549 /* Current implementation uses the first window available in that 551 550 * node's iommu. We -might- do something smarter later though it may ··· 553 554 iommu = cell_iommu_for_node(dev_to_node(dev)); 554 555 if (iommu == NULL || list_empty(&iommu->windows)) { 555 556 printk(KERN_ERR "iommu: missing iommu for %s (node %d)\n", 556 - archdata->of_node ? archdata->of_node->full_name : "?", 557 + dev->of_node ? dev->of_node->full_name : "?", 557 558 dev_to_node(dev)); 558 559 return NULL; 559 560 } ··· 896 897 const u32 *ranges = NULL; 897 898 int i, len, best, naddr, nsize, pna, range_size; 898 899 899 - np = of_node_get(dev->archdata.of_node); 900 + np = of_node_get(dev->of_node); 900 901 while (1) { 901 902 naddr = of_n_addr_cells(np); 902 903 nsize = of_n_size_cells(np);
+2 -2
arch/powerpc/platforms/pasemi/setup.c
··· 360 360 /* We know electra_cf devices will always have of_node set, since 361 361 * electra_cf is an of_platform driver. 362 362 */ 363 - if (!parent->archdata.of_node) 363 + if (!parent->of_node) 364 364 return 0; 365 365 366 - if (!of_device_is_compatible(parent->archdata.of_node, "electra-cf")) 366 + if (!of_device_is_compatible(parent->of_node, "electra-cf")) 367 367 return 0; 368 368 369 369 /* We use the direct ops for localbus */
-1
arch/powerpc/platforms/ps3/system-bus.c
··· 767 767 }; 768 768 769 769 dev->core.of_node = NULL; 770 - dev->core.archdata.of_node = NULL; 771 770 set_dev_node(&dev->core, 0); 772 771 773 772 pr_debug("%s:%d add %s\n", __func__, __LINE__, dev_name(&dev->core));
+1 -1
arch/powerpc/platforms/pseries/iommu.c
··· 468 468 469 469 pr_debug("pci_dma_dev_setup_pSeries: %s\n", pci_name(dev)); 470 470 471 - dn = dev->dev.archdata.of_node; 471 + dn = dev->dev.of_node; 472 472 473 473 /* If we're the direct child of a root bus, then we need to allocate 474 474 * an iommu table ourselves. The bus setup code should have setup
-15
arch/sparc/include/asm/device.h
··· 13 13 void *iommu; 14 14 void *stc; 15 15 void *host_controller; 16 - 17 - struct device_node *prom_node; 18 16 struct of_device *op; 19 - 20 17 int numa_node; 21 18 }; 22 - 23 - static inline void dev_archdata_set_node(struct dev_archdata *ad, 24 - struct device_node *np) 25 - { 26 - ad->prom_node = np; 27 - } 28 - 29 - static inline struct device_node * 30 - dev_archdata_get_node(const struct dev_archdata *ad) 31 - { 32 - return ad->prom_node; 33 - } 34 19 35 20 struct pdev_archdata { 36 21 };
-1
arch/sparc/include/asm/of_device.h
··· 14 14 */ 15 15 struct of_device 16 16 { 17 - struct device_node *node; 18 17 struct device dev; 19 18 struct resource resource[PROMREG_MAX]; 20 19 unsigned int irqs[PROMINTR_MAX];
-2
arch/sparc/kernel/of_device_32.c
··· 345 345 return NULL; 346 346 347 347 sd = &op->dev.archdata; 348 - sd->prom_node = dp; 349 348 sd->op = op; 350 349 351 350 op->dev.of_node = dp; 352 - op->node = dp; 353 351 354 352 op->clock_freq = of_getintprop_default(dp, "clock-frequency", 355 353 (25*1000*1000));
-2
arch/sparc/kernel/of_device_64.c
··· 640 640 return NULL; 641 641 642 642 sd = &op->dev.archdata; 643 - sd->prom_node = dp; 644 643 sd->op = op; 645 644 646 645 op->dev.of_node = dp; 647 - op->node = dp; 648 646 649 647 op->clock_freq = of_getintprop_default(dp, "clock-frequency", 650 648 (25*1000*1000));
+1 -2
arch/sparc/kernel/pci.c
··· 261 261 sd->iommu = pbm->iommu; 262 262 sd->stc = &pbm->stc; 263 263 sd->host_controller = pbm; 264 - sd->prom_node = node; 265 - dev->dev.of_node = node; 266 264 sd->op = op = of_find_device_by_node(node); 267 265 sd->numa_node = pbm->numa_node; 268 266 ··· 284 286 dev->sysdata = node; 285 287 dev->dev.parent = bus->bridge; 286 288 dev->dev.bus = &pci_bus_type; 289 + dev->dev.of_node = node; 287 290 dev->devfn = devfn; 288 291 dev->multifunction = 0; /* maybe a lie? */ 289 292 set_pcie_port_type(dev);
-1
drivers/of/of_i2c.c
··· 42 42 43 43 info.addr = be32_to_cpup(addr); 44 44 45 - dev_archdata_set_node(&dev_ad, node); 46 45 info.of_node = node; 47 46 info.archdata = &dev_ad; 48 47
-1
drivers/of/of_mdio.c
··· 79 79 /* Associate the OF node with the device structure so it 80 80 * can be looked up later */ 81 81 of_node_get(child); 82 - dev_archdata_set_node(&phy->dev.archdata, child); 83 82 phy->dev.of_node = child; 84 83 85 84 /* All data is now stored in the phy struct; register it */
-1
drivers/of/of_spi.c
··· 80 80 /* Store a pointer to the node in the device structure */ 81 81 of_node_get(nc); 82 82 spi->dev.of_node = nc; 83 - spi->dev.archdata.of_node = nc; 84 83 85 84 /* Register the new device */ 86 85 request_module(spi->modalias);