aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2010-12-03 16:58:31 -0500
committerRafael J. Wysocki <rjw@sisk.pl>2010-12-24 09:02:42 -0500
commita2867e08c8e3bdbc00caf56bc3bdde19ccc058e3 (patch)
tree34cee3dede448f30bb100d8301c422f481678bcc /drivers/base
parent1e75227ef0571031cd18536ab768ee35667ec5b9 (diff)
PM / Wakeup: Replace pm_check_wakeup_events() with pm_wakeup_pending()
To avoid confusion with the meaning and return value of pm_check_wakeup_events() replace it with pm_wakeup_pending() that will work the other way around (ie. return true when system-wide power transition should be aborted). Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/main.c2
-rw-r--r--drivers/base/power/wakeup.c20
2 files changed, 11 insertions, 11 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 4747a1e8b44a..8a5258339ca2 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1056,7 +1056,7 @@ static int dpm_prepare(pm_message_t state)
1056 if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) 1056 if (pm_runtime_barrier(dev) && device_may_wakeup(dev))
1057 pm_wakeup_event(dev, 0); 1057 pm_wakeup_event(dev, 0);
1058 1058
1059 if (!pm_check_wakeup_events()) { 1059 if (pm_wakeup_pending()) {
1060 pm_runtime_put_sync(dev); 1060 pm_runtime_put_sync(dev);
1061 error = -EBUSY; 1061 error = -EBUSY;
1062 } else { 1062 } else {
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index 71c5528e1c35..8ec406d8f548 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -542,26 +542,26 @@ static void pm_wakeup_update_hit_counts(void)
542} 542}
543 543
544/** 544/**
545 * pm_check_wakeup_events - Check for new wakeup events. 545 * pm_wakeup_pending - Check if power transition in progress should be aborted.
546 * 546 *
547 * Compare the current number of registered wakeup events with its preserved 547 * Compare the current number of registered wakeup events with its preserved
548 * value from the past to check if new wakeup events have been registered since 548 * value from the past and return true if new wakeup events have been registered
549 * the old value was stored. Check if the current number of wakeup events being 549 * since the old value was stored. Also return true if the current number of
550 * processed is zero. 550 * wakeup events being processed is different from zero.
551 */ 551 */
552bool pm_check_wakeup_events(void) 552bool pm_wakeup_pending(void)
553{ 553{
554 unsigned long flags; 554 unsigned long flags;
555 bool ret = true; 555 bool ret = false;
556 556
557 spin_lock_irqsave(&events_lock, flags); 557 spin_lock_irqsave(&events_lock, flags);
558 if (events_check_enabled) { 558 if (events_check_enabled) {
559 ret = ((unsigned int)atomic_read(&event_count) == saved_count) 559 ret = ((unsigned int)atomic_read(&event_count) != saved_count)
560 && !atomic_read(&events_in_progress); 560 || atomic_read(&events_in_progress);
561 events_check_enabled = ret; 561 events_check_enabled = !ret;
562 } 562 }
563 spin_unlock_irqrestore(&events_lock, flags); 563 spin_unlock_irqrestore(&events_lock, flags);
564 if (!ret) 564 if (ret)
565 pm_wakeup_update_hit_counts(); 565 pm_wakeup_update_hit_counts();
566 return ret; 566 return ret;
567} 567}