Skip to contentSkip to conversation

drm/tegra: Use i2c_put_adapter() instead of put_device()

PATCH In review Thierry Reding 2 participants 2 messages Apr 8, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/tegra: Use i2c_put_adapter() instead of put_device()

From: Thierry Reding <[email protected]>

In order to properly release the I2C adapter used for DDC/CI, use the i2c_put_adapter() function provided by the I2C subsystem rather than the put_device() function which doesn't include code to drop a reference to the adapter's owner module.

---
 drivers/gpu/drm/tegra/output.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tegra/output.c +1 -1
index a264259b97a2..136fd2f56af0 100644
@@ -177,7 +177,7 @@ void tegra_output_remove(struct tegra_output *output)
 		free_irq(output->hpd_irq, output);
 
 	if (output->ddc)
-		put_device(&output->ddc->dev);
+		i2c_put_adapter(output->ddc);
 }
 
 int tegra_output_init(struct drm_device *drm, struct tegra_output *output)
Signature · 1 line
2.24.1
#1 lore raw

Hi Thierry

Quoted 6 lines · Thierry Reding

From: Thierry Reding <[email protected]>

In order to properly release the I2C adapter used for DDC/CI, use the i2c_put_adapter() function provided by the I2C subsystem rather than the put_device() function which doesn't include code to drop a reference to the adapter's owner module.

Is this a problem for the other users too?

$ cd drivers/gpu/drm; git grep put_device | grep ddc

exynos/exynos_hdmi.c: put_device(&hdata->ddc_adpt->dev);
exynos/exynos_hdmi.c: put_device(&hdata->ddc_adpt->dev);
panel/panel-simple.c: put_device(&panel->ddc->dev);
panel/panel-simple.c: put_device(&panel->ddc->dev);
tegra/output.c: put_device(&output->ddc->dev);
vc4/vc4_hdmi.c: put_device(&hdmi->ddc->dev);
vc4/vc4_hdmi.c: put_device(&hdmi->ddc->dev);

??

Sam

Quoted 26 lines
---
 drivers/gpu/drm/tegra/output.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tegra/output.c +1 -1
index a264259b97a2..136fd2f56af0 100644
@@ -177,7 +177,7 @@ void tegra_output_remove(struct tegra_output *output)
 		free_irq(output->hpd_irq, output);
 
 	if (output->ddc)
-		put_device(&output->ddc->dev);
+		i2c_put_adapter(output->ddc);
 }
 
 int tegra_output_init(struct drm_device *drm, struct tegra_output *output)
Signature · 6 lines
2.24.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel