diff mbox

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

Message ID 20180606093650.26034-5-laurent.pinchart@ideasonboard.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Pinchart June 6, 2018, 9:36 a.m. UTC
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@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(-)

Comments

Sebastian Reichel June 11, 2018, 10:48 p.m. UTC | #1
Hi,

On Wed, Jun 06, 2018 at 12:36:33PM +0300, Laurent Pinchart wrote:
> 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@ideasonboard.com>
> ---

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

-- Sebastian

>  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
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

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;