drm/omap: Remove enable checks from display .enable() and .remove()

The displays (connectors, panels and encoders) bail out from their
.enable() and .disable() handlers if the dss device is already enabled
or disabled. Those safety checks are not needed when the functions are
called through the omapdss_device_ops, as the .enable() and .disable()
handlers are called from the DRM atomic helpers that already guarantee
that no double enabling or disabling can occur.

However, the handlers are also called directly from the .remove()
handler. While this shouldn't be needed either as the modules can't be
removed as long as the device is in use, it's still a good practice to
disable the device explicitly. There is currently a safety check in
.remove() in some drivers but not all of them.

Remove the safety checks from the .enable() and .disable() handlers, and
add missing ones in the .remove() handler.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
此提交包含在:
Laurent Pinchart
2018-09-08 11:45:14 +03:00
提交者 Tomi Valkeinen
父節點 b49a2139ba
當前提交 3f3623dd0f
共有 14 個檔案被更改,包括 25 行新增64 行删除

查看文件

@@ -46,9 +46,6 @@ static void tvc_disable(struct omap_dss_device *dssdev)
{
struct omap_dss_device *src = dssdev->src;
if (!omapdss_device_is_enabled(dssdev))
return;
src->ops->disable(src);
}
@@ -92,7 +89,8 @@ static int __exit tvc_remove(struct platform_device *pdev)
omapdss_device_unregister(&ddata->dssdev);
tvc_disable(dssdev);
if (omapdss_device_is_enabled(dssdev))
tvc_disable(dssdev);
return 0;
}

查看文件

@@ -57,9 +57,6 @@ static void dvic_disable(struct omap_dss_device *dssdev)
{
struct omap_dss_device *src = dssdev->src;
if (!omapdss_device_is_enabled(dssdev))
return;
src->ops->disable(src);
}
@@ -282,7 +279,8 @@ static int __exit dvic_remove(struct platform_device *pdev)
omapdss_device_unregister(&ddata->dssdev);
dvic_disable(dssdev);
if (omapdss_device_is_enabled(dssdev))
dvic_disable(dssdev);
i2c_put_adapter(ddata->i2c_adapter);

查看文件

@@ -52,9 +52,6 @@ static void hdmic_disable(struct omap_dss_device *dssdev)
{
struct omap_dss_device *src = dssdev->src;
if (!omapdss_device_is_enabled(dssdev))
return;
src->ops->disable(src);
}
@@ -179,7 +176,8 @@ static int __exit hdmic_remove(struct platform_device *pdev)
omapdss_device_unregister(&ddata->dssdev);
hdmic_disable(dssdev);
if (omapdss_device_is_enabled(dssdev))
hdmic_disable(dssdev);
return 0;
}

查看文件

@@ -49,9 +49,6 @@ static int opa362_enable(struct omap_dss_device *dssdev)
dev_dbg(dssdev->dev, "enable\n");
if (omapdss_device_is_enabled(dssdev))
return 0;
r = src->ops->enable(src);
if (r)
return r;
@@ -71,9 +68,6 @@ static void opa362_disable(struct omap_dss_device *dssdev)
dev_dbg(dssdev->dev, "disable\n");
if (!omapdss_device_is_enabled(dssdev))
return;
if (ddata->enable_gpio)
gpiod_set_value_cansleep(ddata->enable_gpio, 0);

查看文件

@@ -42,9 +42,6 @@ static int tfp410_enable(struct omap_dss_device *dssdev)
struct omap_dss_device *src = dssdev->src;
int r;
if (omapdss_device_is_enabled(dssdev))
return 0;
r = src->ops->enable(src);
if (r)
return r;
@@ -62,9 +59,6 @@ static void tfp410_disable(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *src = dssdev->src;
if (!omapdss_device_is_enabled(dssdev))
return;
if (ddata->pd_gpio)
gpiod_set_value_cansleep(ddata->pd_gpio, 0);

查看文件

@@ -72,9 +72,6 @@ static void panel_dpi_disable(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *src = dssdev->src;
if (!omapdss_device_is_enabled(dssdev))
return;
backlight_disable(ddata->backlight);
gpiod_set_value_cansleep(ddata->enable_gpio, 0);
@@ -182,7 +179,8 @@ static int __exit panel_dpi_remove(struct platform_device *pdev)
omapdss_device_unregister(dssdev);
panel_dpi_disable(dssdev);
if (omapdss_device_is_enabled(dssdev))
panel_dpi_disable(dssdev);
return 0;
}

查看文件

@@ -829,11 +829,9 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
src->ops->dsi.bus_lock(src);
if (omapdss_device_is_enabled(dssdev)) {
r = dsicm_wake_up(ddata);
if (!r)
dsicm_power_off(ddata);
}
r = dsicm_wake_up(ddata);
if (!r)
dsicm_power_off(ddata);
src->ops->dsi.bus_unlock(src);
@@ -1367,7 +1365,8 @@ static int __exit dsicm_remove(struct platform_device *pdev)
omapdss_device_unregister(dssdev);
dsicm_disable(dssdev);
if (omapdss_device_is_enabled(dssdev))
dsicm_disable(dssdev);
omapdss_device_disconnect(dssdev->src, dssdev);
sysfs_remove_group(&pdev->dev.kobj, &dsicm_attr_group);

查看文件

@@ -144,9 +144,6 @@ static void lb035q02_disable(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *src = dssdev->src;
if (!omapdss_device_is_enabled(dssdev))
return;
if (ddata->enable_gpio)
gpiod_set_value_cansleep(ddata->enable_gpio, 0);
@@ -235,7 +232,8 @@ static int lb035q02_panel_spi_remove(struct spi_device *spi)
omapdss_device_unregister(dssdev);
lb035q02_disable(dssdev);
if (omapdss_device_is_enabled(dssdev))
lb035q02_disable(dssdev);
return 0;
}

查看文件

@@ -138,9 +138,6 @@ static void nec_8048_disable(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *src = dssdev->src;
if (!omapdss_device_is_enabled(dssdev))
return;
gpiod_set_value_cansleep(ddata->res_gpio, 0);
src->ops->disable(src);
@@ -226,7 +223,8 @@ static int nec_8048_remove(struct spi_device *spi)
omapdss_device_unregister(dssdev);
nec_8048_disable(dssdev);
if (omapdss_device_is_enabled(dssdev))
nec_8048_disable(dssdev);
return 0;
}

查看文件

@@ -97,9 +97,6 @@ static void sharp_ls_disable(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *src = dssdev->src;
if (!omapdss_device_is_enabled(dssdev))
return;
if (ddata->ini_gpio)
gpiod_set_value_cansleep(ddata->ini_gpio, 0);
@@ -233,7 +230,8 @@ static int __exit sharp_ls_remove(struct platform_device *pdev)
omapdss_device_unregister(dssdev);
sharp_ls_disable(dssdev);
if (omapdss_device_is_enabled(dssdev))
sharp_ls_disable(dssdev);
return 0;
}

查看文件

@@ -605,9 +605,6 @@ static void acx565akm_disable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
if (!omapdss_device_is_enabled(dssdev))
return;
mutex_lock(&ddata->mutex);
acx565akm_panel_power_off(dssdev);
mutex_unlock(&ddata->mutex);
@@ -750,7 +747,8 @@ static int acx565akm_remove(struct spi_device *spi)
omapdss_device_unregister(dssdev);
acx565akm_disable(dssdev);
if (omapdss_device_is_enabled(dssdev))
acx565akm_disable(dssdev);
return 0;
}

查看文件

@@ -270,9 +270,6 @@ static void td028ttec1_panel_disable(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *src = dssdev->src;
if (!omapdss_device_is_enabled(dssdev))
return;
dev_dbg(dssdev->dev, "td028ttec1_panel_disable()\n");
jbt_ret_write_0(ddata, JBT_REG_DISPLAY_OFF);
@@ -357,7 +354,8 @@ static int td028ttec1_panel_remove(struct spi_device *spi)
omapdss_device_unregister(dssdev);
td028ttec1_panel_disable(dssdev);
if (omapdss_device_is_enabled(dssdev))
td028ttec1_panel_disable(dssdev);
return 0;
}

查看文件

@@ -350,9 +350,6 @@ static void tpo_td043_disable(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *src = dssdev->src;
if (!omapdss_device_is_enabled(dssdev))
return;
src->ops->disable(src);
if (!ddata->spi_suspended)
@@ -457,7 +454,8 @@ static int tpo_td043_remove(struct spi_device *spi)
omapdss_device_unregister(dssdev);
tpo_td043_disable(dssdev);
if (omapdss_device_is_enabled(dssdev))
tpo_td043_disable(dssdev);
sysfs_remove_group(&spi->dev.kobj, &tpo_td043_attr_group);