[Intel-gfx] [PATCH v2 1/2] drm/i915: Wrap our timer_list.expires checking
Tvrtko Ursulin
tvrtko.ursulin at linux.intel.com
Thu Jan 7 09:25:44 UTC 2021
On 06/01/2021 16:36, Chris Wilson wrote:
> Refactor our timer_list.expires checking into its own timer_active()
> helper.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
> drivers/gpu/drm/i915/i915_utils.c | 2 +-
> drivers/gpu/drm/i915/i915_utils.h | 7 ++++++-
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_utils.c b/drivers/gpu/drm/i915/i915_utils.c
> index 4c305d838016..f9e780dee9de 100644
> --- a/drivers/gpu/drm/i915/i915_utils.c
> +++ b/drivers/gpu/drm/i915/i915_utils.c
> @@ -87,7 +87,7 @@ bool i915_error_injected(void)
>
> void cancel_timer(struct timer_list *t)
> {
> - if (!READ_ONCE(t->expires))
> + if (!timer_active(t))
> return;
>
> del_timer(t);
> diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
> index 54773371e6bd..abd4dcd9f79c 100644
> --- a/drivers/gpu/drm/i915/i915_utils.h
> +++ b/drivers/gpu/drm/i915/i915_utils.h
> @@ -438,9 +438,14 @@ static inline void __add_taint_for_CI(unsigned int taint)
> void cancel_timer(struct timer_list *t);
> void set_timer_ms(struct timer_list *t, unsigned long timeout);
>
> +static inline bool timer_active(const struct timer_list *t)
> +{
> + return READ_ONCE(t->expires);
> +}
> +
> static inline bool timer_expired(const struct timer_list *t)
> {
> - return READ_ONCE(t->expires) && !timer_pending(t);
> + return timer_active(t) && !timer_pending(t);
> }
>
> /*
>
Don't know really, it's a bit dodgy to prefix with generic timer_ when
semantics are i915 specific and apply only to timers managed with our
set_timer_ms().
Have it for now and perhaps we can revisit to tidy later.
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Regards,
Tvrtko
More information about the Intel-gfx
mailing list