Message ID | 9d2a2c2399e70f36e0d68d88136ac688f02988fe.1726680898.git.jani.nikula@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/i915: wakeref fixes and improvements | expand |
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@intel.com> > > Signed-off-by: Jani Nikula <jani.nikula@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 >
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,
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.) Signed-off-by: Jani Nikula <jani.nikula@intel.com> --- drivers/gpu/drm/i915/display/intel_audio.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)