diff mbox

[2/3] drm/i915: Introduce new intel_output_name()

Message ID 1389113755-2021-2-git-send-email-przanoni@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paulo Zanoni Jan. 7, 2014, 4:55 p.m. UTC
From: Damien Lespiau <damien.lespiau@intel.com>

That we can use for debugging purposes.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 2 files changed, 14 insertions(+)

Comments

Jani Nikula Jan. 8, 2014, 9:51 a.m. UTC | #1
On Tue, 07 Jan 2014, Paulo Zanoni <przanoni@gmail.com> wrote:
> From: Damien Lespiau <damien.lespiau@intel.com>
>
> That we can use for debugging purposes.
>
> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 13 +++++++++++++
>  drivers/gpu/drm/i915/intel_drv.h     |  1 +
>  2 files changed, 14 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 7cc67b3..034952c 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -10253,6 +10253,19 @@ static bool has_edp_a(struct drm_device *dev)
>  	return true;
>  }
>  
> +const char *intel_output_name(int output)
> +{
> +	static const char *names[] = {
> +		"Unused", "Analog", "DVO", "SDVO", "LVDS", "TV", "HDMI",
> +		"DisplayPort", "eDP", "DSI", "Unknown"

Please initialize this with designated initializers:

		[INTEL_OUTPUT_UNUSED] = "Unused",
                [INTEL_OUTPUT_ANALOG] = "Analog",
		...

> +	};
> +
> +	if (output < 0 || output >= ARRAY_SIZE(names))

and also check for names[output] != NULL here (just to be defensive with
the designated initializers).

BR,
Jani.

> +		return "Invalid";
> +
> +	return names[output];
> +}
> +
>  static void intel_setup_outputs(struct drm_device *dev)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 46aea6c..25bbbb5 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -625,6 +625,7 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
>  
>  
>  /* intel_display.c */
> +const char *intel_output_name(int output);
>  int intel_pch_rawclk(struct drm_device *dev);
>  void intel_mark_busy(struct drm_device *dev);
>  void intel_mark_fb_busy(struct drm_i915_gem_object *obj,
> -- 
> 1.8.4.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 7cc67b3..034952c 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -10253,6 +10253,19 @@  static bool has_edp_a(struct drm_device *dev)
 	return true;
 }
 
+const char *intel_output_name(int output)
+{
+	static const char *names[] = {
+		"Unused", "Analog", "DVO", "SDVO", "LVDS", "TV", "HDMI",
+		"DisplayPort", "eDP", "DSI", "Unknown"
+	};
+
+	if (output < 0 || output >= ARRAY_SIZE(names))
+		return "Invalid";
+
+	return names[output];
+}
+
 static void intel_setup_outputs(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 46aea6c..25bbbb5 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -625,6 +625,7 @@  void intel_ddi_get_config(struct intel_encoder *encoder,
 
 
 /* intel_display.c */
+const char *intel_output_name(int output);
 int intel_pch_rawclk(struct drm_device *dev);
 void intel_mark_busy(struct drm_device *dev);
 void intel_mark_fb_busy(struct drm_i915_gem_object *obj,