[PATCH v2 5/6] drm/i915/audio: be explicit about intel_wakeref_t conversions

Rodrigo Vivi rodrigo.vivi at intel.com
Thu Sep 26 20:49:50 UTC 2024


On Wed, Sep 18, 2024 at 08:35:47PM +0300, Jani Nikula wrote:
> Use explicit casts to convert between intel_wakeref_t and unsigned long,
> to not rely on intel_wakeref_t underlying type remaining unsigned long,
> allowing us to change it as needed. (And yes, this is indeed preparation
> for changing the typedef for intel_wakeref_t.)

Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>

> 
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_audio.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c
> index f5e7eefab2f1..32aa9ec1a204 100644
> --- a/drivers/gpu/drm/i915/display/intel_audio.c
> +++ b/drivers/gpu/drm/i915/display/intel_audio.c
> @@ -982,12 +982,12 @@ static unsigned long i915_audio_component_get_power(struct device *kdev)
>  {
>  	struct intel_display *display = to_intel_display(kdev);
>  	struct drm_i915_private *i915 = to_i915(display->drm);
> -	intel_wakeref_t ret;
> +	intel_wakeref_t wakeref;
>  
>  	/* Catch potential impedance mismatches before they occur! */
>  	BUILD_BUG_ON(sizeof(intel_wakeref_t) > sizeof(unsigned long));
>  
> -	ret = intel_display_power_get(i915, POWER_DOMAIN_AUDIO_PLAYBACK);
> +	wakeref = intel_display_power_get(i915, POWER_DOMAIN_AUDIO_PLAYBACK);
>  
>  	if (i915->display.audio.power_refcount++ == 0) {
>  		if (DISPLAY_VER(i915) >= 9) {
> @@ -1007,7 +1007,7 @@ static unsigned long i915_audio_component_get_power(struct device *kdev)
>  				     0, AUD_PIN_BUF_ENABLE);
>  	}
>  
> -	return ret;
> +	return (unsigned long)wakeref;
>  }
>  
>  static void i915_audio_component_put_power(struct device *kdev,
> @@ -1015,13 +1015,14 @@ static void i915_audio_component_put_power(struct device *kdev,
>  {
>  	struct intel_display *display = to_intel_display(kdev);
>  	struct drm_i915_private *i915 = to_i915(display->drm);
> +	intel_wakeref_t wakeref = (intel_wakeref_t)cookie;
>  
>  	/* Stop forcing CDCLK to 2*BCLK if no need for audio to be powered. */
>  	if (--i915->display.audio.power_refcount == 0)
>  		if (IS_GEMINILAKE(i915))
>  			glk_force_audio_cdclk(i915, false);
>  
> -	intel_display_power_put(i915, POWER_DOMAIN_AUDIO_PLAYBACK, cookie);
> +	intel_display_power_put(i915, POWER_DOMAIN_AUDIO_PLAYBACK, wakeref);
>  }
>  
>  static void i915_audio_component_codec_wake_override(struct device *kdev,
> -- 
> 2.39.2
> 


More information about the Intel-xe mailing list