[PATCH] drm/amd/amdgpu: Simplify switch case statements in amdgpu_connectors.c

Deucher, Alexander Alexander.Deucher at amd.com
Thu Apr 27 19:39:00 UTC 2023


[Public]

> -----Original Message-----
> From: SHANMUGAM, SRINIVASAN
> <SRINIVASAN.SHANMUGAM at amd.com>
> Sent: Thursday, April 27, 2023 11:02 AM
> To: Koenig, Christian <Christian.Koenig at amd.com>; Deucher, Alexander
> <Alexander.Deucher at amd.com>
> Cc: amd-gfx at lists.freedesktop.org; SHANMUGAM, SRINIVASAN
> <SRINIVASAN.SHANMUGAM at amd.com>
> Subject: [PATCH] drm/amd/amdgpu: Simplify switch case statements in
> amdgpu_connectors.c
> 
> Fix the following checkpatch errors:
> 
> ERROR: trailing statements should be on next line
> ERROR: space required after that ',' (ctx:VxV)
> ERROR: code indent should use tabs where possible
> 
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>

I could kind of go either way on these patches.  I guess they fix up the coding style, but they also make a lot of churn in the code.

Acked-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  .../gpu/drm/amd/amdgpu/amdgpu_connectors.c    | 39 ++++++++++++++--
> ---
>  1 file changed, 29 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> index d2abd334b1b5..08a37b7a34f4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> @@ -591,11 +591,20 @@ static int amdgpu_connector_set_property(struct
> drm_connector *connector,
> 
>  		switch (val) {
>  		default:
> -		case DRM_MODE_SCALE_NONE: rmx_type = RMX_OFF;
> break;
> -		case DRM_MODE_SCALE_CENTER: rmx_type =
> RMX_CENTER; break;
> -		case DRM_MODE_SCALE_ASPECT: rmx_type = RMX_ASPECT;
> break;
> -		case DRM_MODE_SCALE_FULLSCREEN: rmx_type =
> RMX_FULL; break;
> +		case DRM_MODE_SCALE_NONE:
> +			rmx_type = RMX_OFF;
> +			break;
> +		case DRM_MODE_SCALE_CENTER:
> +			rmx_type = RMX_CENTER;
> +			break;
> +		case DRM_MODE_SCALE_ASPECT:
> +			rmx_type = RMX_ASPECT;
> +			break;
> +		case DRM_MODE_SCALE_FULLSCREEN:
> +			rmx_type = RMX_FULL;
> +			break;
>  		}
> +
>  		if (amdgpu_encoder->rmx_type == rmx_type)
>  			return 0;
> 
> @@ -797,12 +806,21 @@ static int
> amdgpu_connector_set_lcd_property(struct drm_connector *connector,
>  	}
> 
>  	switch (value) {
> -	case DRM_MODE_SCALE_NONE: rmx_type = RMX_OFF; break;
> -	case DRM_MODE_SCALE_CENTER: rmx_type = RMX_CENTER; break;
> -	case DRM_MODE_SCALE_ASPECT: rmx_type = RMX_ASPECT; break;
> +	case DRM_MODE_SCALE_NONE:
> +		rmx_type = RMX_OFF;
> +		break;
> +	case DRM_MODE_SCALE_CENTER:
> +		rmx_type = RMX_CENTER;
> +		break;
> +	case DRM_MODE_SCALE_ASPECT:
> +		rmx_type = RMX_ASPECT;
> +		break;
>  	default:
> -	case DRM_MODE_SCALE_FULLSCREEN: rmx_type = RMX_FULL;
> break;
> +	case DRM_MODE_SCALE_FULLSCREEN:
> +		rmx_type = RMX_FULL;
> +		break;
>  	}
> +
>  	if (amdgpu_encoder->rmx_type == rmx_type)
>  		return 0;
> 
> @@ -1125,7 +1143,8 @@ amdgpu_connector_dvi_detect(struct
> drm_connector *connector, bool force)
>  					/* assume digital unless load
> detected otherwise */
>  					amdgpu_connector->use_digital =
> true;
>  					lret = encoder_funcs-
> >detect(encoder, connector);
> -					DRM_DEBUG_KMS("load_detect %x
> returned: %x\n",encoder->encoder_type,lret);
> +					DRM_DEBUG_KMS("load_detect %x
> returned: %x\n",
> +						      encoder->encoder_type,
> lret);
>  					if (lret ==
> connector_status_connected)
>  						amdgpu_connector-
> >use_digital = false;
>  				}
> @@ -1989,7 +2008,7 @@ amdgpu_connector_add(struct amdgpu_device
> *adev,
>  	if (amdgpu_connector->hpd.hpd == AMDGPU_HPD_NONE) {
>  		if (i2c_bus->valid) {
>  			connector->polled =
> DRM_CONNECTOR_POLL_CONNECT |
> -			                    DRM_CONNECTOR_POLL_DISCONNECT;
> +
> 	DRM_CONNECTOR_POLL_DISCONNECT;
>  		}
>  	} else
>  		connector->polled = DRM_CONNECTOR_POLL_HPD;
> --
> 2.25.1


More information about the amd-gfx mailing list