lkml.org 
[lkml]   [2012]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 3/3] PM / Sleep: Make __pm_stay_awake() delete wakeup source timers
From
2012/2/15 Rafael J. Wysocki <rjw@sisk.pl>:
...
> --- linux.orig/drivers/base/power/wakeup.c
> +++ linux/drivers/base/power/wakeup.c
> @@ -365,9 +365,15 @@ void __pm_stay_awake(struct wakeup_sourc
>                return;
>
>        spin_lock_irqsave(&ws->lock, flags);
> +
> +       del_timer(&ws->timer);
> +       ws->timer_expires = 0;

timer_expires gets overwritten in wakeup_source_activate, so
__pm_relax followed by __pm_stay_awake is still not safe.



...
> @@ -529,8 +535,12 @@ void __pm_wakeup_event(struct wakeup_sou
>        spin_lock_irqsave(&ws->lock, flags);
>
>        ws->event_count++;
> -       if (!ws->active)
> +       if (ws->active) {
> +               if (!ws->timer_expires)
> +                       goto unlock;
> +       } else {
>                wakeup_source_activate(ws);
> +       }
>
>        if (!msec) {
>                wakeup_source_deactivate(ws);
>

I suggest dropping this and adding:

- if (time_after(expires, ws->timer_expires)) {
+ if (!ws->timer_expires || time_after(expires, ws->timer_expires)) {



--
Arve Hjønnevåg
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-02-16 05:59    [W:0.116 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site