From: Louis Chauvet <louis.chauvet@bootlin.com>
To: Luca Ceresoli <luca.ceresoli@bootlin.com>,
Ernest Van Hoecke <ernestvanhoecke@gmail.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
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>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>
Cc: Hui Pu <Hui.Pu@gehealthcare.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
dri-devel@lists.freedesktop.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] drm/imx: parallel-display: convert to devm_drm_bridge_alloc() API
Date: Thu, 30 Oct 2025 15:18:47 +0100 [thread overview]
Message-ID: <ddcf8a8b-84a5-4895-b890-4f236c8094f2@bootlin.com> (raw)
In-Reply-To: <20251014-drm-bridge-alloc-imx-ipuv3-v1-1-a1bb1dcbff50@bootlin.com>
Le 14/10/2025 à 13:30, Luca Ceresoli a écrit :
> This is the new API for allocating DRM bridges.
>
> This conversion was missed during the initial conversion of all bridges to
> the new API. Thus all kernels with commit 94d50c1a2ca3 ("drm/bridge:
> get/put the bridge reference in drm_bridge_attach/detach()") and using this
> driver now warn due to drm_bridge_attach() incrementing the refcount, which
> is not initialized without using devm_drm_bridge_alloc() for allocation.
>
> To make the conversion simple and straightforward without messing up with
> the drmm_simple_encoder_alloc(), move the struct drm_bridge from struct
> imx_parallel_display_encoder to struct imx_parallel_display.
>
> Also remove the 'struct imx_parallel_display *pd' from struct
> imx_parallel_display_encoder, not needed anymore.
>
> Fixes: 94d50c1a2ca3 ("drm/bridge: get/put the bridge reference in drm_bridge_attach/detach()")
> Reported-by: Ernest Van Hoecke <ernestvanhoecke@gmail.com>
> Closes: https://lore.kernel.org/all/hlf4wdopapxnh4rekl5s3kvoi6egaga3lrjfbx6r223ar3txri@3ik53xw5idyh/
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
> ---
> drivers/gpu/drm/imx/ipuv3/parallel-display.c | 16 +++++++---------
> 1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/imx/ipuv3/parallel-display.c b/drivers/gpu/drm/imx/ipuv3/parallel-display.c
> index 6d8325c766979aa3ba98970f00806e99c139d3c3..3d0de9c6e925978b7532b6d13caf6909cc343dd7 100644
> --- a/drivers/gpu/drm/imx/ipuv3/parallel-display.c
> +++ b/drivers/gpu/drm/imx/ipuv3/parallel-display.c
> @@ -25,19 +25,18 @@
>
> struct imx_parallel_display_encoder {
> struct drm_encoder encoder;
> - struct drm_bridge bridge;
> - struct imx_parallel_display *pd;
> };
>
> struct imx_parallel_display {
> struct device *dev;
> u32 bus_format;
> struct drm_bridge *next_bridge;
> + struct drm_bridge bridge;
> };
>
> static inline struct imx_parallel_display *bridge_to_imxpd(struct drm_bridge *b)
> {
> - return container_of(b, struct imx_parallel_display_encoder, bridge)->pd;
> + return container_of(b, struct imx_parallel_display, bridge);
> }
>
> static const u32 imx_pd_bus_fmts[] = {
> @@ -195,15 +194,13 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
> if (IS_ERR(imxpd_encoder))
> return PTR_ERR(imxpd_encoder);
>
> - imxpd_encoder->pd = imxpd;
> encoder = &imxpd_encoder->encoder;
> - bridge = &imxpd_encoder->bridge;
> + bridge = &imxpd->bridge;
>
> ret = imx_drm_encoder_parse_of(drm, encoder, imxpd->dev->of_node);
> if (ret)
> return ret;
>
> - bridge->funcs = &imx_pd_bridge_funcs;
> drm_bridge_attach(encoder, bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR);
>
> connector = drm_bridge_connector_init(drm, encoder);
> @@ -228,9 +225,10 @@ static int imx_pd_probe(struct platform_device *pdev)
> u32 bus_format = 0;
> const char *fmt;
>
> - imxpd = devm_kzalloc(dev, sizeof(*imxpd), GFP_KERNEL);
> - if (!imxpd)
> - return -ENOMEM;
> + imxpd = devm_drm_bridge_alloc(dev, struct imx_parallel_display, bridge,
> + &imx_pd_bridge_funcs);
> + if (IS_ERR(imxpd))
> + return PTR_ERR(imxpd);
>
> /* port@1 is the output port */
> imxpd->next_bridge = devm_drm_of_get_bridge(dev, np, 1, 0);
>
--
--
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2025-10-30 14:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 11:30 [PATCH 0/2] drm/imx: parallel-display: fix drm/panel/panel-simple v6.17 WARNING regression Luca Ceresoli
2025-10-14 11:30 ` [PATCH 1/2] drm/imx: parallel-display: convert to devm_drm_bridge_alloc() API Luca Ceresoli
2025-10-14 11:57 ` Ernest Van Hoecke
2025-10-30 14:18 ` Louis Chauvet [this message]
2025-10-14 11:30 ` [PATCH 2/2] drm/imx: parallel-display: add the bridge before attaching it Luca Ceresoli
2025-10-30 14:20 ` Louis Chauvet
2025-10-30 15:59 ` [PATCH 0/2] drm/imx: parallel-display: fix drm/panel/panel-simple v6.17 WARNING regression Philipp Zabel
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=ddcf8a8b-84a5-4895-b890-4f236c8094f2@bootlin.com \
--to=louis.chauvet@bootlin.com \
--cc=Hui.Pu@gehealthcare.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ernestvanhoecke@gmail.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=simona@ffwll.ch \
--cc=thomas.petazzoni@bootlin.com \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®