summaryrefslogtreecommitdiff
path: root/drivers/base/power/wakeup.c
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2012-04-29 22:53:02 +0200
committerRafael J. Wysocki <rjw@sisk.pl>2012-05-01 21:25:25 +0200
commit6791e36c4a40e8930e08669e60077eea6770c429 (patch)
tree880d7255cc13a270d513e4fb6c4219f85d9536d0 /drivers/base/power/wakeup.c
parent30e3ce6dcbe3fc29c343b17e768b07d4a795de21 (diff)
PM / Sleep: Add wakeup_source_activate and wakeup_source_deactivate tracepoints
Add tracepoints to wakeup_source_activate and wakeup_source_deactivate. Useful for checking that specific wakeup sources overlap as expected. Signed-off-by: Arve Hjønnevåg <arve@android.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'drivers/base/power/wakeup.c')
-rw-r--r--drivers/base/power/wakeup.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index 7a6eada4534d..1132799421cd 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -14,6 +14,7 @@
#include <linux/suspend.h>
#include <linux/seq_file.h>
#include <linux/debugfs.h>
+#include <trace/events/power.h>
#include "power.h"
@@ -374,12 +375,16 @@ EXPORT_SYMBOL_GPL(device_set_wakeup_enable);
*/
static void wakeup_source_activate(struct wakeup_source *ws)
{
+ unsigned int cec;
+
ws->active = true;
ws->active_count++;
ws->last_time = ktime_get();
/* Increment the counter of events in progress. */
- atomic_inc(&combined_event_count);
+ cec = atomic_inc_return(&combined_event_count);
+
+ trace_wakeup_source_activate(ws->name, cec);
}
/**
@@ -454,7 +459,7 @@ EXPORT_SYMBOL_GPL(pm_stay_awake);
*/
static void wakeup_source_deactivate(struct wakeup_source *ws)
{
- unsigned int cnt, inpr;
+ unsigned int cnt, inpr, cec;
ktime_t duration;
ktime_t now;
@@ -489,7 +494,8 @@ static void wakeup_source_deactivate(struct wakeup_source *ws)
* Increment the counter of registered wakeup events and decrement the
* couter of wakeup events in progress simultaneously.
*/
- atomic_add(MAX_IN_PROGRESS, &combined_event_count);
+ cec = atomic_add_return(MAX_IN_PROGRESS, &combined_event_count);
+ trace_wakeup_source_deactivate(ws->name, cec);
split_counters(&cnt, &inpr);
if (!inpr && waitqueue_active(&wakeup_count_wait_queue))