Commit d706c1b050274b3bf97d7cb0542c0d070c9ccb8b
1 parent
efb2e014fc
Exists in
master
and in
7 other branches
driver-core: Add device node pointer to struct device
Currently, platforms using CONFIG_OF add a 'struct device_node *of_node' to dev->archdata. However, with CONFIG_OF becoming generic for all architectures, it makes sense for commonality to move it out of archdata and into struct device proper. This patch adds a struct device_node *of_node member to struct device and updates all locations which currently write the device_node pointer into archdata to also update dev->of_node. Subsequent patches will modify callers to use the archdata location and ultimately remove the archdata member entirely. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> CC: Michal Simek <monstr@monstr.eu> CC: Greg Kroah-Hartman <gregkh@suse.de> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org> CC: "David S. Miller" <davem@davemloft.net> CC: Stephen Rothwell <sfr@canb.auug.org.au> CC: Jeremy Kerr <jeremy.kerr@canonical.com> CC: microblaze-uclinux@itee.uq.edu.au CC: linux-kernel@vger.kernel.org CC: linuxppc-dev@ozlabs.org CC: sparclinux@vger.kernel.org
Showing 11 changed files with 16 additions and 2 deletions Side-by-side Diff
- arch/microblaze/kernel/of_device.c
- arch/powerpc/kernel/of_device.c
- arch/powerpc/kernel/pci-common.c
- arch/powerpc/kernel/vio.c
- arch/powerpc/platforms/ps3/system-bus.c
- arch/sparc/kernel/of_device_32.c
- arch/sparc/kernel/of_device_64.c
- arch/sparc/kernel/pci.c
- drivers/of/of_mdio.c
- drivers/of/of_spi.c
- include/linux/device.h
arch/microblaze/kernel/of_device.c
arch/powerpc/kernel/of_device.c
arch/powerpc/kernel/pci-common.c
... | ... | @@ -1097,8 +1097,9 @@ |
1097 | 1097 | if (dev->is_added) |
1098 | 1098 | continue; |
1099 | 1099 | |
1100 | - /* Setup OF node pointer in archdata */ | |
1100 | + /* Setup OF node pointer in the device */ | |
1101 | 1101 | sd->of_node = pci_device_to_OF_node(dev); |
1102 | + dev->dev.of_node = pci_device_to_OF_node(dev); | |
1102 | 1103 | |
1103 | 1104 | /* Fixup NUMA node as it may not be setup yet by the generic |
1104 | 1105 | * code and is needed by the DMA init |
arch/powerpc/kernel/vio.c
... | ... | @@ -1230,7 +1230,8 @@ |
1230 | 1230 | if (unit_address != NULL) |
1231 | 1231 | viodev->unit_address = *unit_address; |
1232 | 1232 | } |
1233 | - viodev->dev.archdata.of_node = of_node_get(of_node); | |
1233 | + viodev->dev.of_node = of_node_get(of_node); | |
1234 | + viodev->dev.archdata.of_node = viodev->dev.of_node; | |
1234 | 1235 | |
1235 | 1236 | if (firmware_has_feature(FW_FEATURE_CMO)) |
1236 | 1237 | vio_cmo_set_dma_ops(viodev); |
arch/powerpc/platforms/ps3/system-bus.c
arch/sparc/kernel/of_device_32.c
arch/sparc/kernel/of_device_64.c
arch/sparc/kernel/pci.c
drivers/of/of_mdio.c
drivers/of/of_spi.c
include/linux/device.h
... | ... | @@ -34,6 +34,7 @@ |
34 | 34 | struct class_private; |
35 | 35 | struct bus_type; |
36 | 36 | struct bus_type_private; |
37 | +struct device_node; | |
37 | 38 | |
38 | 39 | struct bus_attribute { |
39 | 40 | struct attribute attr; |
... | ... | @@ -433,6 +434,9 @@ |
433 | 434 | override */ |
434 | 435 | /* arch specific additions */ |
435 | 436 | struct dev_archdata archdata; |
437 | +#ifdef CONFIG_OF | |
438 | + struct device_node *of_node; | |
439 | +#endif | |
436 | 440 | |
437 | 441 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
438 | 442 |