diff mbox series

[v4,3/4] drm/edid: Throw away the dummy VIC 0 cea mode

Message ID 20191213174348.27261-4-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/edid: Add new modes from CTA-861-G | expand

Commit Message

Ville Syrjälä Dec. 13, 2019, 5:43 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Now that the cea mode handling is not 100% tied to the single
array the dummy VIC 0 mode is pretty much pointles. Throw it
out.

v2: Rebase

Cc: Tom Anderson <thomasanderson@google.com>
Cc: Hans Verkuil <hansverk@cisco.com>
Cc: Manasi Navare <manasi.d.navare@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_edid.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

Comments

Tom Anderson Dec. 13, 2019, 9:05 p.m. UTC | #1
lgtm

Reviewed-by: Thomas Anderson <thomasanderson@google.com>

On Fri, Dec 13, 2019 at 07:43:47PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Now that the cea mode handling is not 100% tied to the single
> array the dummy VIC 0 mode is pretty much pointles. Throw it
> out.
> 
> v2: Rebase
> 
> Cc: Tom Anderson <thomasanderson@google.com>
> Cc: Hans Verkuil <hansverk@cisco.com>
> Cc: Manasi Navare <manasi.d.navare@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 2787ad0ef881..8bc69da53c2e 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -714,9 +714,7 @@ static const struct minimode extra_modes[] = {
>   *
>   * Do not access directly, instead always use cea_mode_for_vic().
>   */
> -static const struct drm_display_mode edid_cea_modes_0[] = {
> -	/* 0 - dummy, VICs start at 1 */
> -	{ },
> +static const struct drm_display_mode edid_cea_modes_1[] = {
>  	/* 1 - 640x480@60Hz 4:3 */
>  	{ DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175, 640, 656,
>  		   752, 800, 0, 480, 490, 492, 525, 0,
> @@ -3215,10 +3213,8 @@ static u8 *drm_find_cea_extension(const struct edid *edid)
>  
>  static const struct drm_display_mode *cea_mode_for_vic(u8 vic)
>  {
> -	if (!vic)
> -		return NULL;
> -	if (vic < ARRAY_SIZE(edid_cea_modes_0))
> -		return &edid_cea_modes_0[vic];
> +	if (vic >= 1 && vic < 1 + ARRAY_SIZE(edid_cea_modes_1))
> +		return &edid_cea_modes_1[vic - 1];
>  	if (vic >= 193 && vic < 193 + ARRAY_SIZE(edid_cea_modes_193))
>  		return &edid_cea_modes_193[vic - 193];
>  	return NULL;
> @@ -3231,7 +3227,7 @@ static u8 cea_num_vics(void)
>  
>  static u8 cea_next_vic(u8 vic)
>  {
> -	if (++vic == ARRAY_SIZE(edid_cea_modes_0))
> +	if (++vic == 1 + ARRAY_SIZE(edid_cea_modes_1))
>  		vic = 193;
>  	return vic;
>  }
> -- 
> 2.23.0
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 2787ad0ef881..8bc69da53c2e 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -714,9 +714,7 @@  static const struct minimode extra_modes[] = {
  *
  * Do not access directly, instead always use cea_mode_for_vic().
  */
-static const struct drm_display_mode edid_cea_modes_0[] = {
-	/* 0 - dummy, VICs start at 1 */
-	{ },
+static const struct drm_display_mode edid_cea_modes_1[] = {
 	/* 1 - 640x480@60Hz 4:3 */
 	{ DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175, 640, 656,
 		   752, 800, 0, 480, 490, 492, 525, 0,
@@ -3215,10 +3213,8 @@  static u8 *drm_find_cea_extension(const struct edid *edid)
 
 static const struct drm_display_mode *cea_mode_for_vic(u8 vic)
 {
-	if (!vic)
-		return NULL;
-	if (vic < ARRAY_SIZE(edid_cea_modes_0))
-		return &edid_cea_modes_0[vic];
+	if (vic >= 1 && vic < 1 + ARRAY_SIZE(edid_cea_modes_1))
+		return &edid_cea_modes_1[vic - 1];
 	if (vic >= 193 && vic < 193 + ARRAY_SIZE(edid_cea_modes_193))
 		return &edid_cea_modes_193[vic - 193];
 	return NULL;
@@ -3231,7 +3227,7 @@  static u8 cea_num_vics(void)
 
 static u8 cea_next_vic(u8 vic)
 {
-	if (++vic == ARRAY_SIZE(edid_cea_modes_0))
+	if (++vic == 1 + ARRAY_SIZE(edid_cea_modes_1))
 		vic = 193;
 	return vic;
 }