drm/i915: Fix 'mixing different enum types' warnings in intel_display_power.c
authorImre Deak <imre.deak@intel.com>
Tue, 10 May 2022 11:49:57 +0000 (14:49 +0300)
committerImre Deak <imre.deak@intel.com>
Thu, 12 May 2022 11:03:27 +0000 (14:03 +0300)
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@intel.com>
Cc: Jouni Högander <jouni.hogander@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220510114957.406070-1-imre.deak@intel.com
drivers/gpu/drm/i915/display/intel_display_power.c

index 15b15f4..5eb8d63 100644 (file)
@@ -2430,7 +2430,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
@@ -2441,7 +2441,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 *
@@ -2467,7 +2467,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
@@ -2478,5 +2478,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);
 }