From: "Luca Ceresoli" <luca.ceresoli@bootlin.com>
To: "Li Youhong" <dayou5941@163.com>, <inki.dae@samsung.com>,
<jagan@amarulasolutions.com>, <m.szyprowski@samsung.com>
Cc: <andrzej.hajda@intel.com>, <neil.armstrong@linaro.org>,
<rfoss@kernel.org>, <Laurent.pinchart@ideasonboard.com>,
<jonas@kwiboo.se>, <jernej.skrabec@gmail.com>,
<luca.ceresoli@bootlin.com>, <dri-devel@lists.freedesktop.org>,
<linux-kernel@vger.kernel.org>,
"Li Youhong" <liyouhong@kylinos.cn>
Subject: Re: [PATCH v2] drm/bridge: samsung-dsim: fix TE GPIO lifetime for host attach
Date: Fri, 04 Sep 2026 16:47:51 +0200 [thread overview]
Message-ID: <DL6M4Q7I9197.2TQXYZ3CANZHI@bootlin.com> (raw)
In-Reply-To: <20260904014958.1572918-1-dayou5941@163.com>
Hello Li,
On Fri Sep 4, 2026 at 3:49 AM CEST, Li Youhong wrote:
> From: Li Youhong <liyouhong@kylinos.cn>
>
> When the Exynos DSI driver was generalized into samsung-dsim, the TE
> GPIO acquisition was switched from gpiod_get_optional() to
> devm_gpiod_get_optional() while keeping the matching gpiod_put() calls.
> That combination is wrong for a managed descriptor.
>
> However, dropping the puts and keeping the managed get is also wrong:
> samsung_dsim_register_te_irq() runs from the DSI host attach callback,
> and host detach/reattach can happen without destroying the device that
> owns the managed action. A second attach would then request the GPIO
> again without having released it.
>
> Switch back to a non-managed gpiod_get_optional() and keep the explicit
> gpiod_put() on the request_irq() error path and in
> samsung_dsim_unregister_te_irq().
>
> Fixes: e7447128ca4a ("drm: bridge: Generalize Exynos-DSI driver into a Samsung DSIM bridge")
> Suggested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Signed-off-by: Li Youhong <liyouhong@kylinos.cn>
> ---
> v2:
> - Prefer non-devm gpiod_get_optional() and keep gpiod_put(), because TE
> GPIO is acquired in host attach and must be released on host detach
>
> drivers/gpu/drm/bridge/samsung-dsim.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> --- a/drivers/gpu/drm/bridge/samsung-dsim.c
> +++ b/drivers/gpu/drm/bridge/samsung-dsim.c
> @@ -1862,7 +1862,8 @@ static int samsung_dsim_register_te_irq(struct samsung_dsim *dsi, struct device
> int te_gpio_irq;
> int ret;
>
> - dsi->te_gpio = devm_gpiod_get_optional(dev, "te", GPIOD_IN);
> + /* Released on host detach; do not use the managed get. */
> + dsi->te_gpio = gpiod_get_optional(dev, "te", GPIOD_IN);
The comment is not really needed, this should be obvious by reading the
code. No need to resend just for that, I can remove it while applying.
Other than that it's OK:
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
prev parent reply other threads:[~2026-09-04 14:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 1:49 [PATCH v2] drm/bridge: samsung-dsim: fix TE GPIO lifetime for host attach Li Youhong
2026-09-04 2:00 ` sashiko-bot
2026-09-04 14:47 ` Luca Ceresoli [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=DL6M4Q7I9197.2TQXYZ3CANZHI@bootlin.com \
--to=luca.ceresoli@bootlin.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=andrzej.hajda@intel.com \
--cc=dayou5941@163.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=inki.dae@samsung.com \
--cc=jagan@amarulasolutions.com \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=linux-kernel@vger.kernel.org \
--cc=liyouhong@kylinos.cn \
--cc=m.szyprowski@samsung.com \
--cc=neil.armstrong@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.