[Intel-gfx] [PATCH] drm/i915: Fix 'mixing different enum types' warnings in intel_display_power.c

Jani Nikula jani.nikula at intel.com
Wed May 11 14:47:11 UTC 2022


On Tue, 10 May 2022, Imre Deak <imre.deak at intel.com> wrote:
> Fix the following sparse warnings:
>
> drivers/gpu/drm/i915/display/intel_display_power.c:2431:34: warning: mixing different enum types:
> drivers/gpu/drm/i915/display/intel_display_power.c:2431:34:    unsigned int enum intel_display_power_domain
> drivers/gpu/drm/i915/display/intel_display_power.c:2431:34:    int enum port
> drivers/gpu/drm/i915/display/intel_display_power.c:2442:37: warning: mixing different enum types:
> drivers/gpu/drm/i915/display/intel_display_power.c:2442:37:    unsigned int enum intel_display_power_domain
> drivers/gpu/drm/i915/display/intel_display_power.c:2442:37:    int enum port
> drivers/gpu/drm/i915/display/intel_display_power.c:2468:43: warning: mixing different enum types:
> drivers/gpu/drm/i915/display/intel_display_power.c:2468:43:    unsigned int enum intel_display_power_domain
> drivers/gpu/drm/i915/display/intel_display_power.c:2468:43:    unsigned int enum aux_ch
> drivers/gpu/drm/i915/display/intel_display_power.c:2479:35: warning: mixing different enum types:
> drivers/gpu/drm/i915/display/intel_display_power.c:2479:35:    unsigned int enum intel_display_power_domain
> drivers/gpu/drm/i915/display/intel_display_power.c:2479:35:    unsigned int enum aux_ch
>
> Fixes: 979e1b32e0e2 ("drm/i915: Sanitize the port -> DDI/AUX power domain mapping for each platform")
> Reported-by: Jani Nikula <jani.nikula at intel.com>
> Cc: Jouni Högander <jouni.hogander at intel.com>
> Signed-off-by: Imre Deak <imre.deak at intel.com>

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

> ---
>  drivers/gpu/drm/i915/display/intel_display_power.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c
> index 1d9bd5808849f..949edc983a169 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> @@ -2428,7 +2428,7 @@ intel_display_power_ddi_io_domain(struct drm_i915_private *i915, enum port port)
>  	if (drm_WARN_ON(&i915->drm, !domains) || domains->ddi_io == POWER_DOMAIN_INVALID)
>  		return POWER_DOMAIN_PORT_DDI_IO_A;
>  
> -	return domains->ddi_io + port - domains->port_start;
> +	return domains->ddi_io + (int)(port - domains->port_start);
>  }
>  
>  enum intel_display_power_domain
> @@ -2439,7 +2439,7 @@ intel_display_power_ddi_lanes_domain(struct drm_i915_private *i915, enum port po
>  	if (drm_WARN_ON(&i915->drm, !domains) || domains->ddi_lanes == POWER_DOMAIN_INVALID)
>  		return POWER_DOMAIN_PORT_DDI_LANES_A;
>  
> -	return domains->ddi_lanes + port - domains->port_start;
> +	return domains->ddi_lanes + (int)(port - domains->port_start);
>  }
>  
>  static const struct intel_ddi_port_domains *
> @@ -2465,7 +2465,7 @@ intel_display_power_legacy_aux_domain(struct drm_i915_private *i915, enum aux_ch
>  	if (drm_WARN_ON(&i915->drm, !domains) || domains->aux_legacy_usbc == POWER_DOMAIN_INVALID)
>  		return POWER_DOMAIN_AUX_A;
>  
> -	return domains->aux_legacy_usbc + aux_ch - domains->aux_ch_start;
> +	return domains->aux_legacy_usbc + (int)(aux_ch - domains->aux_ch_start);
>  }
>  
>  enum intel_display_power_domain
> @@ -2476,5 +2476,5 @@ intel_display_power_tbt_aux_domain(struct drm_i915_private *i915, enum aux_ch au
>  	if (drm_WARN_ON(&i915->drm, !domains) || domains->aux_tbt == POWER_DOMAIN_INVALID)
>  		return POWER_DOMAIN_AUX_TBT1;
>  
> -	return domains->aux_tbt + aux_ch - domains->aux_ch_start;
> +	return domains->aux_tbt + (int)(aux_ch - domains->aux_ch_start);
>  }

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the Intel-gfx mailing list