mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/panel-simple: take i2c adapter module reference
@ 2026-07-16 13:23 Johan Hovold
  2026-08-12 14:12 ` Johan Hovold
  2026-10-02 14:02 ` Neil Armstrong
  0 siblings, 2 replies; 7+ messages in thread
From: Johan Hovold @ 2026-07-16 13:23 UTC (permalink / raw)
  To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann
  Cc: David Airlie, Simona Vetter, dri-devel, linux-kernel, Johan Hovold

The i2c subsystem currently blocks during adapter deregistration
whenever there are consumers holding a reference.

Switch to using of_get_i2c_adapter_by_node() which also takes a
reference to the adapter module so that an attempt to unload the module
while in use fails gracefully instead of blocking uninterruptibly.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/gpu/drm/panel/panel-simple.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index c09bf3db5e78..f58e83aa4ebe 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -701,7 +701,7 @@ static struct panel_simple *panel_simple_probe(struct device *dev)
 
 	ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0);
 	if (ddc) {
-		panel->ddc = of_find_i2c_adapter_by_node(ddc);
+		panel->ddc = of_get_i2c_adapter_by_node(ddc);
 		of_node_put(ddc);
 
 		if (!panel->ddc)
@@ -746,7 +746,7 @@ static struct panel_simple *panel_simple_probe(struct device *dev)
 	pm_runtime_disable(dev);
 free_ddc:
 	if (panel->ddc)
-		put_device(&panel->ddc->dev);
+		i2c_put_adapter(panel->ddc);
 
 	return ERR_PTR(err);
 }
@@ -791,7 +791,7 @@ static void panel_simple_remove(struct device *dev)
 	pm_runtime_dont_use_autosuspend(dev);
 	pm_runtime_disable(dev);
 	if (panel->ddc)
-		put_device(&panel->ddc->dev);
+		i2c_put_adapter(panel->ddc);
 }
 
 static const struct drm_display_mode ampire_am_1280800n3tzqw_t00h_mode = {
-- 
2.54.0


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

* Re: [PATCH] drm/panel-simple: take i2c adapter module reference
  2026-07-16 13:23 [PATCH] drm/panel-simple: take i2c adapter module reference Johan Hovold
@ 2026-08-12 14:12 ` Johan Hovold
  2026-10-01 13:01   ` Johan Hovold
  2026-11-17 11:49   ` Johan Hovold
  2026-10-02 14:02 ` Neil Armstrong
  1 sibling, 2 replies; 7+ messages in thread
From: Johan Hovold @ 2026-08-12 14:12 UTC (permalink / raw)
  To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann
  Cc: David Airlie, Simona Vetter, dri-devel, linux-kernel

On Thu, Jul 16, 2026 at 03:23:34PM +0200, Johan Hovold wrote:
> The i2c subsystem currently blocks during adapter deregistration
> whenever there are consumers holding a reference.
> 
> Switch to using of_get_i2c_adapter_by_node() which also takes a
> reference to the adapter module so that an attempt to unload the module
> while in use fails gracefully instead of blocking uninterruptibly.
> 
> Signed-off-by: Johan Hovold <johan@kernel.org>

Can this one be picked up for 7.3-rc1?

Johan

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

* Re: [PATCH] drm/panel-simple: take i2c adapter module reference
  2026-08-12 14:12 ` Johan Hovold
@ 2026-10-01 13:01   ` Johan Hovold
  2026-11-17 11:49   ` Johan Hovold
  1 sibling, 0 replies; 7+ messages in thread
From: Johan Hovold @ 2026-10-01 13:01 UTC (permalink / raw)
  To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann
  Cc: David Airlie, Simona Vetter, dri-devel, linux-kernel

On Wed, Aug 12, 2026 at 04:12:00PM +0200, Johan Hovold wrote:
> On Thu, Jul 16, 2026 at 03:23:34PM +0200, Johan Hovold wrote:
> > The i2c subsystem currently blocks during adapter deregistration
> > whenever there are consumers holding a reference.
> > 
> > Switch to using of_get_i2c_adapter_by_node() which also takes a
> > reference to the adapter module so that an attempt to unload the module
> > while in use fails gracefully instead of blocking uninterruptibly.
> > 
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> 
> Can this one be picked up for 7.3-rc1?

Again, can someone please pick this one up?

Johan

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

* Re: [PATCH] drm/panel-simple: take i2c adapter module reference
  2026-07-16 13:23 [PATCH] drm/panel-simple: take i2c adapter module reference Johan Hovold
  2026-08-12 14:12 ` Johan Hovold
@ 2026-10-02 14:02 ` Neil Armstrong
  1 sibling, 0 replies; 7+ messages in thread
From: Neil Armstrong @ 2026-10-02 14:02 UTC (permalink / raw)
  To: Johan Hovold, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann
  Cc: David Airlie, Simona Vetter, dri-devel, linux-kernel

On 7/16/26 15:23, Johan Hovold wrote:
> The i2c subsystem currently blocks during adapter deregistration
> whenever there are consumers holding a reference.
> 
> Switch to using of_get_i2c_adapter_by_node() which also takes a
> reference to the adapter module so that an attempt to unload the module
> while in use fails gracefully instead of blocking uninterruptibly.
> 
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>   drivers/gpu/drm/panel/panel-simple.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index c09bf3db5e78..f58e83aa4ebe 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -701,7 +701,7 @@ static struct panel_simple *panel_simple_probe(struct device *dev)
>   
>   	ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0);
>   	if (ddc) {
> -		panel->ddc = of_find_i2c_adapter_by_node(ddc);
> +		panel->ddc = of_get_i2c_adapter_by_node(ddc);
>   		of_node_put(ddc);
>   
>   		if (!panel->ddc)
> @@ -746,7 +746,7 @@ static struct panel_simple *panel_simple_probe(struct device *dev)
>   	pm_runtime_disable(dev);
>   free_ddc:
>   	if (panel->ddc)
> -		put_device(&panel->ddc->dev);
> +		i2c_put_adapter(panel->ddc);
>   
>   	return ERR_PTR(err);
>   }
> @@ -791,7 +791,7 @@ static void panel_simple_remove(struct device *dev)
>   	pm_runtime_dont_use_autosuspend(dev);
>   	pm_runtime_disable(dev);
>   	if (panel->ddc)
> -		put_device(&panel->ddc->dev);
> +		i2c_put_adapter(panel->ddc);
>   }
>   
>   static const struct drm_display_mode ampire_am_1280800n3tzqw_t00h_mode = {

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

Thanks,
Neil

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

* Re: [PATCH] drm/panel-simple: take i2c adapter module reference
  2026-08-12 14:12 ` Johan Hovold
  2026-10-01 13:01   ` Johan Hovold
@ 2026-11-17 11:49   ` Johan Hovold
  2026-11-18  4:24     ` Doug Anderson
  1 sibling, 1 reply; 7+ messages in thread
From: Johan Hovold @ 2026-11-17 11:49 UTC (permalink / raw)
  To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann
  Cc: David Airlie, Simona Vetter, dri-devel, linux-kernel, Douglas Anderson

On Wed, Aug 12, 2026 at 04:12:00PM +0200, Johan Hovold wrote:
> On Thu, Jul 16, 2026 at 03:23:34PM +0200, Johan Hovold wrote:
> > The i2c subsystem currently blocks during adapter deregistration
> > whenever there are consumers holding a reference.
> > 
> > Switch to using of_get_i2c_adapter_by_node() which also takes a
> > reference to the adapter module so that an attempt to unload the module
> > while in use fails gracefully instead of blocking uninterruptibly.
> > 
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> 
> Can this one be picked up for 7.3-rc1?

This one is still not in linux-next. Can I get one more ack or whatever
is needed for this to move forward?

Also adding Doug who merged a corresponding patch for panel-edp back in
July. [1]

Johan


[1] https://lore.kernel.org/all/20260717143119.1815106-1-johan@kernel.org/

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

* Re: [PATCH] drm/panel-simple: take i2c adapter module reference
  2026-11-17 11:49   ` Johan Hovold
@ 2026-11-18  4:24     ` Doug Anderson
  2026-11-18  7:17       ` Johan Hovold
  0 siblings, 1 reply; 7+ messages in thread
From: Doug Anderson @ 2026-11-18  4:24 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, dri-devel,
	linux-kernel

Hi,

On Tue, Nov 17, 2026 at 3:49 AM Johan Hovold <johan@kernel.org> wrote:
>
> On Wed, Aug 12, 2026 at 04:12:00PM +0200, Johan Hovold wrote:
> > On Thu, Jul 16, 2026 at 03:23:34PM +0200, Johan Hovold wrote:
> > > The i2c subsystem currently blocks during adapter deregistration
> > > whenever there are consumers holding a reference.
> > >
> > > Switch to using of_get_i2c_adapter_by_node() which also takes a
> > > reference to the adapter module so that an attempt to unload the module
> > > while in use fails gracefully instead of blocking uninterruptibly.
> > >
> > > Signed-off-by: Johan Hovold <johan@kernel.org>
> >
> > Can this one be picked up for 7.3-rc1?
>
> This one is still not in linux-next. Can I get one more ack or whatever
> is needed for this to move forward?
>
> Also adding Doug who merged a corresponding patch for panel-edp back in
> July. [1]
>
> Johan
>
>
> [1] https://lore.kernel.org/all/20260717143119.1815106-1-johan@kernel.org/

I took a quick gander. One thing I notice is that earlier in the
thread there is a Sashiko review [1]. It seems to point out a valid
problem here. I'd imagine that if I land this patch, I'll get a
nastygram from Arnd and his RANDCONFIG testing. Am I confused? Is
Sashiko wrong in its analysis?

[1] http://lore.kernel.org/r/20260716134901.05E221F00A3E@smtp.kernel.org

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

* Re: [PATCH] drm/panel-simple: take i2c adapter module reference
  2026-11-18  4:24     ` Doug Anderson
@ 2026-11-18  7:17       ` Johan Hovold
  0 siblings, 0 replies; 7+ messages in thread
From: Johan Hovold @ 2026-11-18  7:17 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, dri-devel,
	linux-kernel

On Tue, Nov 17, 2026 at 08:24:53PM -0800, Doug Anderson wrote:

> I took a quick gander. One thing I notice is that earlier in the
> thread there is a Sashiko review [1]. It seems to point out a valid
> problem here. I'd imagine that if I land this patch, I'll get a
> nastygram from Arnd and his RANDCONFIG testing. Am I confused? Is
> Sashiko wrong in its analysis?

Thanks, Doug.

Yeah, I took a look at that at the time and I believe the LLM is
mistaken as DRM selects I2C since forever so the driver cannot be built
without CONFIG_I2C enabled (and you'd have the same situation with
the panel-edp change merged in July).

I started cleaning up the I2C mess but got pre-empted. I don't think
that should block this change.

Johan
 
> [1] http://lore.kernel.org/r/20260716134901.05E221F00A3E@smtp.kernel.org

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

end of thread, other threads:[~2026-11-18  7:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-16 13:23 [PATCH] drm/panel-simple: take i2c adapter module reference Johan Hovold
2026-08-12 14:12 ` Johan Hovold
2026-10-01 13:01   ` Johan Hovold
2026-11-17 11:49   ` Johan Hovold
2026-11-18  4:24     ` Doug Anderson
2026-11-18  7:17       ` Johan Hovold
2026-10-02 14:02 ` Neil Armstrong

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®