From: Laurent Pinchart <laurent.pinchart@ideasonboard•com>
To: Luca Ceresoli <luca.ceresoli@bootlin•com>
Cc: Andrzej Hajda <andrzej.hajda@intel•com>,
Neil Armstrong <neil.armstrong@linaro•org>,
Robert Foss <rfoss@kernel•org>, Jonas Karlman <jonas@kwiboo•se>,
Jernej Skrabec <jernej.skrabec@gmail•com>,
Maarten Lankhorst <maarten.lankhorst@linux•intel.com>,
Maxime Ripard <mripard@kernel•org>,
Thomas Zimmermann <tzimmermann@suse•de>,
David Airlie <airlied@gmail•com>, Simona Vetter <simona@ffwll•ch>,
Rob Clark <robin.clark@oss•qualcomm.com>,
Dmitry Baryshkov <lumag@kernel•org>,
Abhinav Kumar <abhinav.kumar@linux•dev>,
Jessica Zhang <jesszhan0024@gmail•com>,
Sean Paul <sean@poorly•run>,
Marijn Suijten <marijn.suijten@somainline•org>,
Sumit Semwal <sumit.semwal@linaro•org>,
John Stultz <jstultz@google•com>,
Tomi Valkeinen <tomi.valkeinen@ideasonboard•com>,
Michal Simek <michal.simek@amd•com>,
Hui Pu <Hui.Pu@gehealthcare•com>,
Ian Ray <ian.ray@gehealthcare•com>,
Thomas Petazzoni <thomas.petazzoni@bootlin•com>,
dri-devel@lists•freedesktop.org, linux-kernel@vger•kernel.org,
linux-arm-msm@vger•kernel.org, freedreno@lists•freedesktop.org,
linux-arm-kernel@lists•infradead.org,
Dmitry Baryshkov <dmitry.baryshkov@oss•qualcomm.com>
Subject: Re: [PATCH v4 11/11] drm: of: forbid bridge-only calls to drm_of_find_panel_or_bridge()
Date: Mon, 4 May 2026 18:27:37 +0300 [thread overview]
Message-ID: <20260504152737.GD1455860@killaraus.ideasonboard.com> (raw)
In-Reply-To: <20260504-drm-bridge-alloc-getput-panel_or_bridge-v4-11-b578c3daaf10@bootlin.com>
On Mon, May 04, 2026 at 12:45:14PM +0200, Luca Ceresoli wrote:
> Up to now drm_of_find_panel_or_bridge() can be called with a bridge pointer
> only, a panel pointer only, or both a bridge and a panel pointers. The
> logic to handle all the three cases is somewhat complex to read however.
>
> Now all bridge-only callers have been converted to
> of_drm_get_bridge_by_endpoint(), which is simpler and handles bridge
> refcounting. So forbid new bridge-only users by mandating a non-NULL panel
> pointer in the docs and in the sanity checks along with a warning.
>
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss•qualcomm.com>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin•com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard•com>
> ---
> drivers/gpu/drm/drm_of.c | 26 ++++++++++++--------------
> 1 file changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
> index ef6b09316963..d03ada82eac9 100644
> --- a/drivers/gpu/drm/drm_of.c
> +++ b/drivers/gpu/drm/drm_of.c
> @@ -225,15 +225,15 @@ EXPORT_SYMBOL_GPL(drm_of_encoder_active_endpoint);
> * @np: device tree node containing encoder output ports
> * @port: port in the device tree node
> * @endpoint: endpoint in the device tree node
> - * @panel: pointer to hold returned drm_panel
> + * @panel: pointer to hold returned drm_panel, must not be NULL
> * @bridge: pointer to hold returned drm_bridge
> *
> * Given a DT node's port and endpoint number, find the connected node and
> - * return either the associated struct drm_panel or drm_bridge device. Either
> - * @panel or @bridge must not be NULL.
> + * return either the associated struct drm_panel or drm_bridge device.
> *
> * This function is deprecated and should not be used in new drivers. Use
> - * devm_drm_of_get_bridge() instead.
> + * of_drm_get_bridge_by_endpoint() instead when not looking for a panel, or
> + * devm_drm_of_get_bridge() otherwise.
> *
> * Returns zero if successful, or one of the standard error codes if it fails.
> */
> @@ -245,10 +245,10 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
> int ret = -EPROBE_DEFER;
> struct device_node *remote;
>
> - if (!panel && !bridge)
> + if (WARN_ON(!panel))
> return -EINVAL;
> - if (panel)
> - *panel = NULL;
> +
> + *panel = NULL;
>
> /*
> * of_graph_get_remote_node() produces a noisy error message if port
> @@ -263,13 +263,11 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
> if (!remote)
> return -ENODEV;
>
> - if (panel) {
> - *panel = of_drm_find_panel(remote);
> - if (!IS_ERR(*panel))
> - ret = 0;
> - else
> - *panel = NULL;
> - }
> + *panel = of_drm_find_panel(remote);
> + if (!IS_ERR(*panel))
> + ret = 0;
> + else
> + *panel = NULL;
>
> if (bridge) {
> if (ret) {
>
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2026-05-04 15:27 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-04 10:45 [PATCH v4 00/11] drm/bridge: handle refcounting for bridge-only callers of drm_of_find_panel_or_bridge() Luca Ceresoli
2026-05-04 10:45 ` [PATCH v4 01/11] drm/bridge: drm_bridge_get/put(): ignore ERR_PTR Luca Ceresoli
2026-05-04 13:53 ` Laurent Pinchart
2026-05-04 14:13 ` Luca Ceresoli
2026-05-04 10:45 ` [PATCH v4 02/11] drm/bridge: add of_drm_get_bridge_by_endpoint() Luca Ceresoli
2026-05-04 14:55 ` Laurent Pinchart
2026-05-04 15:03 ` Luca Ceresoli
2026-05-04 10:45 ` [PATCH v4 03/11] drm/msm/hdmi: switch to of_drm_get_bridge_by_endpoint() Luca Ceresoli
2026-05-04 10:45 ` [PATCH v4 04/11] drm/hisilicon/kirin: " Luca Ceresoli
2026-05-04 10:45 ` [PATCH v4 05/11] drm/bridge: chrontel-ch7033: " Luca Ceresoli
2026-05-04 10:45 ` [PATCH v4 06/11] drm/bridge: lontium-lt9611uxc: " Luca Ceresoli
2026-05-04 10:45 ` [PATCH v4 07/11] drm/bridge: lt9611: " Luca Ceresoli
2026-05-04 10:45 ` [PATCH v4 08/11] drm/bridge: adv7511: " Luca Ceresoli
2026-05-04 15:22 ` Laurent Pinchart
2026-05-04 10:45 ` [PATCH v4 09/11] drm/bridge: lt8713sx: " Luca Ceresoli
2026-05-04 10:45 ` [PATCH v4 10/11] drm: zynqmp_dp: " Luca Ceresoli
2026-05-04 15:24 ` Laurent Pinchart
2026-05-05 14:05 ` Luca Ceresoli
2026-05-04 10:45 ` [PATCH v4 11/11] drm: of: forbid bridge-only calls to drm_of_find_panel_or_bridge() Luca Ceresoli
2026-05-04 15:27 ` Laurent Pinchart [this message]
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=20260504152737.GD1455860@killaraus.ideasonboard.com \
--to=laurent.pinchart@ideasonboard$(echo .)com \
--cc=Hui.Pu@gehealthcare$(echo .)com \
--cc=abhinav.kumar@linux$(echo .)dev \
--cc=airlied@gmail$(echo .)com \
--cc=andrzej.hajda@intel$(echo .)com \
--cc=dmitry.baryshkov@oss$(echo .)qualcomm.com \
--cc=dri-devel@lists$(echo .)freedesktop.org \
--cc=freedreno@lists$(echo .)freedesktop.org \
--cc=ian.ray@gehealthcare$(echo .)com \
--cc=jernej.skrabec@gmail$(echo .)com \
--cc=jesszhan0024@gmail$(echo .)com \
--cc=jonas@kwiboo$(echo .)se \
--cc=jstultz@google$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-arm-msm@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=luca.ceresoli@bootlin$(echo .)com \
--cc=lumag@kernel$(echo .)org \
--cc=maarten.lankhorst@linux$(echo .)intel.com \
--cc=marijn.suijten@somainline$(echo .)org \
--cc=michal.simek@amd$(echo .)com \
--cc=mripard@kernel$(echo .)org \
--cc=neil.armstrong@linaro$(echo .)org \
--cc=rfoss@kernel$(echo .)org \
--cc=robin.clark@oss$(echo .)qualcomm.com \
--cc=sean@poorly$(echo .)run \
--cc=simona@ffwll$(echo .)ch \
--cc=sumit.semwal@linaro$(echo .)org \
--cc=thomas.petazzoni@bootlin$(echo .)com \
--cc=tomi.valkeinen@ideasonboard$(echo .)com \
--cc=tzimmermann@suse$(echo .)de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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