Commit 3f3623dd authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen
Browse files

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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Tested-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent b49a2139
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -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,6 +89,7 @@ static int __exit tvc_remove(struct platform_device *pdev)

	omapdss_device_unregister(&ddata->dssdev);

	if (omapdss_device_is_enabled(dssdev))
		tvc_disable(dssdev);

	return 0;
+2 −4
Original line number Diff line number Diff line
@@ -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,6 +279,7 @@ static int __exit dvic_remove(struct platform_device *pdev)

	omapdss_device_unregister(&ddata->dssdev);

	if (omapdss_device_is_enabled(dssdev))
		dvic_disable(dssdev);

	i2c_put_adapter(ddata->i2c_adapter);
+2 −4
Original line number Diff line number Diff line
@@ -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,6 +176,7 @@ static int __exit hdmic_remove(struct platform_device *pdev)

	omapdss_device_unregister(&ddata->dssdev);

	if (omapdss_device_is_enabled(dssdev))
		hdmic_disable(dssdev);

	return 0;
+0 −6
Original line number Diff line number Diff line
@@ -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);

+0 −6
Original line number Diff line number Diff line
@@ -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);

Loading