From: Sui Jingfeng <sui.jingfeng@linux.dev>
To: Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Sui Jingfeng <sui.jingfeng@linux.dev>
Subject: [PATCH v6 03/10] drm/bridge: Implement of_drm_find_bridge() on the top of drm_bridge_find_by_fwnode()
Date: Mon, 27 May 2024 04:21:08 +0800 [thread overview]
Message-ID: <20240526202115.129049-4-sui.jingfeng@linux.dev> (raw)
In-Reply-To: <20240526202115.129049-1-sui.jingfeng@linux.dev>
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@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
next prev parent reply other threads:[~2024-05-26 20:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-26 20:21 [PATCH v6 00/10] drm/bridge: Allow using fwnode API to get the next bridge Sui Jingfeng
2024-05-26 20:21 ` [PATCH v6 01/10] drm/bridge: Allow using fwnode APIs " Sui Jingfeng
2024-05-26 20:21 ` [PATCH v6 02/10] drm/bridge: Set firmware node of drm_bridge instances automatically Sui Jingfeng
2024-05-26 21:19 ` Dmitry Baryshkov
2024-05-27 2:01 ` Sui Jingfeng
2024-05-26 23:33 ` kernel test robot
2024-05-27 2:06 ` Sui Jingfeng
2024-05-26 20:21 ` Sui Jingfeng [this message]
2024-05-26 20:21 ` [PATCH v6 04/10] drm/bridge: simple-bridge: Use fwnode APIs to acquire device properties Sui Jingfeng
2024-05-26 20:21 ` [PATCH v6 05/10] drm/bridge: display-connector: " Sui Jingfeng
2024-05-26 20:21 ` [PATCH v6 06/10] drm/bridge: sii902x: Switch to use " Sui Jingfeng
2024-05-26 20:21 ` [PATCH v6 07/10] drm-bridge: it66121: Use " Sui Jingfeng
2024-05-26 20:21 ` [PATCH v6 08/10] drm/bridge: tfp410: " Sui Jingfeng
2024-05-26 20:21 ` [PATCH v6 09/10] drm/bridge: sii9234: Use fwnode APIs to abstract DT dependent API away Sui Jingfeng
2024-05-26 20:21 ` [PATCH v6 10/10] drm/bridge: ch7033: Switch to use fwnode based APIs Sui Jingfeng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240526202115.129049-4-sui.jingfeng@linux.dev \
--to=sui.jingfeng@linux.dev \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rfoss@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox