@@ -26,14 +26,13 @@
#include <linux/ctype.h>
#include <linux/list.h>
#include <linux/mutex.h>
+#include <linux/of.h>
#include <drm/drm_atomic.h>
#include <drm/drm_encoder.h>
#include <drm/drm_mode_object.h>
#include <drm/drm_modes.h>
-struct device_node;
-
struct drm_bridge;
struct drm_bridge_timings;
struct drm_connector;
@@ -790,6 +789,13 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
struct drm_bridge *previous,
enum drm_bridge_attach_flags flags);
+static inline void
+drm_bridge_set_node(struct drm_bridge *bridge, struct fwnode_handle *fwnode)
+{
+ bridge->fwnode = fwnode;
+ bridge->of_node = to_of_node(fwnode);
+}
+
#ifdef CONFIG_OF
struct drm_bridge *of_drm_find_bridge(struct device_node *np);
#else
The newly added helper is drm_bridge_set_node(), the reason behind of this introduction is that the name 'of_node' itself has a smell of DT dependent, when we are going to make drivers truly DT independent, we have to has a way to hide it from its user referencing and/or dereferencing. Please note that the introduction of drm_bridge_set_node() is actually trying to follow the convention used by driver core, see device_set_node() for reference. While at it, include the of.h header as the drm_bridge struct always has the of_node as its member. Therefore drop the forward declaration. Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev> --- include/drm/drm_bridge.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)