mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Neil Armstrong <neil.armstrong@linaro.org>
To: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>,
	Jessica Zhang <jesszhan0024@gmail.com>,
	dri-devel@lists.freedesktop.org
Cc: 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>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v3 4/4] drm/panel: novatek-nt36536: reject enable when prepare failed
Date: Thu, 3 Dec 2026 11:20:34 +0100	[thread overview]
Message-ID: <9dd703d1-af65-444f-adc1-e07fc281a5d7@linaro.org> (raw)
In-Reply-To: <20261202090911.3987891-5-xiaqinghuan@mail.ustc.edu.cn>

On 12/2/26 10:09, Qianhui Xu wrote:
> drm_panel_prepare() cannot report a failure to its caller, so the enable
> part of the bridge chain still runs with panel->prepared unset. Provide
> an enable() callback that returns -EIO in that case, so the panel is not
> marked as enabled and the backlight stays off.
> 
> Checking this in drm_panel_enable() instead was considered: the state
> lives in the core, but drm_panel_enable() is void and there is no way to
> tell "prepare was never called" from "prepare failed". Panels that never
> implement prepare(), or whose bridge ops skip drm_panel_prepare(), would
> then be skipped as well, so the guard stays local to the driver that can
> actually fail.
> 
> Fixes: 75a5dbd1f4f7 ("drm/panel: Add Novatek NT36536 panel driver")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
> ---
>   drivers/gpu/drm/panel/panel-novatek-nt36536.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36536.c b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> index e372e346d8b77..d38ddf271b0cd 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> @@ -123,6 +123,12 @@ static int novatek_prepare(struct drm_panel *panel)
>   	return ret;
>   }
>   
> +static int novatek_enable(struct drm_panel *panel)
> +{
> +	/* The bridge enable chain can continue after a failed prepare callback. */
> +	return panel->prepared ? 0 : -EIO;
> +}
> +
>   static int novatek_off(struct mipi_dsi_multi_context *dsi_ctx)
>   {
>   	mipi_dsi_dcs_set_display_off_multi(dsi_ctx);
> @@ -186,6 +192,7 @@ static int novatek_get_modes(struct drm_panel *panel,
>   
>   static const struct drm_panel_funcs novatek_panel_funcs = {
>   	.prepare = novatek_prepare,
> +	.enable = novatek_enable,
>   	.unprepare = novatek_unprepare,
>   	.get_modes = novatek_get_modes,
>   };

This is a hack, fix it in the core instead

Neil

  reply	other threads:[~2026-12-03 10:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  9:09 [PATCH v3 0/4] drm/panel: novatek-nt36536: add 40/24 Hz modes, fix lifecycle Qianhui Xu
2026-12-02  9:09 ` [PATCH v3 1/4] drm/panel: novatek-nt36536: add 40Hz and 24Hz modes for CSOT PP8807HB1-1 Qianhui Xu
2026-12-02  9:09 ` [PATCH v3 2/4] drm/panel: novatek-nt36536: finish setup before attaching DSI devices Qianhui Xu
2026-12-03 10:18   ` Neil Armstrong
2026-12-02  9:09 ` [PATCH v3 3/4] drm/panel: novatek-nt36536: power off on any prepare failure Qianhui Xu
2026-12-03 10:19   ` Neil Armstrong
2026-12-02  9:09 ` [PATCH v3 4/4] drm/panel: novatek-nt36536: reject enable when prepare failed Qianhui Xu
2026-12-03 10:20   ` Neil Armstrong [this message]
2026-12-03 14:37     ` Qianhui Xu

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=9dd703d1-af65-444f-adc1-e07fc281a5d7@linaro.org \
    --to=neil.armstrong@linaro.org \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jesszhan0024@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=stable@vger.kernel.org \
    --cc=tzimmermann@suse.de \
    --cc=xiaqinghuan@mail.ustc.edu.cn \
    /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®