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 <[email protected]>
---
  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 <[email protected]>

Thanks,
Neil

Reply via email to