[PATCH 6/7] drm/i915/dmc: Extract is_event_handler()
Luca Coelho
luca at coelho.fi
Tue May 13 11:57:59 UTC 2025
On Tue, 2025-05-13 at 14:52 +0300, Luca Coelho wrote:
> On Mon, 2025-05-12 at 13:33 +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> >
> > Extract the helper to determine if the mmio reg+data are the
> > event handler register (DMC_EVT_CTL) for a specific event.
> > We'll have another use for this for runtime event handler
> > enable/disable.
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> > ---
> > drivers/gpu/drm/i915/display/intel_dmc.c | 13 +++++++++++--
> > 1 file changed, 11 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_dmc.c b/drivers/gpu/drm/i915/display/intel_dmc.c
> > index 238f3cda400c..d758032d1af6 100644
> > --- a/drivers/gpu/drm/i915/display/intel_dmc.c
> > +++ b/drivers/gpu/drm/i915/display/intel_dmc.c
> > @@ -564,6 +564,15 @@ static bool is_dmc_evt_htp_reg(struct intel_display *display,
> > return offset >= start && offset < end;
> > }
> >
> > +static bool is_event_handler(struct intel_display *display,
> > + enum intel_dmc_id dmc_id,
> > + unsigned int event_id,
> > + i915_reg_t reg, u32 data)
> > +{
> > + return is_dmc_evt_ctl_reg(display, dmc_id, reg) &&
> > + REG_FIELD_GET(DMC_EVT_CTL_EVENT_ID_MASK, data) == event_id;
> > +}
> > +
>
> I'm not sure we're getting much with this change in terms of
> readability. Are you really going to be using this many more times
> later?
>
> The amount of arguments you pass to this function for these simple
> checks seems to add almost as much clutter as the original, no?
>
> If the goal is really readability, maybe a macro would be better.
Never mind. Now I see how you are using it in the next patch and it
makes sense as it is.
Reviewed-by: Luca Coelho <luciano.coelho at intel.com>
--
Cheers,
Luca.
More information about the Intel-gfx
mailing list