Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 305832
b: refs/heads/master
c: 60af106
h: refs/heads/master
v: v3
  • Loading branch information
Rafael J. Wysocki committed May 1, 2012
1 parent 688645d commit df01ca1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 52d136cc2cf6659ee247dbcc88c9e7bd7428ad06
refs/heads/master: 60af1066913162c5dd13fad3b872a67b1eb7da0f
16 changes: 13 additions & 3 deletions trunk/drivers/base/power/wakeup.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

#include "power.h"

#define TIMEOUT 100

/*
* If set, the suspend/hibernate code will abort transitions to a sleep state
* if wakeup events are registered during or immediately before the transition.
Expand Down Expand Up @@ -52,6 +50,8 @@ static void pm_wakeup_timer_fn(unsigned long data);

static LIST_HEAD(wakeup_sources);

static DECLARE_WAIT_QUEUE_HEAD(wakeup_count_wait_queue);

/**
* wakeup_source_prepare - Prepare a new wakeup source for initialization.
* @ws: Wakeup source to prepare.
Expand Down Expand Up @@ -442,6 +442,7 @@ EXPORT_SYMBOL_GPL(pm_stay_awake);
*/
static void wakeup_source_deactivate(struct wakeup_source *ws)
{
unsigned int cnt, inpr;
ktime_t duration;
ktime_t now;

Expand Down Expand Up @@ -476,6 +477,10 @@ static void wakeup_source_deactivate(struct wakeup_source *ws)
* couter of wakeup events in progress simultaneously.
*/
atomic_add(MAX_IN_PROGRESS, &combined_event_count);

split_counters(&cnt, &inpr);
if (!inpr && waitqueue_active(&wakeup_count_wait_queue))
wake_up(&wakeup_count_wait_queue);
}

/**
Expand Down Expand Up @@ -667,14 +672,19 @@ bool pm_wakeup_pending(void)
bool pm_get_wakeup_count(unsigned int *count)
{
unsigned int cnt, inpr;
DEFINE_WAIT(wait);

for (;;) {
prepare_to_wait(&wakeup_count_wait_queue, &wait,
TASK_INTERRUPTIBLE);
split_counters(&cnt, &inpr);
if (inpr == 0 || signal_pending(current))
break;
pm_wakeup_update_hit_counts();
schedule_timeout_interruptible(msecs_to_jiffies(TIMEOUT));

schedule();
}
finish_wait(&wakeup_count_wait_queue, &wait);

split_counters(&cnt, &inpr);
*count = cnt;
Expand Down

0 comments on commit df01ca1

Please sign in to comment.