[PATCH 6/6] drm/meson: Open-code drm_simple_encoder_init() in encoder_dsi

sashiko-bot at kernel.org sashiko-bot at kernel.org
Sun May 31 01:25:46 PDT 2026


Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The encoder atomic enable callback uses a sleeping polling function, which violates DRM atomic context rules.
--

commit 7905b259e0fff97b6803c2360bf97ff0dc74dae2
Author: Naman Arora <namanarora029 at gmail.com>

drm/meson: Open-code drm_simple_encoder_init() in encoder_dsi

The helper drm_simple_encoder_init() is a thin wrapper around
drm_encoder_init() with a simple destroy-only encoder funcs struct.
Remove the dependency on drm_simple_kms_helper by open-coding the
encoder initialization directly in the driver.

> diff --git a/drivers/gpu/drm/meson/meson_encoder_dsi.c b/drivers/gpu/drm/meson/meson_encoder_dsi.c
> index c1f4685073bbc..bbb5b65cb0d94 100644
> --- a/drivers/gpu/drm/meson/meson_encoder_dsi.c
> +++ b/drivers/gpu/drm/meson/meson_encoder_dsi.c

[ ... ]

> @@ -99,6 +98,10 @@ static const struct drm_bridge_funcs meson_encoder_dsi_bridge_funcs = {
>  	.atomic_reset = drm_atomic_helper_bridge_reset,
>  };

[Severity: High]
This is a pre-existing issue, but does this bridge configuration cause a
sleep in atomic context?

Looking at the atomic_enable path for this bridge in
drivers/gpu/drm/meson/meson_encoder_dsi.c:

meson_encoder_dsi_atomic_enable()
  meson_encl_load_gamma()
    meson_encl_set_gamma_table()

In drivers/gpu/drm/meson/meson_venc.c, meson_encl_set_gamma_table() calls:
readl_relaxed_poll_timeout(..., 10, 10000)

The readl_relaxed_poll_timeout macro expands to usleep_range when a non-zero
delay is provided (like 10 here), which will cause the thread to sleep.

Since bridge atomic_enable callbacks execute in an atomic context where
sleeping is strictly forbidden, could this cause kernel warnings (might_sleep)
or potential deadlocks if locks are held?

Should this code path use a non-sleeping polling mechanism such as
readl_relaxed_poll_timeout_atomic instead?

> +static const struct drm_encoder_funcs meson_encoder_dsi_drm_encoder_funcs = {
> +	.destroy = drm_encoder_cleanup,
> +};
> +
>  int meson_encoder_dsi_probe(struct meson_drm *priv)
>  {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260531074627.8936-1-namanarora029@gmail.com?part=6



More information about the linux-amlogic mailing list