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

Commit 61c7a080 authored by Grant Likely's avatar Grant Likely
Browse files

of: Always use 'struct device.of_node' to get device node pointer.



The following structure elements duplicate the information in
'struct device.of_node' and so are being eliminated.  This patch
makes all readers of these elements use device.of_node instead.

(struct of_device *)->node
(struct dev_archdata *)->prom_node (sparc)
(struct dev_archdata *)->of_node (powerpc & microblaze)

Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
parent d12d42f7
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -12,7 +12,7 @@
void of_device_make_bus_id(struct of_device *dev)
void of_device_make_bus_id(struct of_device *dev)
{
{
	static atomic_t bus_no_reg_magic;
	static atomic_t bus_no_reg_magic;
	struct device_node *node = dev->node;
	struct device_node *node = dev->dev.of_node;
	const u32 *reg;
	const u32 *reg;
	u64 addr;
	u64 addr;
	int magic;
	int magic;
@@ -76,17 +76,17 @@ int of_device_uevent(struct device *dev, struct kobj_uevent_env *env)


	ofdev = to_of_device(dev);
	ofdev = to_of_device(dev);


	if (add_uevent_var(env, "OF_NAME=%s", ofdev->node->name))
	if (add_uevent_var(env, "OF_NAME=%s", ofdev->dev.of_node->name))
		return -ENOMEM;
		return -ENOMEM;


	if (add_uevent_var(env, "OF_TYPE=%s", ofdev->node->type))
	if (add_uevent_var(env, "OF_TYPE=%s", ofdev->dev.of_node->type))
		return -ENOMEM;
		return -ENOMEM;


	/* Since the compatible field can contain pretty much anything
	/* Since the compatible field can contain pretty much anything
	 * it's not really legal to split it out with commas. We split it
	 * it's not really legal to split it out with commas. We split it
	 * up using a number of environment variables instead. */
	 * up using a number of environment variables instead. */


	compat = of_get_property(ofdev->node, "compatible", &cplen);
	compat = of_get_property(ofdev->dev.of_node, "compatible", &cplen);
	while (compat && *compat && cplen > 0) {
	while (compat && *compat && cplen > 0) {
		if (add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat))
		if (add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat))
			return -ENOMEM;
			return -ENOMEM;
+2 −2
Original line number Original line Diff line number Diff line
@@ -166,7 +166,7 @@ EXPORT_SYMBOL(of_platform_bus_probe);


static int of_dev_node_match(struct device *dev, void *data)
static int of_dev_node_match(struct device *dev, void *data)
{
{
	return to_of_device(dev)->node == data;
	return to_of_device(dev)->dev.of_node == data;
}
}


struct of_device *of_find_device_by_node(struct device_node *np)
struct of_device *of_find_device_by_node(struct device_node *np)
@@ -184,7 +184,7 @@ EXPORT_SYMBOL(of_find_device_by_node);
static int of_dev_phandle_match(struct device *dev, void *data)
static int of_dev_phandle_match(struct device *dev, void *data)
{
{
	phandle *ph = data;
	phandle *ph = data;
	return to_of_device(dev)->node->phandle == *ph;
	return to_of_device(dev)->dev.of_node->phandle == *ph;
}
}


struct of_device *of_find_device_by_phandle(phandle ph)
struct of_device *of_find_device_by_phandle(phandle ph)
+1 −1
Original line number Original line Diff line number Diff line
@@ -108,7 +108,7 @@ static inline void* macio_get_drvdata(struct macio_dev *dev)


static inline struct device_node *macio_get_of_node(struct macio_dev *mdev)
static inline struct device_node *macio_get_of_node(struct macio_dev *mdev)
{
{
	return mdev->ofdev.node;
	return mdev->ofdev.dev.of_node;
}
}


#ifdef CONFIG_PCI
#ifdef CONFIG_PCI
+2 −2
Original line number Original line Diff line number Diff line
@@ -140,14 +140,14 @@ static struct dma_map_ops ibmebus_dma_ops = {


static int ibmebus_match_path(struct device *dev, void *data)
static int ibmebus_match_path(struct device *dev, void *data)
{
{
	struct device_node *dn = to_of_device(dev)->node;
	struct device_node *dn = to_of_device(dev)->dev.of_node;
	return (dn->full_name &&
	return (dn->full_name &&
		(strcasecmp((char *)data, dn->full_name) == 0));
		(strcasecmp((char *)data, dn->full_name) == 0));
}
}


static int ibmebus_match_node(struct device *dev, void *data)
static int ibmebus_match_node(struct device *dev, void *data)
{
{
	return to_of_device(dev)->node == data;
	return to_of_device(dev)->dev.of_node == data;
}
}


static int ibmebus_create_device(struct device_node *dn)
static int ibmebus_create_device(struct device_node *dn)
+4 −4
Original line number Original line Diff line number Diff line
@@ -13,7 +13,7 @@
static void of_device_make_bus_id(struct of_device *dev)
static void of_device_make_bus_id(struct of_device *dev)
{
{
	static atomic_t bus_no_reg_magic;
	static atomic_t bus_no_reg_magic;
	struct device_node *node = dev->node;
	struct device_node *node = dev->dev.of_node;
	const u32 *reg;
	const u32 *reg;
	u64 addr;
	u64 addr;
	int magic;
	int magic;
@@ -96,17 +96,17 @@ int of_device_uevent(struct device *dev, struct kobj_uevent_env *env)


	ofdev = to_of_device(dev);
	ofdev = to_of_device(dev);


	if (add_uevent_var(env, "OF_NAME=%s", ofdev->node->name))
	if (add_uevent_var(env, "OF_NAME=%s", ofdev->dev.of_node->name))
		return -ENOMEM;
		return -ENOMEM;


	if (add_uevent_var(env, "OF_TYPE=%s", ofdev->node->type))
	if (add_uevent_var(env, "OF_TYPE=%s", ofdev->dev.of_node->type))
		return -ENOMEM;
		return -ENOMEM;


        /* Since the compatible field can contain pretty much anything
        /* Since the compatible field can contain pretty much anything
         * it's not really legal to split it out with commas. We split it
         * it's not really legal to split it out with commas. We split it
         * up using a number of environment variables instead. */
         * up using a number of environment variables instead. */


	compat = of_get_property(ofdev->node, "compatible", &cplen);
	compat = of_get_property(ofdev->dev.of_node, "compatible", &cplen);
	while (compat && *compat && cplen > 0) {
	while (compat && *compat && cplen > 0) {
		if (add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat))
		if (add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat))
			return -ENOMEM;
			return -ENOMEM;
Loading