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

Commit e8a51e1b authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Greg Kroah-Hartman
Browse files

device: Add dev_of_node() accessor



Suggested by Arnd Bergmann, this gives a practical accessor for
the of_node field of struct device while instructing the compiler
that it will be NULL if CONFIG_OF is not set.

Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ef518cc8
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -916,6 +916,13 @@ static inline void device_lock_assert(struct device *dev)
	lockdep_assert_held(&dev->mutex);
}

static inline struct device_node *dev_of_node(struct device *dev)
{
	if (!IS_ENABLED(CONFIG_OF))
		return NULL;
	return dev->of_node;
}

void driver_init(void);

/*