[PATCH 04/21] drm/omap: Check omap_dss_device type based on the output_type field

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Jun 6 09:36:33 UTC 2018


Various functions that need to differentiate between omap_dss_device
instances corresponding to displays and to internal encoders use the
omap_dss_device.driver field, which is only set for display instances.
This gets in the way of the omap_dss_device operations refactoring.
Replace that with a check based on the output_type field which is set
for all omap_dss_device instances but displays.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/dss/base.c    | 4 ++--
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index cce09a48d769..6a73d3559257 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -165,7 +165,7 @@ struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from,
 		 * Filter out non-display entries if display_only is set, and
 		 * non-output entries if output_only is set.
 		 */
-		if (display_only && !dssdev->driver)
+		if (display_only && dssdev->output_type)
 			continue;
 		if (output_only && (!dssdev->id || !dssdev->next))
 			continue;
@@ -224,7 +224,7 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
 	dev_dbg(src->dev, "disconnect\n");
 
 	if (!omapdss_device_is_connected(dst)) {
-		WARN_ON(!dst->driver);
+		WARN_ON(dst->output_type);
 		return;
 	}
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 3bfb62b28a77..ae30802f2151 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -401,6 +401,12 @@ struct omap_dss_device {
 	unsigned int alias_id;
 
 	enum omap_display_type type;
+	/*
+	 * DSS output type that this device generates (for DSS internal devices)
+	 * or requires (for external encoders). Must be OMAP_DISPLAY_TYPE_NONE
+	 * for display devices (connectors and panels) and to non-zero value for
+	 * all other devices.
+	 */
 	enum omap_display_type output_type;
 
 	const char *name;
-- 
Regards,

Laurent Pinchart



More information about the dri-devel mailing list