Skip to content

Commit 58f9b0b

Browse files
committed
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 <[email protected]>
1 parent 61c7a08 commit 58f9b0b

File tree

20 files changed

+16
-80
lines changed

20 files changed

+16
-80
lines changed

arch/microblaze/include/asm/device.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
struct device_node;
1313

1414
struct dev_archdata {
15-
/* Optional pointer to an OF device node */
16-
struct device_node *of_node;
17-
1815
/* DMA operations on that device */
1916
struct dma_map_ops *dma_ops;
2017
void *dma_data;
@@ -23,18 +20,6 @@ struct dev_archdata {
2320
struct pdev_archdata {
2421
};
2522

26-
static inline void dev_archdata_set_node(struct dev_archdata *ad,
27-
struct device_node *np)
28-
{
29-
ad->of_node = np;
30-
}
31-
32-
static inline struct device_node *
33-
dev_archdata_get_node(const struct dev_archdata *ad)
34-
{
35-
return ad->of_node;
36-
}
37-
3823
#endif /* _ASM_MICROBLAZE_DEVICE_H */
3924

4025

arch/microblaze/include/asm/of_device.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
* probed using OF properties.
2222
*/
2323
struct of_device {
24-
struct device_node *node; /* to be obsoleted */
2524
u64 dma_mask; /* DMA mask */
2625
struct device dev; /* Generic device interface */
2726
};

arch/microblaze/kernel/of_device.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,10 @@ struct of_device *of_device_alloc(struct device_node *np,
4949
if (!dev)
5050
return NULL;
5151

52-
dev->node = of_node_get(np);
52+
dev->dev.of_node = of_node_get(np);
5353
dev->dev.dma_mask = &dev->dma_mask;
5454
dev->dev.parent = parent;
5555
dev->dev.release = of_release_dev;
56-
dev->dev.archdata.of_node = np;
57-
dev->dev.of_node = np;
5856

5957
if (bus_id)
6058
dev_set_name(&dev->dev, bus_id);

arch/powerpc/include/asm/device.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ struct dma_map_ops;
1010
struct device_node;
1111

1212
struct dev_archdata {
13-
/* Optional pointer to an OF device node */
14-
struct device_node *of_node;
15-
1613
/* DMA operations on that device */
1714
struct dma_map_ops *dma_ops;
1815

@@ -30,18 +27,6 @@ struct dev_archdata {
3027
#endif
3128
};
3229

33-
static inline void dev_archdata_set_node(struct dev_archdata *ad,
34-
struct device_node *np)
35-
{
36-
ad->of_node = np;
37-
}
38-
39-
static inline struct device_node *
40-
dev_archdata_get_node(const struct dev_archdata *ad)
41-
{
42-
return ad->of_node;
43-
}
44-
4530
struct pdev_archdata {
4631
};
4732

arch/powerpc/include/asm/of_device.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
*/
1313
struct of_device
1414
{
15-
struct device_node *node; /* to be obsoleted */
1615
u64 dma_mask; /* DMA mask */
1716
struct device dev; /* Generic device interface */
1817
};

arch/powerpc/kernel/of_device.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,10 @@ struct of_device *of_device_alloc(struct device_node *np,
6969
if (!dev)
7070
return NULL;
7171

72-
dev->node = of_node_get(np);
72+
dev->dev.of_node = of_node_get(np);
7373
dev->dev.dma_mask = &dev->dma_mask;
7474
dev->dev.parent = parent;
7575
dev->dev.release = of_release_dev;
76-
dev->dev.archdata.of_node = np;
77-
dev->dev.of_node = np;
7876

7977
if (bus_id)
8078
dev_set_name(&dev->dev, "%s", bus_id);

arch/powerpc/kernel/pci-common.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,6 @@ void __devinit pcibios_setup_bus_devices(struct pci_bus *bus)
10981098
continue;
10991099

11001100
/* Setup OF node pointer in the device */
1101-
sd->of_node = pci_device_to_OF_node(dev);
11021101
dev->dev.of_node = pci_device_to_OF_node(dev);
11031102

11041103
/* Fixup NUMA node as it may not be setup yet by the generic

arch/powerpc/kernel/vio.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ static int vio_cmo_bus_probe(struct vio_dev *viodev)
705705
* Check to see that device has a DMA window and configure
706706
* entitlement for the device.
707707
*/
708-
if (of_get_property(viodev->dev.archdata.of_node,
708+
if (of_get_property(viodev->dev.of_node,
709709
"ibm,my-dma-window", NULL)) {
710710
/* Check that the driver is CMO enabled and get desired DMA */
711711
if (!viodrv->get_desired_dma) {
@@ -1049,7 +1049,7 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
10491049
if (firmware_has_feature(FW_FEATURE_ISERIES))
10501050
return vio_build_iommu_table_iseries(dev);
10511051

1052-
dma_window = of_get_property(dev->dev.archdata.of_node,
1052+
dma_window = of_get_property(dev->dev.of_node,
10531053
"ibm,my-dma-window", NULL);
10541054
if (!dma_window)
10551055
return NULL;
@@ -1058,7 +1058,7 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
10581058
if (tbl == NULL)
10591059
return NULL;
10601060

1061-
of_parse_dma_window(dev->dev.archdata.of_node, dma_window,
1061+
of_parse_dma_window(dev->dev.of_node, dma_window,
10621062
&tbl->it_index, &offset, &size);
10631063

10641064
/* TCE table size - measured in tce entries */
@@ -1086,7 +1086,7 @@ static const struct vio_device_id *vio_match_device(
10861086
{
10871087
while (ids->type[0] != '\0') {
10881088
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,
10901090
ids->compat))
10911091
return ids;
10921092
ids++;
@@ -1179,7 +1179,7 @@ EXPORT_SYMBOL(vio_unregister_driver);
11791179
static void __devinit vio_dev_release(struct device *dev)
11801180
{
11811181
/* XXX should free TCE table */
1182-
of_node_put(dev->archdata.of_node);
1182+
of_node_put(dev->of_node);
11831183
kfree(to_vio_dev(dev));
11841184
}
11851185

@@ -1231,7 +1231,6 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
12311231
viodev->unit_address = *unit_address;
12321232
}
12331233
viodev->dev.of_node = of_node_get(of_node);
1234-
viodev->dev.archdata.of_node = viodev->dev.of_node;
12351234

12361235
if (firmware_has_feature(FW_FEATURE_CMO))
12371236
vio_cmo_set_dma_ops(viodev);
@@ -1316,7 +1315,7 @@ static ssize_t name_show(struct device *dev,
13161315
static ssize_t devspec_show(struct device *dev,
13171316
struct device_attribute *attr, char *buf)
13181317
{
1319-
struct device_node *of_node = dev->archdata.of_node;
1318+
struct device_node *of_node = dev->of_node;
13201319

13211320
return sprintf(buf, "%s\n", of_node ? of_node->full_name : "none");
13221321
}
@@ -1348,7 +1347,7 @@ static int vio_hotplug(struct device *dev, struct kobj_uevent_env *env)
13481347
struct device_node *dn;
13491348
const char *cp;
13501349

1351-
dn = dev->archdata.of_node;
1350+
dn = dev->of_node;
13521351
if (!dn)
13531352
return -ENODEV;
13541353
cp = of_get_property(dn, "compatible", NULL);
@@ -1379,7 +1378,7 @@ static struct bus_type vio_bus_type = {
13791378
*/
13801379
const void *vio_get_attribute(struct vio_dev *vdev, char *which, int *length)
13811380
{
1382-
return of_get_property(vdev->dev.archdata.of_node, which, length);
1381+
return of_get_property(vdev->dev.of_node, which, length);
13831382
}
13841383
EXPORT_SYMBOL(vio_get_attribute);
13851384

arch/powerpc/platforms/cell/iommu.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,6 @@ static struct iommu_table *cell_get_iommu_table(struct device *dev)
545545
{
546546
struct iommu_window *window;
547547
struct cbe_iommu *iommu;
548-
struct dev_archdata *archdata = &dev->archdata;
549548

550549
/* Current implementation uses the first window available in that
551550
* 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)
554553
iommu = cell_iommu_for_node(dev_to_node(dev));
555554
if (iommu == NULL || list_empty(&iommu->windows)) {
556555
printk(KERN_ERR "iommu: missing iommu for %s (node %d)\n",
557-
archdata->of_node ? archdata->of_node->full_name : "?",
556+
dev->of_node ? dev->of_node->full_name : "?",
558557
dev_to_node(dev));
559558
return NULL;
560559
}
@@ -897,7 +896,7 @@ static u64 cell_iommu_get_fixed_address(struct device *dev)
897896
const u32 *ranges = NULL;
898897
int i, len, best, naddr, nsize, pna, range_size;
899898

900-
np = of_node_get(dev->archdata.of_node);
899+
np = of_node_get(dev->of_node);
901900
while (1) {
902901
naddr = of_n_addr_cells(np);
903902
nsize = of_n_size_cells(np);

arch/powerpc/platforms/pasemi/setup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,10 @@ static int pcmcia_notify(struct notifier_block *nb, unsigned long action,
360360
/* We know electra_cf devices will always have of_node set, since
361361
* electra_cf is an of_platform driver.
362362
*/
363-
if (!parent->archdata.of_node)
363+
if (!parent->of_node)
364364
return 0;
365365

366-
if (!of_device_is_compatible(parent->archdata.of_node, "electra-cf"))
366+
if (!of_device_is_compatible(parent->of_node, "electra-cf"))
367367
return 0;
368368

369369
/* We use the direct ops for localbus */

arch/powerpc/platforms/ps3/system-bus.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,6 @@ int ps3_system_bus_device_register(struct ps3_system_bus_device *dev)
767767
};
768768

769769
dev->core.of_node = NULL;
770-
dev->core.archdata.of_node = NULL;
771770
set_dev_node(&dev->core, 0);
772771

773772
pr_debug("%s:%d add %s\n", __func__, __LINE__, dev_name(&dev->core));

arch/powerpc/platforms/pseries/iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
468468

469469
pr_debug("pci_dma_dev_setup_pSeries: %s\n", pci_name(dev));
470470

471-
dn = dev->dev.archdata.of_node;
471+
dn = dev->dev.of_node;
472472

473473
/* If we're the direct child of a root bus, then we need to allocate
474474
* an iommu table ourselves. The bus setup code should have setup

arch/sparc/include/asm/device.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,10 @@ struct dev_archdata {
1313
void *iommu;
1414
void *stc;
1515
void *host_controller;
16-
17-
struct device_node *prom_node;
1816
struct of_device *op;
19-
2017
int numa_node;
2118
};
2219

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-
3520
struct pdev_archdata {
3621
};
3722

arch/sparc/include/asm/of_device.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
*/
1515
struct of_device
1616
{
17-
struct device_node *node;
1817
struct device dev;
1918
struct resource resource[PROMREG_MAX];
2019
unsigned int irqs[PROMINTR_MAX];

arch/sparc/kernel/of_device_32.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,9 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
345345
return NULL;
346346

347347
sd = &op->dev.archdata;
348-
sd->prom_node = dp;
349348
sd->op = op;
350349

351350
op->dev.of_node = dp;
352-
op->node = dp;
353351

354352
op->clock_freq = of_getintprop_default(dp, "clock-frequency",
355353
(25*1000*1000));

arch/sparc/kernel/of_device_64.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,11 +640,9 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
640640
return NULL;
641641

642642
sd = &op->dev.archdata;
643-
sd->prom_node = dp;
644643
sd->op = op;
645644

646645
op->dev.of_node = dp;
647-
op->node = dp;
648646

649647
op->clock_freq = of_getintprop_default(dp, "clock-frequency",
650648
(25*1000*1000));

arch/sparc/kernel/pci.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,6 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
261261
sd->iommu = pbm->iommu;
262262
sd->stc = &pbm->stc;
263263
sd->host_controller = pbm;
264-
sd->prom_node = node;
265-
dev->dev.of_node = node;
266264
sd->op = op = of_find_device_by_node(node);
267265
sd->numa_node = pbm->numa_node;
268266

@@ -286,6 +284,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
286284
dev->sysdata = node;
287285
dev->dev.parent = bus->bridge;
288286
dev->dev.bus = &pci_bus_type;
287+
dev->dev.of_node = node;
289288
dev->devfn = devfn;
290289
dev->multifunction = 0; /* maybe a lie? */
291290
set_pcie_port_type(dev);

drivers/of/of_i2c.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ void of_register_i2c_devices(struct i2c_adapter *adap,
4242

4343
info.addr = be32_to_cpup(addr);
4444

45-
dev_archdata_set_node(&dev_ad, node);
4645
info.of_node = node;
4746
info.archdata = &dev_ad;
4847

drivers/of/of_mdio.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
7979
/* Associate the OF node with the device structure so it
8080
* can be looked up later */
8181
of_node_get(child);
82-
dev_archdata_set_node(&phy->dev.archdata, child);
8382
phy->dev.of_node = child;
8483

8584
/* All data is now stored in the phy struct; register it */

drivers/of/of_spi.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ void of_register_spi_devices(struct spi_master *master, struct device_node *np)
8080
/* Store a pointer to the node in the device structure */
8181
of_node_get(nc);
8282
spi->dev.of_node = nc;
83-
spi->dev.archdata.of_node = nc;
8483

8584
/* Register the new device */
8685
request_module(spi->modalias);

0 commit comments

Comments
 (0)