diff mbox

[1/2] drm: Make the HPD status updates debug logs more readable

Message ID 1355171064-1321-1-git-send-email-damien.lespiau@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Damien Lespiau Dec. 10, 2012, 8:24 p.m. UTC
From: Damien Lespiau <damien.lespiau@intel.com>

Instead of just printing "status updated from 1 to 2", make those enum
numbers immediately readable.

v2: Also patch output_poll_execute() (Daniel Vetter)

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 drivers/gpu/drm/drm_crtc_helper.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

Comments

Jesse Barnes Dec. 10, 2012, 9:12 p.m. UTC | #1
On Mon, 10 Dec 2012 20:24:23 +0000
Damien Lespiau <damien.lespiau@gmail.com> wrote:

> From: Damien Lespiau <damien.lespiau@intel.com>
> 
> Instead of just printing "status updated from 1 to 2", make those enum
> numbers immediately readable.
> 
> v2: Also patch output_poll_execute() (Daniel Vetter)
> 
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
>  drivers/gpu/drm/drm_crtc_helper.c | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
> index 1fe719f..524f0d3 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -950,6 +950,18 @@ void drm_kms_helper_hotplug_event(struct drm_device *dev)
>  }
>  EXPORT_SYMBOL(drm_kms_helper_hotplug_event);
>  
> +static const char *connector_status_str(enum drm_connector_status status)
> +{
> +	switch (status) {
> +	case connector_status_connected:
> +		return "connected";
> +	case connector_status_disconnected:
> +		return "disconnected";
> +	default:
> +		return "unknown";
> +	}
> +}
> +
>  #define DRM_OUTPUT_POLL_PERIOD (10*HZ)
>  static void output_poll_execute(struct work_struct *work)
>  {
> @@ -984,10 +996,11 @@ static void output_poll_execute(struct work_struct *work)
>  			continue;
>  
>  		connector->status = connector->funcs->detect(connector, false);
> -		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n",
> +		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
>  			      connector->base.id,
>  			      drm_get_connector_name(connector),
> -			      old_status, connector->status);
> +			      connector_status_str(old_status),
> +			      connector_status_str(connector->status));
>  		if (old_status != connector->status)
>  			changed = true;
>  	}
> @@ -1062,10 +1075,11 @@ void drm_helper_hpd_irq_event(struct drm_device *dev)
>  		old_status = connector->status;
>  
>  		connector->status = connector->funcs->detect(connector, false);
> -		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n",
> +		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
>  			      connector->base.id,
>  			      drm_get_connector_name(connector),
> -			      old_status, connector->status);
> +			      connector_status_str(old_status),
> +			      connector_status_str(connector->status));
>  		if (old_status != connector->status)
>  			changed = true;
>  	}

Yeah, thanks.

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 1fe719f..524f0d3 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -950,6 +950,18 @@  void drm_kms_helper_hotplug_event(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_kms_helper_hotplug_event);
 
+static const char *connector_status_str(enum drm_connector_status status)
+{
+	switch (status) {
+	case connector_status_connected:
+		return "connected";
+	case connector_status_disconnected:
+		return "disconnected";
+	default:
+		return "unknown";
+	}
+}
+
 #define DRM_OUTPUT_POLL_PERIOD (10*HZ)
 static void output_poll_execute(struct work_struct *work)
 {
@@ -984,10 +996,11 @@  static void output_poll_execute(struct work_struct *work)
 			continue;
 
 		connector->status = connector->funcs->detect(connector, false);
-		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n",
+		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
 			      connector->base.id,
 			      drm_get_connector_name(connector),
-			      old_status, connector->status);
+			      connector_status_str(old_status),
+			      connector_status_str(connector->status));
 		if (old_status != connector->status)
 			changed = true;
 	}
@@ -1062,10 +1075,11 @@  void drm_helper_hpd_irq_event(struct drm_device *dev)
 		old_status = connector->status;
 
 		connector->status = connector->funcs->detect(connector, false);
-		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n",
+		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
 			      connector->base.id,
 			      drm_get_connector_name(connector),
-			      old_status, connector->status);
+			      connector_status_str(old_status),
+			      connector_status_str(connector->status));
 		if (old_status != connector->status)
 			changed = true;
 	}