diff mbox series

[09/15] drm/i915/tv: Use drm_mode_set_name() to name TV modes

Message ID 20181112170000.27531-11-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Fix TV encoder support | expand

Commit Message

Ville Syrjala Nov. 12, 2018, 4:59 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

No point in storing the mode names in the array. drm_mode_set_name()
will give us the same names without wasting space for these string
constants.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_tv.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

Comments

Imre Deak Jan. 22, 2019, 2:45 p.m. UTC | #1
On Mon, Nov 12, 2018 at 06:59:54PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> No point in storing the mode names in the array. drm_mode_set_name()
> will give us the same names without wasting space for these string
> constants.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Imre Deak <imre.deak@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_tv.c | 21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> index 54189080cfb1..433f538261c1 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -1313,16 +1313,15 @@ intel_tv_detect(struct drm_connector *connector,
>  }
>  
>  static const struct input_res {
> -	const char *name;
> -	int w, h;
> +	u16 w, h;
>  } input_res_table[] = {
> -	{"640x480", 640, 480},
> -	{"800x600", 800, 600},
> -	{"1024x768", 1024, 768},
> -	{"1280x1024", 1280, 1024},
> -	{"848x480", 848, 480},
> -	{"1280x720", 1280, 720},
> -	{"1920x1080", 1920, 1080},
> +	{ 640, 480 },
> +	{ 800, 600 },
> +	{ 1024, 768 },
> +	{ 1280, 1024 },
> +	{ 848, 480 },
> +	{ 1280, 720 },
> +	{ 1920, 1080 },
>  };
>  
>  /* Choose preferred mode according to line number of TV format */
> @@ -1373,7 +1372,6 @@ intel_tv_get_modes(struct drm_connector *connector)
>  		mode_ptr = drm_mode_create(connector->dev);
>  		if (!mode_ptr)
>  			continue;
> -		strlcpy(mode_ptr->name, input->name, DRM_DISPLAY_MODE_LEN);
>  
>  		mode_ptr->hdisplay = hactive_s;
>  		mode_ptr->hsync_start = hactive_s + 1;
> @@ -1395,6 +1393,9 @@ intel_tv_get_modes(struct drm_connector *connector)
>  		mode_ptr->clock = (int) tmp;
>  
>  		intel_tv_set_mode_type(mode_ptr, tv_mode);
> +
> +		drm_mode_set_name(mode_ptr);
> +
>  		drm_mode_probed_add(connector, mode_ptr);
>  		count++;
>  	}
> -- 
> 2.18.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index 54189080cfb1..433f538261c1 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -1313,16 +1313,15 @@  intel_tv_detect(struct drm_connector *connector,
 }
 
 static const struct input_res {
-	const char *name;
-	int w, h;
+	u16 w, h;
 } input_res_table[] = {
-	{"640x480", 640, 480},
-	{"800x600", 800, 600},
-	{"1024x768", 1024, 768},
-	{"1280x1024", 1280, 1024},
-	{"848x480", 848, 480},
-	{"1280x720", 1280, 720},
-	{"1920x1080", 1920, 1080},
+	{ 640, 480 },
+	{ 800, 600 },
+	{ 1024, 768 },
+	{ 1280, 1024 },
+	{ 848, 480 },
+	{ 1280, 720 },
+	{ 1920, 1080 },
 };
 
 /* Choose preferred mode according to line number of TV format */
@@ -1373,7 +1372,6 @@  intel_tv_get_modes(struct drm_connector *connector)
 		mode_ptr = drm_mode_create(connector->dev);
 		if (!mode_ptr)
 			continue;
-		strlcpy(mode_ptr->name, input->name, DRM_DISPLAY_MODE_LEN);
 
 		mode_ptr->hdisplay = hactive_s;
 		mode_ptr->hsync_start = hactive_s + 1;
@@ -1395,6 +1393,9 @@  intel_tv_get_modes(struct drm_connector *connector)
 		mode_ptr->clock = (int) tmp;
 
 		intel_tv_set_mode_type(mode_ptr, tv_mode);
+
+		drm_mode_set_name(mode_ptr);
+
 		drm_mode_probed_add(connector, mode_ptr);
 		count++;
 	}