of: eliminate of_device->node and dev_archdata->{of,prom}_node
authorGrant Likely <grant.likely@secretlab.ca>
Tue, 13 Apr 2010 23:12:56 +0000 (16:12 -0700)
committerGrant Likely <grant.likely@secretlab.ca>
Tue, 18 May 2010 22:10:45 +0000 (16:10 -0600)
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>
20 files changed:
arch/microblaze/include/asm/device.h
arch/microblaze/include/asm/of_device.h
arch/microblaze/kernel/of_device.c
arch/powerpc/include/asm/device.h
arch/powerpc/include/asm/of_device.h
arch/powerpc/kernel/of_device.c
arch/powerpc/kernel/pci-common.c
arch/powerpc/kernel/vio.c
arch/powerpc/platforms/cell/iommu.c
arch/powerpc/platforms/pasemi/setup.c
arch/powerpc/platforms/ps3/system-bus.c
arch/powerpc/platforms/pseries/iommu.c
arch/sparc/include/asm/device.h
arch/sparc/include/asm/of_device.h
arch/sparc/kernel/of_device_32.c
arch/sparc/kernel/of_device_64.c
arch/sparc/kernel/pci.c
drivers/of/of_i2c.c
drivers/of/of_mdio.c
drivers/of/of_spi.c

index 402b46e630f6d5acb6490b92a047264ce17ec802..15b0058aa7ffa3108eee796ca866ae4b8cf7d855 100644 (file)
@@ -12,9 +12,6 @@
 struct device_node;
 
 struct dev_archdata {
-       /* Optional pointer to an OF device node */
-       struct device_node      *of_node;
-
        /* DMA operations on that device */
        struct dma_map_ops      *dma_ops;
        void                    *dma_data;
@@ -23,18 +20,6 @@ struct dev_archdata {
 struct pdev_archdata {
 };
 
-static inline void dev_archdata_set_node(struct dev_archdata *ad,
-                                        struct device_node *np)
-{
-       ad->of_node = np;
-}
-
-static inline struct device_node *
-dev_archdata_get_node(const struct dev_archdata *ad)
-{
-       return ad->of_node;
-}
-
 #endif /* _ASM_MICROBLAZE_DEVICE_H */
 
 
index ba917cfaefe6c4e6027ac46d12970f1168e08e35..ab25a40b481c69c3121995a3dba20386e8f340bb 100644 (file)
@@ -21,7 +21,6 @@
  * probed using OF properties.
  */
 struct of_device {
-       struct device_node      *node; /* to be obsoleted */
        u64                     dma_mask; /* DMA mask */
        struct device           dev; /* Generic device interface */
 };
index 90d2246e15c07a1a73bc281bad946a266f06506d..ac7e6e10d0abc7cf7b950b3e5b756735e79cc5c2 100644 (file)
@@ -49,12 +49,10 @@ struct of_device *of_device_alloc(struct device_node *np,
        if (!dev)
                return NULL;
 
-       dev->node = of_node_get(np);
+       dev->dev.of_node = of_node_get(np);
        dev->dev.dma_mask = &dev->dma_mask;
        dev->dev.parent = parent;
        dev->dev.release = of_release_dev;
-       dev->dev.archdata.of_node = np;
-       dev->dev.of_node = np;
 
        if (bus_id)
                dev_set_name(&dev->dev, bus_id);
index 6d94d27ed850a7110627f943398e65b885665075..f23f8d8bd68d3246756c90da87dd0f9376f08804 100644 (file)
@@ -10,9 +10,6 @@ struct dma_map_ops;
 struct device_node;
 
 struct dev_archdata {
-       /* Optional pointer to an OF device node */
-       struct device_node      *of_node;
-
        /* DMA operations on that device */
        struct dma_map_ops      *dma_ops;
 
@@ -30,18 +27,6 @@ struct dev_archdata {
 #endif
 };
 
-static inline void dev_archdata_set_node(struct dev_archdata *ad,
-                                        struct device_node *np)
-{
-       ad->of_node = np;
-}
-
-static inline struct device_node *
-dev_archdata_get_node(const struct dev_archdata *ad)
-{
-       return ad->of_node;
-}
-
 struct pdev_archdata {
 };
 
index a64debf177dca8efcbe7534333f81a5b2d3d26d5..8b26f96b9f9ec6ec51f0a7e8a406c5f9acfe47d0 100644 (file)
@@ -12,7 +12,6 @@
  */
 struct of_device
 {
-       struct device_node      *node;          /* to be obsoleted */
        u64                     dma_mask;       /* DMA mask */
        struct device           dev;            /* Generic device interface */
 };
index 285c8490c5471dfb01728da9ae112df6d28d865b..20b3474b6f6baf0f14109d4d3fe4641997c3aa98 100644 (file)
@@ -69,12 +69,10 @@ struct of_device *of_device_alloc(struct device_node *np,
        if (!dev)
                return NULL;
 
-       dev->node = of_node_get(np);
+       dev->dev.of_node = of_node_get(np);
        dev->dev.dma_mask = &dev->dma_mask;
        dev->dev.parent = parent;
        dev->dev.release = of_release_dev;
-       dev->dev.archdata.of_node = np;
-       dev->dev.of_node = np;
 
        if (bus_id)
                dev_set_name(&dev->dev, "%s", bus_id);
index 88da282047c39c9ee73e0a66d6a667172e3e81aa..6646005dffb102b8b57172442aa8a71c5ed85a82 100644 (file)
@@ -1098,7 +1098,6 @@ void __devinit pcibios_setup_bus_devices(struct pci_bus *bus)
                        continue;
 
                /* Setup OF node pointer in the device */
-               sd->of_node = pci_device_to_OF_node(dev);
                dev->dev.of_node = pci_device_to_OF_node(dev);
 
                /* Fixup NUMA node as it may not be setup yet by the generic
index d6708da114eef852c956e0c92eefc8f1addbbe75..4cdd0f6df8bfcb7e6ff7319ffd6487ee10c0b335 100644 (file)
@@ -705,7 +705,7 @@ static int vio_cmo_bus_probe(struct vio_dev *viodev)
         * Check to see that device has a DMA window and configure
         * entitlement for the device.
         */
-       if (of_get_property(viodev->dev.archdata.of_node,
+       if (of_get_property(viodev->dev.of_node,
                            "ibm,my-dma-window", NULL)) {
                /* Check that the driver is CMO enabled and get desired DMA */
                if (!viodrv->get_desired_dma) {
@@ -1049,7 +1049,7 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
        if (firmware_has_feature(FW_FEATURE_ISERIES))
                return vio_build_iommu_table_iseries(dev);
 
-       dma_window = of_get_property(dev->dev.archdata.of_node,
+       dma_window = of_get_property(dev->dev.of_node,
                                  "ibm,my-dma-window", NULL);
        if (!dma_window)
                return NULL;
@@ -1058,7 +1058,7 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
        if (tbl == NULL)
                return NULL;
 
-       of_parse_dma_window(dev->dev.archdata.of_node, dma_window,
+       of_parse_dma_window(dev->dev.of_node, dma_window,
                            &tbl->it_index, &offset, &size);
 
        /* TCE table size - measured in tce entries */
@@ -1086,7 +1086,7 @@ static const struct vio_device_id *vio_match_device(
 {
        while (ids->type[0] != '\0') {
                if ((strncmp(dev->type, ids->type, strlen(ids->type)) == 0) &&
-                   of_device_is_compatible(dev->dev.archdata.of_node,
+                   of_device_is_compatible(dev->dev.of_node,
                                         ids->compat))
                        return ids;
                ids++;
@@ -1179,7 +1179,7 @@ EXPORT_SYMBOL(vio_unregister_driver);
 static void __devinit vio_dev_release(struct device *dev)
 {
        /* XXX should free TCE table */
-       of_node_put(dev->archdata.of_node);
+       of_node_put(dev->of_node);
        kfree(to_vio_dev(dev));
 }
 
@@ -1231,7 +1231,6 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
                        viodev->unit_address = *unit_address;
        }
        viodev->dev.of_node = of_node_get(of_node);
-       viodev->dev.archdata.of_node = viodev->dev.of_node;
 
        if (firmware_has_feature(FW_FEATURE_CMO))
                vio_cmo_set_dma_ops(viodev);
@@ -1316,7 +1315,7 @@ static ssize_t name_show(struct device *dev,
 static ssize_t devspec_show(struct device *dev,
                struct device_attribute *attr, char *buf)
 {
-       struct device_node *of_node = dev->archdata.of_node;
+       struct device_node *of_node = dev->of_node;
 
        return sprintf(buf, "%s\n", of_node ? of_node->full_name : "none");
 }
@@ -1348,7 +1347,7 @@ static int vio_hotplug(struct device *dev, struct kobj_uevent_env *env)
        struct device_node *dn;
        const char *cp;
 
-       dn = dev->archdata.of_node;
+       dn = dev->of_node;
        if (!dn)
                return -ENODEV;
        cp = of_get_property(dn, "compatible", NULL);
@@ -1379,7 +1378,7 @@ static struct bus_type vio_bus_type = {
 */
 const void *vio_get_attribute(struct vio_dev *vdev, char *which, int *length)
 {
-       return of_get_property(vdev->dev.archdata.of_node, which, length);
+       return of_get_property(vdev->dev.of_node, which, length);
 }
 EXPORT_SYMBOL(vio_get_attribute);
 
index e3ec4976fae7a554c405ce7823d34b09bfbf37c5..22667a09d40eee6276eff723a8e4523e2b2e5bd2 100644 (file)
@@ -545,7 +545,6 @@ static struct iommu_table *cell_get_iommu_table(struct device *dev)
 {
        struct iommu_window *window;
        struct cbe_iommu *iommu;
-       struct dev_archdata *archdata = &dev->archdata;
 
        /* Current implementation uses the first window available in that
         * node's iommu. We -might- do something smarter later though it may
@@ -554,7 +553,7 @@ static struct iommu_table *cell_get_iommu_table(struct device *dev)
        iommu = cell_iommu_for_node(dev_to_node(dev));
        if (iommu == NULL || list_empty(&iommu->windows)) {
                printk(KERN_ERR "iommu: missing iommu for %s (node %d)\n",
-                      archdata->of_node ? archdata->of_node->full_name : "?",
+                      dev->of_node ? dev->of_node->full_name : "?",
                       dev_to_node(dev));
                return NULL;
        }
@@ -897,7 +896,7 @@ static u64 cell_iommu_get_fixed_address(struct device *dev)
        const u32 *ranges = NULL;
        int i, len, best, naddr, nsize, pna, range_size;
 
-       np = of_node_get(dev->archdata.of_node);
+       np = of_node_get(dev->of_node);
        while (1) {
                naddr = of_n_addr_cells(np);
                nsize = of_n_size_cells(np);
index ac6fdd9732912848dd3cc3ee8d606e9ff8c6a894..f372ec1691a3d79450e6cf64f6f7d72b38e8f590 100644 (file)
@@ -360,10 +360,10 @@ static int pcmcia_notify(struct notifier_block *nb, unsigned long action,
        /* We know electra_cf devices will always have of_node set, since
         * electra_cf is an of_platform driver.
         */
-       if (!parent->archdata.of_node)
+       if (!parent->of_node)
                return 0;
 
-       if (!of_device_is_compatible(parent->archdata.of_node, "electra-cf"))
+       if (!of_device_is_compatible(parent->of_node, "electra-cf"))
                return 0;
 
        /* We use the direct ops for localbus */
index e546c86a539bc7fbcddcdbe9bf68d6feeceb1e64..23083c397528408e182b2e2cd8be6d5078aafdab 100644 (file)
@@ -767,7 +767,6 @@ int ps3_system_bus_device_register(struct ps3_system_bus_device *dev)
        };
 
        dev->core.of_node = NULL;
-       dev->core.archdata.of_node = NULL;
        set_dev_node(&dev->core, 0);
 
        pr_debug("%s:%d add %s\n", __func__, __LINE__, dev_name(&dev->core));
index 1a0000a4b6d62636d93babf7b495000413aa000a..d26182d42cbfb5a712fb6803dfdf056f560e0c33 100644 (file)
@@ -468,7 +468,7 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
 
        pr_debug("pci_dma_dev_setup_pSeries: %s\n", pci_name(dev));
 
-       dn = dev->dev.archdata.of_node;
+       dn = dev->dev.of_node;
 
        /* If we're the direct child of a root bus, then we need to allocate
         * an iommu table ourselves. The bus setup code should have setup
index f3b85b6b0b764796407f2e2a026a5a45163561e2..d4c45214741252d7327daf0ba0f50c10dcef6f5f 100644 (file)
@@ -13,25 +13,10 @@ struct dev_archdata {
        void                    *iommu;
        void                    *stc;
        void                    *host_controller;
-
-       struct device_node      *prom_node;
        struct of_device        *op;
-
        int                     numa_node;
 };
 
-static inline void dev_archdata_set_node(struct dev_archdata *ad,
-                                        struct device_node *np)
-{
-       ad->prom_node = np;
-}
-
-static inline struct device_node *
-dev_archdata_get_node(const struct dev_archdata *ad)
-{
-       return ad->prom_node;
-}
-
 struct pdev_archdata {
 };
 
index a5d9811f9697734863510a8b1c7336d228ac45ab..f320246a05863ddfd05d9e107e1aa85f12f24880 100644 (file)
@@ -14,7 +14,6 @@
  */
 struct of_device
 {
-       struct device_node              *node;
        struct device                   dev;
        struct resource                 resource[PROMREG_MAX];
        unsigned int                    irqs[PROMINTR_MAX];
index 707311716142811782f17383e77f8ae8b8acc422..47e63f1e719c7a2d9e4d4e757b1bf0a07e16d308 100644 (file)
@@ -345,11 +345,9 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
                return NULL;
 
        sd = &op->dev.archdata;
-       sd->prom_node = dp;
        sd->op = op;
 
        op->dev.of_node = dp;
-       op->node = dp;
 
        op->clock_freq = of_getintprop_default(dp, "clock-frequency",
                                               (25*1000*1000));
index c8e352e0a098aa6f0f0857ac3a549b813fecda33..1dae8079f7287a7d52631bb589899c93f3c146d0 100644 (file)
@@ -640,11 +640,9 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
                return NULL;
 
        sd = &op->dev.archdata;
-       sd->prom_node = dp;
        sd->op = op;
 
        op->dev.of_node = dp;
-       op->node = dp;
 
        op->clock_freq = of_getintprop_default(dp, "clock-frequency",
                                               (25*1000*1000));
index c7a214ec5affc3fbf397a3a6b1f4cc6d466c5774..8a8363adb8bd1ac68c1ad49e6afba66dc7b43ae5 100644 (file)
@@ -261,8 +261,6 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
        sd->iommu = pbm->iommu;
        sd->stc = &pbm->stc;
        sd->host_controller = pbm;
-       sd->prom_node = node;
-       dev->dev.of_node = node;
        sd->op = op = of_find_device_by_node(node);
        sd->numa_node = pbm->numa_node;
 
@@ -286,6 +284,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
        dev->sysdata = node;
        dev->dev.parent = bus->bridge;
        dev->dev.bus = &pci_bus_type;
+       dev->dev.of_node = node;
        dev->devfn = devfn;
        dev->multifunction = 0;         /* maybe a lie? */
        set_pcie_port_type(dev);
index 604ba966e1c91db8872ce7c93875b4e063bb002b..ab6522c8e4fe801fc5ae8fefb782fdc0869a77fa 100644 (file)
@@ -42,7 +42,6 @@ void of_register_i2c_devices(struct i2c_adapter *adap,
 
                info.addr = be32_to_cpup(addr);
 
-               dev_archdata_set_node(&dev_ad, node);
                info.of_node = node;
                info.archdata = &dev_ad;
 
index 01d794abe105ce1bfcda114dedcf4ca0b7466610..794fbc2ef73d1d668c1cb4cfeceece8f71a94756 100644 (file)
@@ -79,7 +79,6 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
                /* Associate the OF node with the device structure so it
                 * can be looked up later */
                of_node_get(child);
-               dev_archdata_set_node(&phy->dev.archdata, child);
                phy->dev.of_node = child;
 
                /* All data is now stored in the phy struct; register it */
index f3119a0836af940ea7ae72da3a74edecead1ca23..5fed7e3c7da341362a1c7bdf08f53b5e4b11c60a 100644 (file)
@@ -80,7 +80,6 @@ void of_register_spi_devices(struct spi_master *master, struct device_node *np)
                /* Store a pointer to the node in the device structure */
                of_node_get(nc);
                spi->dev.of_node = nc;
-               spi->dev.archdata.of_node = nc;
 
                /* Register the new device */
                request_module(spi->modalias);