Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d706c1b0 authored by Grant Likely's avatar Grant Likely
Browse files

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: default avatarGrant Likely <grant.likely@secretlab.ca>
Acked-by: default avatarGreg 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
parent efb2e014
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -54,6 +54,7 @@ struct of_device *of_device_alloc(struct device_node *np,
	dev->dev.parent = parent;
	dev->dev.parent = parent;
	dev->dev.release = of_release_dev;
	dev->dev.release = of_release_dev;
	dev->dev.archdata.of_node = np;
	dev->dev.archdata.of_node = np;
	dev->dev.of_node = np;


	if (bus_id)
	if (bus_id)
		dev_set_name(&dev->dev, bus_id);
		dev_set_name(&dev->dev, bus_id);
+1 −0
Original line number Original line Diff line number Diff line
@@ -74,6 +74,7 @@ struct of_device *of_device_alloc(struct device_node *np,
	dev->dev.parent = parent;
	dev->dev.parent = parent;
	dev->dev.release = of_release_dev;
	dev->dev.release = of_release_dev;
	dev->dev.archdata.of_node = np;
	dev->dev.archdata.of_node = np;
	dev->dev.of_node = np;


	if (bus_id)
	if (bus_id)
		dev_set_name(&dev->dev, "%s", bus_id);
		dev_set_name(&dev->dev, "%s", bus_id);
+2 −1
Original line number Original line Diff line number Diff line
@@ -1097,8 +1097,9 @@ void __devinit pcibios_setup_bus_devices(struct pci_bus *bus)
		if (dev->is_added)
		if (dev->is_added)
			continue;
			continue;


		/* Setup OF node pointer in archdata */
		/* Setup OF node pointer in the device */
		sd->of_node = pci_device_to_OF_node(dev);
		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
		/* Fixup NUMA node as it may not be setup yet by the generic
		 * code and is needed by the DMA init
		 * code and is needed by the DMA init
+2 −1
Original line number Original line Diff line number Diff line
@@ -1230,7 +1230,8 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
		if (unit_address != NULL)
		if (unit_address != NULL)
			viodev->unit_address = *unit_address;
			viodev->unit_address = *unit_address;
	}
	}
	viodev->dev.archdata.of_node = of_node_get(of_node);
	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))
	if (firmware_has_feature(FW_FEATURE_CMO))
		vio_cmo_set_dma_ops(viodev);
		vio_cmo_set_dma_ops(viodev);
+1 −0
Original line number Original line Diff line number Diff line
@@ -766,6 +766,7 @@ int ps3_system_bus_device_register(struct ps3_system_bus_device *dev)
		BUG();
		BUG();
	};
	};


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


Loading