* [PATCH] drm/tilcdc: Fix removal actions in case of failed probe
@ 2025-10-14 14:32 Kory Maincent
2025-10-14 15:36 ` Maxime Ripard
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Kory Maincent @ 2025-10-14 14:32 UTC (permalink / raw)
To: Tomi Valkeinen, Douglas Anderson, Maxime Ripard, dri-devel, linux-kernel
Cc: Bajjuri Praneeth, Louis Chauvet, Kory Maincent (TI.com),
thomas.petazzoni, Jyri Sarha, Maarten Lankhorst,
Thomas Zimmermann, David Airlie, Simona Vetter
From: "Kory Maincent (TI.com)" <kory.maincent@bootlin.com>
The drm_kms_helper_poll_fini() and drm_atomic_helper_shutdown() helpers
should only be called when the device has been successfully registered.
Currently, these functions are called unconditionally in tilcdc_fini(),
which causes warnings during probe deferral scenarios.
[ 7.972317] WARNING: CPU: 0 PID: 23 at drivers/gpu/drm/drm_atomic_state_helper.c:175 drm_atomic_helper_crtc_duplicate_state+0x60/0x68
...
[ 8.005820] drm_atomic_helper_crtc_duplicate_state from drm_atomic_get_crtc_state+0x68/0x108
[ 8.005858] drm_atomic_get_crtc_state from drm_atomic_helper_disable_all+0x90/0x1c8
[ 8.005885] drm_atomic_helper_disable_all from drm_atomic_helper_shutdown+0x90/0x144
[ 8.005911] drm_atomic_helper_shutdown from tilcdc_fini+0x68/0xf8 [tilcdc]
[ 8.005957] tilcdc_fini [tilcdc] from tilcdc_pdev_probe+0xb0/0x6d4 [tilcdc]
Fix this by moving both drm_kms_helper_poll_fini() and
drm_atomic_helper_shutdown() inside the priv->is_registered conditional
block, ensuring they only execute after successful device registration.
Fixes: 3c4babae3c4a ("drm: Call drm_atomic_helper_shutdown() at shutdown/remove time for misc drivers")
Signed-off-by: Kory Maincent (TI.com) <kory.maincent@bootlin.com>
---
drivers/gpu/drm/tilcdc/tilcdc_drv.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 7caec4d38ddf..2031267a3490 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -172,11 +172,11 @@ static void tilcdc_fini(struct drm_device *dev)
if (priv->crtc)
tilcdc_crtc_shutdown(priv->crtc);
- if (priv->is_registered)
+ if (priv->is_registered) {
drm_dev_unregister(dev);
-
- drm_kms_helper_poll_fini(dev);
- drm_atomic_helper_shutdown(dev);
+ drm_kms_helper_poll_fini(dev);
+ drm_atomic_helper_shutdown(dev);
+ }
tilcdc_irq_uninstall(dev);
drm_mode_config_cleanup(dev);
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/tilcdc: Fix removal actions in case of failed probe
2025-10-14 14:32 [PATCH] drm/tilcdc: Fix removal actions in case of failed probe Kory Maincent
@ 2025-10-14 15:36 ` Maxime Ripard
2025-10-14 16:21 ` Kory Maincent
2025-10-15 5:00 ` Swamil Jain
2025-10-22 7:05 ` Tomi Valkeinen
2 siblings, 1 reply; 9+ messages in thread
From: Maxime Ripard @ 2025-10-14 15:36 UTC (permalink / raw)
To: Kory Maincent
Cc: Tomi Valkeinen, Douglas Anderson, dri-devel, linux-kernel,
Bajjuri Praneeth, Louis Chauvet, thomas.petazzoni, Jyri Sarha,
Maarten Lankhorst, Thomas Zimmermann, David Airlie,
Simona Vetter
[-- Attachment #1: Type: text/plain, Size: 2577 bytes --]
On Tue, Oct 14, 2025 at 04:32:28PM +0200, Kory Maincent wrote:
> From: "Kory Maincent (TI.com)" <kory.maincent@bootlin.com>
>
> The drm_kms_helper_poll_fini() and drm_atomic_helper_shutdown() helpers
> should only be called when the device has been successfully registered.
> Currently, these functions are called unconditionally in tilcdc_fini(),
> which causes warnings during probe deferral scenarios.
>
> [ 7.972317] WARNING: CPU: 0 PID: 23 at drivers/gpu/drm/drm_atomic_state_helper.c:175 drm_atomic_helper_crtc_duplicate_state+0x60/0x68
> ...
> [ 8.005820] drm_atomic_helper_crtc_duplicate_state from drm_atomic_get_crtc_state+0x68/0x108
> [ 8.005858] drm_atomic_get_crtc_state from drm_atomic_helper_disable_all+0x90/0x1c8
> [ 8.005885] drm_atomic_helper_disable_all from drm_atomic_helper_shutdown+0x90/0x144
> [ 8.005911] drm_atomic_helper_shutdown from tilcdc_fini+0x68/0xf8 [tilcdc]
> [ 8.005957] tilcdc_fini [tilcdc] from tilcdc_pdev_probe+0xb0/0x6d4 [tilcdc]
>
> Fix this by moving both drm_kms_helper_poll_fini() and
> drm_atomic_helper_shutdown() inside the priv->is_registered conditional
> block, ensuring they only execute after successful device registration.
>
> Fixes: 3c4babae3c4a ("drm: Call drm_atomic_helper_shutdown() at shutdown/remove time for misc drivers")
> Signed-off-by: Kory Maincent (TI.com) <kory.maincent@bootlin.com>
> ---
> drivers/gpu/drm/tilcdc/tilcdc_drv.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> index 7caec4d38ddf..2031267a3490 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> @@ -172,11 +172,11 @@ static void tilcdc_fini(struct drm_device *dev)
> if (priv->crtc)
> tilcdc_crtc_shutdown(priv->crtc);
>
> - if (priv->is_registered)
> + if (priv->is_registered) {
> drm_dev_unregister(dev);
> -
> - drm_kms_helper_poll_fini(dev);
> - drm_atomic_helper_shutdown(dev);
> + drm_kms_helper_poll_fini(dev);
> + drm_atomic_helper_shutdown(dev);
> + }
> tilcdc_irq_uninstall(dev);
> drm_mode_config_cleanup(dev);
I don't think that's the right fix. tilcdc_fini is pretty complex
because it gets called from multiple locations with various level of
initialisation.
This is done because tilcdc_init is using a bunch of deprecated
functions with better alternatives now, and those would make the job of
tilcdc_fini much easier.
That's what we should be focusing on.
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/tilcdc: Fix removal actions in case of failed probe
2025-10-14 15:36 ` Maxime Ripard
@ 2025-10-14 16:21 ` Kory Maincent
2025-10-21 13:14 ` Kory Maincent
0 siblings, 1 reply; 9+ messages in thread
From: Kory Maincent @ 2025-10-14 16:21 UTC (permalink / raw)
To: Maxime Ripard
Cc: Tomi Valkeinen, Douglas Anderson, dri-devel, linux-kernel,
Bajjuri Praneeth, Louis Chauvet, thomas.petazzoni, Jyri Sarha,
Maarten Lankhorst, Thomas Zimmermann, David Airlie,
Simona Vetter
Hello Maxime,
On Tue, 14 Oct 2025 17:36:47 +0200
Maxime Ripard <mripard@kernel.org> wrote:
> On Tue, Oct 14, 2025 at 04:32:28PM +0200, Kory Maincent wrote:
> > From: "Kory Maincent (TI.com)" <kory.maincent@bootlin.com>
> >
> > The drm_kms_helper_poll_fini() and drm_atomic_helper_shutdown() helpers
> > should only be called when the device has been successfully registered.
> > Currently, these functions are called unconditionally in tilcdc_fini(),
> > which causes warnings during probe deferral scenarios.
> >
> > [ 7.972317] WARNING: CPU: 0 PID: 23 at
> > drivers/gpu/drm/drm_atomic_state_helper.c:175
> > drm_atomic_helper_crtc_duplicate_state+0x60/0x68 ... [ 8.005820]
> > drm_atomic_helper_crtc_duplicate_state from
> > drm_atomic_get_crtc_state+0x68/0x108 [ 8.005858]
> > drm_atomic_get_crtc_state from drm_atomic_helper_disable_all+0x90/0x1c8 [
> > 8.005885] drm_atomic_helper_disable_all from
> > drm_atomic_helper_shutdown+0x90/0x144 [ 8.005911]
> > drm_atomic_helper_shutdown from tilcdc_fini+0x68/0xf8 [tilcdc] [
> > 8.005957] tilcdc_fini [tilcdc] from tilcdc_pdev_probe+0xb0/0x6d4 [tilcdc]
> >
> > Fix this by moving both drm_kms_helper_poll_fini() and
> > drm_atomic_helper_shutdown() inside the priv->is_registered conditional
> > block, ensuring they only execute after successful device registration.
> >
> > Fixes: 3c4babae3c4a ("drm: Call drm_atomic_helper_shutdown() at
> > shutdown/remove time for misc drivers") Signed-off-by: Kory Maincent
> > (TI.com) <kory.maincent@bootlin.com> ---
> > drivers/gpu/drm/tilcdc/tilcdc_drv.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> > b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 7caec4d38ddf..2031267a3490
> > 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> > +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> > @@ -172,11 +172,11 @@ static void tilcdc_fini(struct drm_device *dev)
> > if (priv->crtc)
> > tilcdc_crtc_shutdown(priv->crtc);
> >
> > - if (priv->is_registered)
> > + if (priv->is_registered) {
> > drm_dev_unregister(dev);
> > -
> > - drm_kms_helper_poll_fini(dev);
> > - drm_atomic_helper_shutdown(dev);
> > + drm_kms_helper_poll_fini(dev);
> > + drm_atomic_helper_shutdown(dev);
> > + }
> > tilcdc_irq_uninstall(dev);
> > drm_mode_config_cleanup(dev);
>
> I don't think that's the right fix. tilcdc_fini is pretty complex
> because it gets called from multiple locations with various level of
> initialisation.
>
> This is done because tilcdc_init is using a bunch of deprecated
> functions with better alternatives now, and those would make the job of
> tilcdc_fini much easier.
>
> That's what we should be focusing on.
I am also currently focusing on improving this driver (which has indeed some
weird code leftover), but this work will land in drm misc next while this is a
fix for the current implementation which fix an unwanted warning.
Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/tilcdc: Fix removal actions in case of failed probe
2025-10-14 14:32 [PATCH] drm/tilcdc: Fix removal actions in case of failed probe Kory Maincent
2025-10-14 15:36 ` Maxime Ripard
@ 2025-10-15 5:00 ` Swamil Jain
2025-10-22 7:05 ` Tomi Valkeinen
2 siblings, 0 replies; 9+ messages in thread
From: Swamil Jain @ 2025-10-15 5:00 UTC (permalink / raw)
To: Kory Maincent, Tomi Valkeinen, Douglas Anderson, Maxime Ripard,
dri-devel, linux-kernel
Cc: Bajjuri Praneeth, Louis Chauvet, thomas.petazzoni, Jyri Sarha,
Maarten Lankhorst, Thomas Zimmermann, David Airlie,
Simona Vetter
Hi Köry,
Thanks for the patch.
On 14-10-2025 20:02, Kory Maincent wrote:
> From: "Kory Maincent (TI.com)" <kory.maincent@bootlin.com>
>
> The drm_kms_helper_poll_fini() and drm_atomic_helper_shutdown() helpers
> should only be called when the device has been successfully registered.
> Currently, these functions are called unconditionally in tilcdc_fini(),
> which causes warnings during probe deferral scenarios.
>
> [ 7.972317] WARNING: CPU: 0 PID: 23 at drivers/gpu/drm/drm_atomic_state_helper.c:175 drm_atomic_helper_crtc_duplicate_state+0x60/0x68
> ...
> [ 8.005820] drm_atomic_helper_crtc_duplicate_state from drm_atomic_get_crtc_state+0x68/0x108
> [ 8.005858] drm_atomic_get_crtc_state from drm_atomic_helper_disable_all+0x90/0x1c8
> [ 8.005885] drm_atomic_helper_disable_all from drm_atomic_helper_shutdown+0x90/0x144
> [ 8.005911] drm_atomic_helper_shutdown from tilcdc_fini+0x68/0xf8 [tilcdc]
> [ 8.005957] tilcdc_fini [tilcdc] from tilcdc_pdev_probe+0xb0/0x6d4 [tilcdc]
>
> Fix this by moving both drm_kms_helper_poll_fini() and
> drm_atomic_helper_shutdown() inside the priv->is_registered conditional
> block, ensuring they only execute after successful device registration.
>
> Fixes: 3c4babae3c4a ("drm: Call drm_atomic_helper_shutdown() at shutdown/remove time for misc drivers")
> Signed-off-by: Kory Maincent (TI.com) <kory.maincent@bootlin.com>
> ---
I would suggest the same, as Maxime mentioned to improve the driver to
replace the deprecated functions with better alternatives. But as you
mentioned, you are working on improving the driver and for now to remove
unwanted warnings it is good to have this patch in drm misc next.
Reviewed-by: Swamil Jain <s-jain1@ti.com>
---
Regards,
Swamil> drivers/gpu/drm/tilcdc/tilcdc_drv.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> index 7caec4d38ddf..2031267a3490 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> @@ -172,11 +172,11 @@ static void tilcdc_fini(struct drm_device *dev)
> if (priv->crtc)
> tilcdc_crtc_shutdown(priv->crtc);
>
> - if (priv->is_registered)
> + if (priv->is_registered) {
> drm_dev_unregister(dev);
> -
> - drm_kms_helper_poll_fini(dev);
> - drm_atomic_helper_shutdown(dev);
> + drm_kms_helper_poll_fini(dev);
> + drm_atomic_helper_shutdown(dev);
> + }
> tilcdc_irq_uninstall(dev);
> drm_mode_config_cleanup(dev);
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/tilcdc: Fix removal actions in case of failed probe
2025-10-14 16:21 ` Kory Maincent
@ 2025-10-21 13:14 ` Kory Maincent
2025-10-21 16:01 ` Maxime Ripard
0 siblings, 1 reply; 9+ messages in thread
From: Kory Maincent @ 2025-10-21 13:14 UTC (permalink / raw)
To: Maxime Ripard
Cc: Tomi Valkeinen, Douglas Anderson, dri-devel, linux-kernel,
Bajjuri Praneeth, Louis Chauvet, thomas.petazzoni, Jyri Sarha,
Maarten Lankhorst, Thomas Zimmermann, David Airlie,
Simona Vetter
On Tue, 14 Oct 2025 18:21:22 +0200
Kory Maincent <kory.maincent@bootlin.com> wrote:
> Hello Maxime,
>
> On Tue, 14 Oct 2025 17:36:47 +0200
> Maxime Ripard <mripard@kernel.org> wrote:
>
> > On Tue, Oct 14, 2025 at 04:32:28PM +0200, Kory Maincent wrote:
> > > From: "Kory Maincent (TI.com)" <kory.maincent@bootlin.com>
> > >
> > > The drm_kms_helper_poll_fini() and drm_atomic_helper_shutdown() helpers
> > > should only be called when the device has been successfully registered.
> > > Currently, these functions are called unconditionally in tilcdc_fini(),
> > > which causes warnings during probe deferral scenarios.
> > >
> > > [ 7.972317] WARNING: CPU: 0 PID: 23 at
> > > drivers/gpu/drm/drm_atomic_state_helper.c:175
> > > drm_atomic_helper_crtc_duplicate_state+0x60/0x68 ... [ 8.005820]
> > > drm_atomic_helper_crtc_duplicate_state from
> > > drm_atomic_get_crtc_state+0x68/0x108 [ 8.005858]
> > > drm_atomic_get_crtc_state from drm_atomic_helper_disable_all+0x90/0x1c8 [
> > > 8.005885] drm_atomic_helper_disable_all from
> > > drm_atomic_helper_shutdown+0x90/0x144 [ 8.005911]
> > > drm_atomic_helper_shutdown from tilcdc_fini+0x68/0xf8 [tilcdc] [
> > > 8.005957] tilcdc_fini [tilcdc] from tilcdc_pdev_probe+0xb0/0x6d4 [tilcdc]
> > >
> > > Fix this by moving both drm_kms_helper_poll_fini() and
> > > drm_atomic_helper_shutdown() inside the priv->is_registered conditional
> > > block, ensuring they only execute after successful device registration.
> > >
> > > Fixes: 3c4babae3c4a ("drm: Call drm_atomic_helper_shutdown() at
> > > shutdown/remove time for misc drivers") Signed-off-by: Kory Maincent
> > > (TI.com) <kory.maincent@bootlin.com> ---
> > > drivers/gpu/drm/tilcdc/tilcdc_drv.c | 8 ++++----
> > > 1 file changed, 4 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> > > b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 7caec4d38ddf..2031267a3490
> > > 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> > > +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> > > @@ -172,11 +172,11 @@ static void tilcdc_fini(struct drm_device *dev)
> > > if (priv->crtc)
> > > tilcdc_crtc_shutdown(priv->crtc);
> > >
> > > - if (priv->is_registered)
> > > + if (priv->is_registered) {
> > > drm_dev_unregister(dev);
> > > -
> > > - drm_kms_helper_poll_fini(dev);
> > > - drm_atomic_helper_shutdown(dev);
> > > + drm_kms_helper_poll_fini(dev);
> > > + drm_atomic_helper_shutdown(dev);
> > > + }
> > > tilcdc_irq_uninstall(dev);
> > > drm_mode_config_cleanup(dev);
> >
> > I don't think that's the right fix. tilcdc_fini is pretty complex
> > because it gets called from multiple locations with various level of
> > initialisation.
> >
> > This is done because tilcdc_init is using a bunch of deprecated
> > functions with better alternatives now, and those would make the job of
> > tilcdc_fini much easier.
> >
> > That's what we should be focusing on.
>
> I am also currently focusing on improving this driver (which has indeed some
> weird code leftover), but this work will land in drm misc next while this is a
> fix for the current implementation which fix an unwanted warning.
Maxime is it okay to merge this to the right drm fix branch as I am currently
working on the tilcdc cleaning process that will land into drm misc next.
Also I intend to remove the tilcdc panel subdriver and its binding as it
can be replaced by the simple panel driver. I know it is unusual to remove a
binding but the driver and the binding are crappy and legacy. What do you think?
Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/tilcdc: Fix removal actions in case of failed probe
2025-10-21 13:14 ` Kory Maincent
@ 2025-10-21 16:01 ` Maxime Ripard
0 siblings, 0 replies; 9+ messages in thread
From: Maxime Ripard @ 2025-10-21 16:01 UTC (permalink / raw)
To: Kory Maincent
Cc: Tomi Valkeinen, Douglas Anderson, dri-devel, linux-kernel,
Bajjuri Praneeth, Louis Chauvet, thomas.petazzoni, Jyri Sarha,
Maarten Lankhorst, Thomas Zimmermann, David Airlie,
Simona Vetter
[-- Attachment #1: Type: text/plain, Size: 3984 bytes --]
On Tue, Oct 21, 2025 at 03:14:35PM +0200, Kory Maincent wrote:
> On Tue, 14 Oct 2025 18:21:22 +0200
> Kory Maincent <kory.maincent@bootlin.com> wrote:
>
> > Hello Maxime,
> >
> > On Tue, 14 Oct 2025 17:36:47 +0200
> > Maxime Ripard <mripard@kernel.org> wrote:
> >
> > > On Tue, Oct 14, 2025 at 04:32:28PM +0200, Kory Maincent wrote:
> > > > From: "Kory Maincent (TI.com)" <kory.maincent@bootlin.com>
> > > >
> > > > The drm_kms_helper_poll_fini() and drm_atomic_helper_shutdown() helpers
> > > > should only be called when the device has been successfully registered.
> > > > Currently, these functions are called unconditionally in tilcdc_fini(),
> > > > which causes warnings during probe deferral scenarios.
> > > >
> > > > [ 7.972317] WARNING: CPU: 0 PID: 23 at
> > > > drivers/gpu/drm/drm_atomic_state_helper.c:175
> > > > drm_atomic_helper_crtc_duplicate_state+0x60/0x68 ... [ 8.005820]
> > > > drm_atomic_helper_crtc_duplicate_state from
> > > > drm_atomic_get_crtc_state+0x68/0x108 [ 8.005858]
> > > > drm_atomic_get_crtc_state from drm_atomic_helper_disable_all+0x90/0x1c8 [
> > > > 8.005885] drm_atomic_helper_disable_all from
> > > > drm_atomic_helper_shutdown+0x90/0x144 [ 8.005911]
> > > > drm_atomic_helper_shutdown from tilcdc_fini+0x68/0xf8 [tilcdc] [
> > > > 8.005957] tilcdc_fini [tilcdc] from tilcdc_pdev_probe+0xb0/0x6d4 [tilcdc]
> > > >
> > > > Fix this by moving both drm_kms_helper_poll_fini() and
> > > > drm_atomic_helper_shutdown() inside the priv->is_registered conditional
> > > > block, ensuring they only execute after successful device registration.
> > > >
> > > > Fixes: 3c4babae3c4a ("drm: Call drm_atomic_helper_shutdown() at
> > > > shutdown/remove time for misc drivers") Signed-off-by: Kory Maincent
> > > > (TI.com) <kory.maincent@bootlin.com> ---
> > > > drivers/gpu/drm/tilcdc/tilcdc_drv.c | 8 ++++----
> > > > 1 file changed, 4 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> > > > b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 7caec4d38ddf..2031267a3490
> > > > 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> > > > +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> > > > @@ -172,11 +172,11 @@ static void tilcdc_fini(struct drm_device *dev)
> > > > if (priv->crtc)
> > > > tilcdc_crtc_shutdown(priv->crtc);
> > > >
> > > > - if (priv->is_registered)
> > > > + if (priv->is_registered) {
> > > > drm_dev_unregister(dev);
> > > > -
> > > > - drm_kms_helper_poll_fini(dev);
> > > > - drm_atomic_helper_shutdown(dev);
> > > > + drm_kms_helper_poll_fini(dev);
> > > > + drm_atomic_helper_shutdown(dev);
> > > > + }
> > > > tilcdc_irq_uninstall(dev);
> > > > drm_mode_config_cleanup(dev);
> > >
> > > I don't think that's the right fix. tilcdc_fini is pretty complex
> > > because it gets called from multiple locations with various level of
> > > initialisation.
> > >
> > > This is done because tilcdc_init is using a bunch of deprecated
> > > functions with better alternatives now, and those would make the job of
> > > tilcdc_fini much easier.
> > >
> > > That's what we should be focusing on.
> >
> > I am also currently focusing on improving this driver (which has indeed some
> > weird code leftover), but this work will land in drm misc next while this is a
> > fix for the current implementation which fix an unwanted warning.
>
> Maxime is it okay to merge this to the right drm fix branch as I am currently
> working on the tilcdc cleaning process that will land into drm misc next.
>
> Also I intend to remove the tilcdc panel subdriver and its binding as it
> can be replaced by the simple panel driver. I know it is unusual to remove a
> binding but the driver and the binding are crappy and legacy. What do you think?
I don't see why what I was suggesting also couldn't be fixes, but at the
end of the day, I don't care which way it goes.
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/tilcdc: Fix removal actions in case of failed probe
2025-10-14 14:32 [PATCH] drm/tilcdc: Fix removal actions in case of failed probe Kory Maincent
2025-10-14 15:36 ` Maxime Ripard
2025-10-15 5:00 ` Swamil Jain
@ 2025-10-22 7:05 ` Tomi Valkeinen
2025-10-22 8:58 ` Kory Maincent
2 siblings, 1 reply; 9+ messages in thread
From: Tomi Valkeinen @ 2025-10-22 7:05 UTC (permalink / raw)
To: Kory Maincent, Douglas Anderson, Maxime Ripard, dri-devel, linux-kernel
Cc: Bajjuri Praneeth, Louis Chauvet, thomas.petazzoni, Jyri Sarha,
Maarten Lankhorst, Thomas Zimmermann, David Airlie,
Simona Vetter
Hi,
On 14/10/2025 17:32, Kory Maincent wrote:
> From: "Kory Maincent (TI.com)" <kory.maincent@bootlin.com>
>
> The drm_kms_helper_poll_fini() and drm_atomic_helper_shutdown() helpers
> should only be called when the device has been successfully registered.
> Currently, these functions are called unconditionally in tilcdc_fini(),
> which causes warnings during probe deferral scenarios.
>
> [ 7.972317] WARNING: CPU: 0 PID: 23 at drivers/gpu/drm/drm_atomic_state_helper.c:175 drm_atomic_helper_crtc_duplicate_state+0x60/0x68
> ...
> [ 8.005820] drm_atomic_helper_crtc_duplicate_state from drm_atomic_get_crtc_state+0x68/0x108
> [ 8.005858] drm_atomic_get_crtc_state from drm_atomic_helper_disable_all+0x90/0x1c8
> [ 8.005885] drm_atomic_helper_disable_all from drm_atomic_helper_shutdown+0x90/0x144
> [ 8.005911] drm_atomic_helper_shutdown from tilcdc_fini+0x68/0xf8 [tilcdc]
> [ 8.005957] tilcdc_fini [tilcdc] from tilcdc_pdev_probe+0xb0/0x6d4 [tilcdc]
>
> Fix this by moving both drm_kms_helper_poll_fini() and
> drm_atomic_helper_shutdown() inside the priv->is_registered conditional
> block, ensuring they only execute after successful device registration.
>
> Fixes: 3c4babae3c4a ("drm: Call drm_atomic_helper_shutdown() at shutdown/remove time for misc drivers")
> Signed-off-by: Kory Maincent (TI.com) <kory.maincent@bootlin.com>
Should this be cc: stable?
Tomi
> ---
> drivers/gpu/drm/tilcdc/tilcdc_drv.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> index 7caec4d38ddf..2031267a3490 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> @@ -172,11 +172,11 @@ static void tilcdc_fini(struct drm_device *dev)
> if (priv->crtc)
> tilcdc_crtc_shutdown(priv->crtc);
>
> - if (priv->is_registered)
> + if (priv->is_registered) {
> drm_dev_unregister(dev);
> -
> - drm_kms_helper_poll_fini(dev);
> - drm_atomic_helper_shutdown(dev);
> + drm_kms_helper_poll_fini(dev);
> + drm_atomic_helper_shutdown(dev);
> + }
> tilcdc_irq_uninstall(dev);
> drm_mode_config_cleanup(dev);
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/tilcdc: Fix removal actions in case of failed probe
2025-10-22 7:05 ` Tomi Valkeinen
@ 2025-10-22 8:58 ` Kory Maincent
2025-10-22 9:04 ` Kory Maincent
0 siblings, 1 reply; 9+ messages in thread
From: Kory Maincent @ 2025-10-22 8:58 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Douglas Anderson, Maxime Ripard, dri-devel, linux-kernel,
Bajjuri Praneeth, Louis Chauvet, thomas.petazzoni, Jyri Sarha,
Maarten Lankhorst, Thomas Zimmermann, David Airlie,
Simona Vetter
On Wed, 22 Oct 2025 10:05:47 +0300
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> wrote:
> Hi,
>
> On 14/10/2025 17:32, Kory Maincent wrote:
> > From: "Kory Maincent (TI.com)" <kory.maincent@bootlin.com>
> >
> > The drm_kms_helper_poll_fini() and drm_atomic_helper_shutdown() helpers
> > should only be called when the device has been successfully registered.
> > Currently, these functions are called unconditionally in tilcdc_fini(),
> > which causes warnings during probe deferral scenarios.
> >
> > [ 7.972317] WARNING: CPU: 0 PID: 23 at
> > drivers/gpu/drm/drm_atomic_state_helper.c:175
> > drm_atomic_helper_crtc_duplicate_state+0x60/0x68 ... [ 8.005820]
> > drm_atomic_helper_crtc_duplicate_state from
> > drm_atomic_get_crtc_state+0x68/0x108 [ 8.005858]
> > drm_atomic_get_crtc_state from drm_atomic_helper_disable_all+0x90/0x1c8 [
> > 8.005885] drm_atomic_helper_disable_all from
> > drm_atomic_helper_shutdown+0x90/0x144 [ 8.005911]
> > drm_atomic_helper_shutdown from tilcdc_fini+0x68/0xf8 [tilcdc] [
> > 8.005957] tilcdc_fini [tilcdc] from tilcdc_pdev_probe+0xb0/0x6d4 [tilcdc]
> >
> > Fix this by moving both drm_kms_helper_poll_fini() and
> > drm_atomic_helper_shutdown() inside the priv->is_registered conditional
> > block, ensuring they only execute after successful device registration.
> >
> > Fixes: 3c4babae3c4a ("drm: Call drm_atomic_helper_shutdown() at
> > shutdown/remove time for misc drivers") Signed-off-by: Kory Maincent
> > (TI.com) <kory.maincent@bootlin.com>
>
> Should this be cc: stable?
Indeed I think so.
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/tilcdc: Fix removal actions in case of failed probe
2025-10-22 8:58 ` Kory Maincent
@ 2025-10-22 9:04 ` Kory Maincent
0 siblings, 0 replies; 9+ messages in thread
From: Kory Maincent @ 2025-10-22 9:04 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Douglas Anderson, Maxime Ripard, dri-devel, linux-kernel,
Bajjuri Praneeth, Louis Chauvet, thomas.petazzoni, Jyri Sarha,
Maarten Lankhorst, Thomas Zimmermann, David Airlie,
Simona Vetter
On Wed, 22 Oct 2025 10:58:40 +0200
Kory Maincent <kory.maincent@bootlin.com> wrote:
> On Wed, 22 Oct 2025 10:05:47 +0300
> Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> wrote:
>
> > Hi,
> >
> > On 14/10/2025 17:32, Kory Maincent wrote:
> > > From: "Kory Maincent (TI.com)" <kory.maincent@bootlin.com>
> > >
> > > The drm_kms_helper_poll_fini() and drm_atomic_helper_shutdown() helpers
> > > should only be called when the device has been successfully registered.
> > > Currently, these functions are called unconditionally in tilcdc_fini(),
> > > which causes warnings during probe deferral scenarios.
> > >
> > > [ 7.972317] WARNING: CPU: 0 PID: 23 at
> > > drivers/gpu/drm/drm_atomic_state_helper.c:175
> > > drm_atomic_helper_crtc_duplicate_state+0x60/0x68 ... [ 8.005820]
> > > drm_atomic_helper_crtc_duplicate_state from
> > > drm_atomic_get_crtc_state+0x68/0x108 [ 8.005858]
> > > drm_atomic_get_crtc_state from drm_atomic_helper_disable_all+0x90/0x1c8 [
> > > 8.005885] drm_atomic_helper_disable_all from
> > > drm_atomic_helper_shutdown+0x90/0x144 [ 8.005911]
> > > drm_atomic_helper_shutdown from tilcdc_fini+0x68/0xf8 [tilcdc] [
> > > 8.005957] tilcdc_fini [tilcdc] from tilcdc_pdev_probe+0xb0/0x6d4 [tilcdc]
> > >
> > > Fix this by moving both drm_kms_helper_poll_fini() and
> > > drm_atomic_helper_shutdown() inside the priv->is_registered conditional
> > > block, ensuring they only execute after successful device registration.
> > >
> > > Fixes: 3c4babae3c4a ("drm: Call drm_atomic_helper_shutdown() at
> > > shutdown/remove time for misc drivers") Signed-off-by: Kory Maincent
> > > (TI.com) <kory.maincent@bootlin.com>
> >
> > Should this be cc: stable?
>
> Indeed I think so.
Should I send a new version with the stable tag included?
Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-10-22 9:04 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-14 14:32 [PATCH] drm/tilcdc: Fix removal actions in case of failed probe Kory Maincent
2025-10-14 15:36 ` Maxime Ripard
2025-10-14 16:21 ` Kory Maincent
2025-10-21 13:14 ` Kory Maincent
2025-10-21 16:01 ` Maxime Ripard
2025-10-15 5:00 ` Swamil Jain
2025-10-22 7:05 ` Tomi Valkeinen
2025-10-22 8:58 ` Kory Maincent
2025-10-22 9:04 ` Kory Maincent
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®