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-edp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-edp.c 
b/drivers/gpu/drm/panel/panel-edp.c
index ac815729aa83..522bc665a11a 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -835,7 +835,7 @@ static void panel_edp_put_adapter(void *_adap)
 {
        struct i2c_adapter *adap = _adap;
 
-       put_device(&adap->dev);
+       i2c_put_adapter(adap);
 }
 
 static int panel_edp_probe(struct device *dev, const struct panel_desc *desc,
@@ -880,7 +880,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)
-- 
2.54.0

Reply via email to