* [PATCH] drm/panel-edp: take i2c adapter module reference
@ 2026-07-16 13:22 Johan Hovold
2026-07-16 17:27 ` Doug Anderson
0 siblings, 1 reply; 2+ messages in thread
From: Johan Hovold @ 2026-07-16 13:22 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann
Cc: Douglas Anderson, 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-edp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
index aa27d6cd932e..1606b50513d1 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -873,7 +873,7 @@ static int panel_edp_probe(struct device *dev, const struct panel_desc *desc,
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)
@@ -938,7 +938,7 @@ static int panel_edp_probe(struct device *dev, const struct panel_desc *desc,
pm_runtime_disable(dev);
err_finished_ddc_init:
if (panel->ddc && (!panel->aux || panel->ddc != &panel->aux->ddc))
- put_device(&panel->ddc->dev);
+ i2c_put_adapter(panel->ddc);
return err;
}
@@ -983,7 +983,7 @@ static void panel_edp_remove(struct device *dev)
pm_runtime_dont_use_autosuspend(dev);
pm_runtime_disable(dev);
if (panel->ddc && (!panel->aux || panel->ddc != &panel->aux->ddc))
- put_device(&panel->ddc->dev);
+ i2c_put_adapter(panel->ddc);
drm_edid_free(panel->drm_edid);
panel->drm_edid = NULL;
--
2.54.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] drm/panel-edp: take i2c adapter module reference
2026-07-16 13:22 [PATCH] drm/panel-edp: take i2c adapter module reference Johan Hovold
@ 2026-07-16 17:27 ` Doug Anderson
0 siblings, 0 replies; 2+ messages in thread
From: Doug Anderson @ 2026-07-16 17:27 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 Thu, Jul 16, 2026 at 6:22 AM Johan Hovold <johan@kernel.org> 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-edp.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Worth adding any "Fixes:" tag? I guess this has been using
of_find_i2c_adapter_by_node() for a long time...
Sashiko-bot review [1] seems right, even though it's pointing out
something that isn't really a new problem and is very much a corner
case where someone is crafting an intentionally ridiculous device
tree. If you agree, I wouldn't mind a followup patch fixing that, too.
;-)
[1] https://lore.kernel.org/r/20260716133420.187131F000E9@smtp.kernel.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-16 17:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-16 13:22 [PATCH] drm/panel-edp: take i2c adapter module reference Johan Hovold
2026-07-16 17:27 ` Doug Anderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox