[PATCH v6 03/10] drm/bridge: Implement of_drm_find_bridge() on the top of drm_bridge_find_by_fwnode()
Sui Jingfeng
sui.jingfeng at linux.dev
Sun May 26 20:21:08 UTC 2024
Before applying this patch, people may worry about the OF and non-OF API
will have a risk to diverge. Eliminate the risk by reimplement the
of_drm_find_bridge() on the top of drm_bridge_find_by_fwnode(). As for now
the fundamental searching method is unique.
Signed-off-by: Sui Jingfeng <sui.jingfeng at linux.dev>
---
drivers/gpu/drm/drm_bridge.c | 29 -----------------------------
include/drm/drm_bridge.h | 14 +++++---------
2 files changed, 5 insertions(+), 38 deletions(-)
diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 7759ca066db4..4c5584922d3c 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -1346,35 +1346,6 @@ void drm_bridge_hpd_notify(struct drm_bridge *bridge,
}
EXPORT_SYMBOL_GPL(drm_bridge_hpd_notify);
-#ifdef CONFIG_OF
-/**
- * of_drm_find_bridge - find the bridge corresponding to the device node in
- * the global bridge list
- *
- * @np: device node
- *
- * RETURNS:
- * drm_bridge control struct on success, NULL on failure
- */
-struct drm_bridge *of_drm_find_bridge(struct device_node *np)
-{
- struct drm_bridge *bridge;
-
- mutex_lock(&bridge_lock);
-
- list_for_each_entry(bridge, &bridge_list, list) {
- if (bridge->of_node == np) {
- mutex_unlock(&bridge_lock);
- return bridge;
- }
- }
-
- mutex_unlock(&bridge_lock);
- return NULL;
-}
-EXPORT_SYMBOL(of_drm_find_bridge);
-#endif
-
/**
* drm_bridge_find_by_fwnode - Find the bridge corresponding to the fwnode
*
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index 7b592cf30340..8d743dfe782c 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -791,21 +791,17 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
struct drm_bridge *previous,
enum drm_bridge_attach_flags flags);
-#ifdef CONFIG_OF
-struct drm_bridge *of_drm_find_bridge(struct device_node *np);
-#else
-static inline struct drm_bridge *of_drm_find_bridge(struct device_node *np)
-{
- return NULL;
-}
-#endif
-
struct drm_bridge *
drm_bridge_find_by_fwnode(struct fwnode_handle *fwnode);
struct drm_bridge *
drm_bridge_find_next_bridge_by_fwnode(struct fwnode_handle *fwnode, u32 port);
+static inline struct drm_bridge *of_drm_find_bridge(struct device_node *np)
+{
+ return drm_bridge_find_by_fwnode(of_fwnode_handle(np));
+}
+
/**
* drm_bridge_get_next_bridge() - Get the next bridge in the chain
* @bridge: bridge object
--
2.34.1
More information about the dri-devel
mailing list