linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Integrate refcounting across of_drm_find_panel() callers
@ 2025-06-05  3:45 Anusha Srivatsa
  2025-06-05  3:45 ` [PATCH 1/4] drm/panel: get/put panel reference in drm_panel_add/remove() Anusha Srivatsa
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Anusha Srivatsa @ 2025-06-05  3:45 UTC (permalink / raw)
  To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Inki Dae,
	Jagan Teki, Marek Szyprowski, Andrzej Hajda, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Chen-Yu Tsai,
	Samuel Holland, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar
  Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-sunxi,
	linux-samsung-soc, Anusha Srivatsa

With the panel refcount allocation infrastructure  merged: [1]
and all drivers converted to use the new API: [2],[3] and [4],
the next chunk of work involves integrating refcounting across
different callers across various drivers.

First patch was added to the original series [1] but later
removed. Adding it here with the initial of_drm_find_panel()
callers being updated with refcounting. This is not an exhaustive
list. Remaining drivers to be updated will be sent in next set
of series.

[1] -> https://patchwork.freedesktop.org/series/146750/
[2] -> https://patchwork.freedesktop.org/series/147082/
[3] -> https://patchwork.freedesktop.org/series/147157/
[4] -> https://patchwork.freedesktop.org/series/147246/

Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
Anusha Srivatsa (4):
      drm/panel: get/put panel reference in drm_panel_add/remove()
      drm/panel/samsung-dsicm: Keep up with refcounting
      drm/panel/sun4i: Keep up with refcounting
      drm/panel/exynos: Keep up with refcounting

 drivers/gpu/drm/bridge/samsung-dsim.c   | 1 +
 drivers/gpu/drm/drm_panel.c             | 2 ++
 drivers/gpu/drm/exynos/exynos_drm_dpi.c | 1 +
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c  | 2 ++
 4 files changed, 6 insertions(+)
---
base-commit: 685c407f168cb49a12cc703230d1e2d62767bfd2
change-id: 20250604-of_drm_find_panel_part1-33a2deb79256

Best regards,
-- 
Anusha Srivatsa <asrivats@redhat.com>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] drm/panel: get/put panel reference in drm_panel_add/remove()
  2025-06-05  3:45 [PATCH 0/4] Integrate refcounting across of_drm_find_panel() callers Anusha Srivatsa
@ 2025-06-05  3:45 ` Anusha Srivatsa
  2025-06-05  3:45 ` [PATCH 2/4] drm/panel/samsung-dsicm: Keep up with refcounting Anusha Srivatsa
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Anusha Srivatsa @ 2025-06-05  3:45 UTC (permalink / raw)
  To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Inki Dae,
	Jagan Teki, Marek Szyprowski, Andrzej Hajda, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Chen-Yu Tsai,
	Samuel Holland, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar
  Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-sunxi,
	linux-samsung-soc, Anusha Srivatsa

Take the panel reference and put it back as required.
drm_panel_add() and drm_panel_remove() add a panel to
the global registry and removes a panel respectively.
Use get() and put() helpers to keep up with refcounting.

Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
 drivers/gpu/drm/drm_panel.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index fee65dc65979d6c03753967cefa6d5c4e597277d..ffa3428b5f52c599b53b1fdc0d0a9181a47c91d4 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -80,6 +80,7 @@ EXPORT_SYMBOL(drm_panel_init);
  */
 void drm_panel_add(struct drm_panel *panel)
 {
+	drm_panel_get(panel);
 	mutex_lock(&panel_lock);
 	list_add_tail(&panel->list, &panel_list);
 	mutex_unlock(&panel_lock);
@@ -97,6 +98,7 @@ void drm_panel_remove(struct drm_panel *panel)
 	mutex_lock(&panel_lock);
 	list_del_init(&panel->list);
 	mutex_unlock(&panel_lock);
+	drm_panel_put(panel);
 }
 EXPORT_SYMBOL(drm_panel_remove);
 

-- 
2.48.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] drm/panel/samsung-dsicm: Keep up with refcounting
  2025-06-05  3:45 [PATCH 0/4] Integrate refcounting across of_drm_find_panel() callers Anusha Srivatsa
  2025-06-05  3:45 ` [PATCH 1/4] drm/panel: get/put panel reference in drm_panel_add/remove() Anusha Srivatsa
@ 2025-06-05  3:45 ` Anusha Srivatsa
  2025-06-06 12:03   ` Maxime Ripard
  2025-06-05  3:45 ` [PATCH 3/4] drm/panel/sun4i: " Anusha Srivatsa
  2025-06-05  3:45 ` [PATCH 4/4] drm/panel/exynos: " Anusha Srivatsa
  3 siblings, 1 reply; 7+ messages in thread
From: Anusha Srivatsa @ 2025-06-05  3:45 UTC (permalink / raw)
  To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Inki Dae,
	Jagan Teki, Marek Szyprowski, Andrzej Hajda, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Chen-Yu Tsai,
	Samuel Holland, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar
  Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-sunxi,
	linux-samsung-soc, Anusha Srivatsa

Put the panel reference back when driver is no
longer using it.

Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
 drivers/gpu/drm/bridge/samsung-dsim.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
index 0014c497e3fe7d8349a119dbdda30d65d816cccf..3667855ff0d6d1b608c579573de657af7fd14388 100644
--- a/drivers/gpu/drm/bridge/samsung-dsim.c
+++ b/drivers/gpu/drm/bridge/samsung-dsim.c
@@ -1748,6 +1748,7 @@ static int samsung_dsim_host_attach(struct mipi_dsi_host *host,
 			dsi->out_bridge = ERR_PTR(-EINVAL);
 	}
 
+	drm_panel_put(panel);
 	of_node_put(remote);
 
 	if (IS_ERR(dsi->out_bridge)) {

-- 
2.48.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] drm/panel/sun4i: Keep up with refcounting
  2025-06-05  3:45 [PATCH 0/4] Integrate refcounting across of_drm_find_panel() callers Anusha Srivatsa
  2025-06-05  3:45 ` [PATCH 1/4] drm/panel: get/put panel reference in drm_panel_add/remove() Anusha Srivatsa
  2025-06-05  3:45 ` [PATCH 2/4] drm/panel/samsung-dsicm: Keep up with refcounting Anusha Srivatsa
@ 2025-06-05  3:45 ` Anusha Srivatsa
  2025-06-05  3:45 ` [PATCH 4/4] drm/panel/exynos: " Anusha Srivatsa
  3 siblings, 0 replies; 7+ messages in thread
From: Anusha Srivatsa @ 2025-06-05  3:45 UTC (permalink / raw)
  To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Inki Dae,
	Jagan Teki, Marek Szyprowski, Andrzej Hajda, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Chen-Yu Tsai,
	Samuel Holland, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar
  Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-sunxi,
	linux-samsung-soc, Anusha Srivatsa

Put the panel reference back when driver is no
longer using it.

Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index c35b70d83e53b7397c6e38dde45824bd49fdf099..36d47d7cedde1e1e3e83eb670520664100bd0a25 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -990,6 +990,8 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host,
 
 	drm_kms_helper_hotplug_event(dsi->drm);
 
+	drm_panel_put(dsi->panel);
+
 	return 0;
 }
 

-- 
2.48.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] drm/panel/exynos: Keep up with refcounting
  2025-06-05  3:45 [PATCH 0/4] Integrate refcounting across of_drm_find_panel() callers Anusha Srivatsa
                   ` (2 preceding siblings ...)
  2025-06-05  3:45 ` [PATCH 3/4] drm/panel/sun4i: " Anusha Srivatsa
@ 2025-06-05  3:45 ` Anusha Srivatsa
  3 siblings, 0 replies; 7+ messages in thread
From: Anusha Srivatsa @ 2025-06-05  3:45 UTC (permalink / raw)
  To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Inki Dae,
	Jagan Teki, Marek Szyprowski, Andrzej Hajda, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Chen-Yu Tsai,
	Samuel Holland, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar
  Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-sunxi,
	linux-samsung-soc, Anusha Srivatsa

Put the panel reference back when driver is no
longer using it.

Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
 drivers/gpu/drm/exynos/exynos_drm_dpi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index 0dc36df6ada34cd0d4544f14e616fe3c52dafc73..7b82ff7f2d2761a679fe3b319a73f7d1d4c87033 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -138,6 +138,7 @@ static void exynos_dpi_disable(struct drm_encoder *encoder)
 		drm_panel_disable(ctx->panel);
 		drm_panel_unprepare(ctx->panel);
 	}
+	drm_panel_put(ctx->panel);
 }
 
 static const struct drm_encoder_helper_funcs exynos_dpi_encoder_helper_funcs = {

-- 
2.48.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/4] drm/panel/samsung-dsicm: Keep up with refcounting
  2025-06-05  3:45 ` [PATCH 2/4] drm/panel/samsung-dsicm: Keep up with refcounting Anusha Srivatsa
@ 2025-06-06 12:03   ` Maxime Ripard
       [not found]     ` <CAN9Xe3Si6XwsGOesNKOx9M8PjBkMG2paWXV5gvAnujWih6sqtA@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Maxime Ripard @ 2025-06-06 12:03 UTC (permalink / raw)
  To: Anusha Srivatsa
  Cc: Neil Armstrong, Jessica Zhang, Maarten Lankhorst,
	Thomas Zimmermann, David Airlie, Simona Vetter, Inki Dae,
	Jagan Teki, Marek Szyprowski, Andrzej Hajda, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Chen-Yu Tsai,
	Samuel Holland, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar, dri-devel, linux-kernel, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc

[-- Attachment #1: Type: text/plain, Size: 1278 bytes --]

On Wed, Jun 04, 2025 at 10:45:11PM -0500, Anusha Srivatsa wrote:
> Put the panel reference back when driver is no
> longer using it.
> 
> Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
> ---
>  drivers/gpu/drm/bridge/samsung-dsim.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
> index 0014c497e3fe7d8349a119dbdda30d65d816cccf..3667855ff0d6d1b608c579573de657af7fd14388 100644
> --- a/drivers/gpu/drm/bridge/samsung-dsim.c
> +++ b/drivers/gpu/drm/bridge/samsung-dsim.c
> @@ -1748,6 +1748,7 @@ static int samsung_dsim_host_attach(struct mipi_dsi_host *host,
>  			dsi->out_bridge = ERR_PTR(-EINVAL);
>  	}
>  
> +	drm_panel_put(panel);
>  	of_node_put(remote);
>  
>  	if (IS_ERR(dsi->out_bridge)) {

Explaining in your commit log why you think it's a good idea to put it
there would be really nice. In particular, it looks super odd to me that
you would put the panel reference in attach.

Also, your patch doesn't work, and you have a reference inbalance. You
have one taken by the panel driver, put in remove. You have one in
drm_panel_add, put in drm_panel_remove. Which reference do you put here?

This applies to your other patches too.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/4] drm/panel/samsung-dsicm: Keep up with refcounting
       [not found]     ` <CAN9Xe3Si6XwsGOesNKOx9M8PjBkMG2paWXV5gvAnujWih6sqtA@mail.gmail.com>
@ 2025-06-10 15:41       ` Maxime Ripard
  0 siblings, 0 replies; 7+ messages in thread
From: Maxime Ripard @ 2025-06-10 15:41 UTC (permalink / raw)
  To: Anusha Srivatsa
  Cc: Neil Armstrong, Jessica Zhang, Maarten Lankhorst,
	Thomas Zimmermann, David Airlie, Simona Vetter, Inki Dae,
	Jagan Teki, Marek Szyprowski, Andrzej Hajda, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Chen-Yu Tsai,
	Samuel Holland, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar, dri-devel, linux-kernel, linux-arm-kernel,
	linux-sunxi, linux-samsung-soc

[-- Attachment #1: Type: text/plain, Size: 1951 bytes --]

On Mon, Jun 09, 2025 at 10:45:35AM -0500, Anusha Srivatsa wrote:
> On Fri, Jun 6, 2025 at 7:03 AM Maxime Ripard <mripard@kernel.org> wrote:
> 
> > On Wed, Jun 04, 2025 at 10:45:11PM -0500, Anusha Srivatsa wrote:
> > > Put the panel reference back when driver is no
> > > longer using it.
> > >
> > > Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
> > > ---
> > >  drivers/gpu/drm/bridge/samsung-dsim.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c
> > b/drivers/gpu/drm/bridge/samsung-dsim.c
> > > index
> > 0014c497e3fe7d8349a119dbdda30d65d816cccf..3667855ff0d6d1b608c579573de657af7fd14388
> > 100644
> > > --- a/drivers/gpu/drm/bridge/samsung-dsim.c
> > > +++ b/drivers/gpu/drm/bridge/samsung-dsim.c
> > > @@ -1748,6 +1748,7 @@ static int samsung_dsim_host_attach(struct
> > mipi_dsi_host *host,
> > >                       dsi->out_bridge = ERR_PTR(-EINVAL);
> > >       }
> > >
> > > +     drm_panel_put(panel);
> > >       of_node_put(remote);
> > >
> > >       if (IS_ERR(dsi->out_bridge)) {
> >
> > Explaining in your commit log why you think it's a good idea to put it
> > there would be really nice. In particular, it looks super odd to me that
> > you would put the panel reference in attach.
> >
> > Also, your patch doesn't work, and you have a reference inbalance. You
> > have one taken by the panel driver, put in remove. You have one in
> > drm_panel_add, put in drm_panel_remove. Which reference do you put here?
> >
> > This applies to your other patches too.
>
> Yes, I should get the ref in of_drm_find_panel() to put it here. With
> that said, all callers of of_drm_find_panel() should be converted
> instead of the small batch that this series addresses.

Then do the of_drm_find_panel() conversion before, because here you will
free up the structure despite some callers still having a reference on
it.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 269 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-06-10 19:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-05  3:45 [PATCH 0/4] Integrate refcounting across of_drm_find_panel() callers Anusha Srivatsa
2025-06-05  3:45 ` [PATCH 1/4] drm/panel: get/put panel reference in drm_panel_add/remove() Anusha Srivatsa
2025-06-05  3:45 ` [PATCH 2/4] drm/panel/samsung-dsicm: Keep up with refcounting Anusha Srivatsa
2025-06-06 12:03   ` Maxime Ripard
     [not found]     ` <CAN9Xe3Si6XwsGOesNKOx9M8PjBkMG2paWXV5gvAnujWih6sqtA@mail.gmail.com>
2025-06-10 15:41       ` Maxime Ripard
2025-06-05  3:45 ` [PATCH 3/4] drm/panel/sun4i: " Anusha Srivatsa
2025-06-05  3:45 ` [PATCH 4/4] drm/panel/exynos: " Anusha Srivatsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).