On Mon, 13 Sep 2021, Ville Syrjala <ville.syrjala@xxxxxxxxxxxxxxx> wrote: > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > Add the _if_enabled() counterpart to with_intel_display_power(). > > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> Reviewed-by: Jani Nikula <jani.nikula@xxxxxxxxx> Looks like there's plenty of code that could use this. > --- > drivers/gpu/drm/i915/display/intel_display_power.h | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/gpu/drm/i915/display/intel_display_power.h b/drivers/gpu/drm/i915/display/intel_display_power.h > index 978531841fa3..0612e4b6e3c8 100644 > --- a/drivers/gpu/drm/i915/display/intel_display_power.h > +++ b/drivers/gpu/drm/i915/display/intel_display_power.h > @@ -410,6 +410,10 @@ void gen9_dbuf_slices_update(struct drm_i915_private *dev_priv, > for ((wf) = intel_display_power_get((i915), (domain)); (wf); \ > intel_display_power_put_async((i915), (domain), (wf)), (wf) = 0) > > +#define with_intel_display_power_if_enabled(i915, domain, wf) \ > + for ((wf) = intel_display_power_get_if_enabled((i915), (domain)); (wf); \ > + intel_display_power_put_async((i915), (domain), (wf)), (wf) = 0) > + > void chv_phy_powergate_lanes(struct intel_encoder *encoder, > bool override, unsigned int mask); > bool chv_phy_powergate_ch(struct drm_i915_private *dev_priv, enum dpio_phy phy, -- Jani Nikula, Intel Open Source Graphics Center