diff mbox series

drm: Use drm_mode_is_420_only() instead of open coding it

Message ID 20210504102742.7005-1-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm: Use drm_mode_is_420_only() instead of open coding it | expand

Commit Message

Ville Syrjälä May 4, 2021, 10:27 a.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Replace the open coded drm_mode_is_420_only() with the real thing.

No functional changes.

Cc: Werner Sembach <wse@tuxedocomputers.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_modes.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

Comments

Jani Nikula May 4, 2021, 12:35 p.m. UTC | #1
On Tue, 04 May 2021, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Replace the open coded drm_mode_is_420_only() with the real thing.
>
> No functional changes.
>
> Cc: Werner Sembach <wse@tuxedocomputers.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/drm_modes.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index 33a93fa24eb1..12fcbb7ce179 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -1176,16 +1176,11 @@ enum drm_mode_status
>  drm_mode_validate_ycbcr420(const struct drm_display_mode *mode,
>  			   struct drm_connector *connector)
>  {
> -	u8 vic = drm_match_cea_mode(mode);
> -	enum drm_mode_status status = MODE_OK;
> -	struct drm_hdmi_info *hdmi = &connector->display_info.hdmi;
> -
> -	if (test_bit(vic, hdmi->y420_vdb_modes)) {
> -		if (!connector->ycbcr_420_allowed)
> -			status = MODE_NO_420;
> -	}
> +	if (!connector->ycbcr_420_allowed &&
> +	    drm_mode_is_420_only(&connector->display_info, mode))
> +		return MODE_NO_420;
>  
> -	return status;
> +	return MODE_OK;
>  }
>  EXPORT_SYMBOL(drm_mode_validate_ycbcr420);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 33a93fa24eb1..12fcbb7ce179 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1176,16 +1176,11 @@  enum drm_mode_status
 drm_mode_validate_ycbcr420(const struct drm_display_mode *mode,
 			   struct drm_connector *connector)
 {
-	u8 vic = drm_match_cea_mode(mode);
-	enum drm_mode_status status = MODE_OK;
-	struct drm_hdmi_info *hdmi = &connector->display_info.hdmi;
-
-	if (test_bit(vic, hdmi->y420_vdb_modes)) {
-		if (!connector->ycbcr_420_allowed)
-			status = MODE_NO_420;
-	}
+	if (!connector->ycbcr_420_allowed &&
+	    drm_mode_is_420_only(&connector->display_info, mode))
+		return MODE_NO_420;
 
-	return status;
+	return MODE_OK;
 }
 EXPORT_SYMBOL(drm_mode_validate_ycbcr420);