Re: [PATCH v3 2/5] drm/i915: fix HPD IRQ reenable work cancelation

Jani Nikula
2014-08-18T12:25:23Z

On Mon, 18 Aug 2014, Imre Deak <imre.deak@intel.com> wrote:
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 390ccc2..8a5a03f 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -1189,8 +1189,8 @@ static void i915_hotplug_work_func(struct work_struct *work)
> * some connectors */
> if (hpd_disabled) {
> drm_kms_helper_poll_enable(dev);
> - mod_timer(&dev_priv->hotplug_reenable_timer,
> - jiffies + msecs_to_jiffies(I915_REENABLE_HOTPLUG_DELAY));
> + schedule_delayed_work(&dev_priv->hotplug_reenable_work,
> + msecs_to_jiffies(I915_REENABLE_HOTPLUG_DELAY));
> }

As we discussed face to face, there's a semantic change here, and a
lesson worth repeating on the list. If the timer is pending, mod_timer()
will update the expiry time. However, if the delayed work is pending,
schedule_delayed_work() will *not* update the expiry time.

I guess you need to be bitten by this to remember... been there done
that. ;) Happily there's no need to work around this anymore since

commit 8376fe22c7e79c7e90857d39f82aeae6cad6c4b8
Author: Tejun Heo <tj@kernel.org>
Date: Fri Aug 3 10:30:47 2012 -0700

workqueue: implement mod_delayed_work[_on]()

and you can use mod_delayed_work().

BR,
Jani.

--
Jani Nikula, Intel Open Source Technology Center