diff options
author | Mike Chan <mike@android.com> | 2010-02-16 14:18:55 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2011-06-14 09:09:27 -0700 |
commit | af62b25adba1fe01c91aa88c95d1584371ab2bf9 (patch) | |
tree | b03c0757132204a2e7a423f17f6319ca32e30624 /kernel/power | |
parent | 617a3dcb3fc460098b5347b9c49ff59ce6f4b05d (diff) | |
download | kernel_samsung_crespo-af62b25adba1fe01c91aa88c95d1584371ab2bf9.zip kernel_samsung_crespo-af62b25adba1fe01c91aa88c95d1584371ab2bf9.tar.gz kernel_samsung_crespo-af62b25adba1fe01c91aa88c95d1584371ab2bf9.tar.bz2 |
power: wakelock: Print active wakelocks when has_wake_lock() is called
When DEBUG_SUSPEND is enabled print active wakelocks when we check
if there are any active wakelocks.
In print_active_locks(), print expired wakelocks if DEBUG_EXPIRE is enabled
Change-Id: Ib1cb795555e71ff23143a2bac7c8a58cbce16547
Signed-off-by: Mike Chan <mike@android.com>
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/wakelock.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/kernel/power/wakelock.c b/kernel/power/wakelock.c index 4b0e260..ca48bb8 100644 --- a/kernel/power/wakelock.c +++ b/kernel/power/wakelock.c @@ -208,20 +208,23 @@ static void expire_wake_lock(struct wake_lock *lock) /* Caller must acquire the list_lock spinlock */ static void print_active_locks(int type) { - unsigned long irqflags; struct wake_lock *lock; + bool print_expired = true; BUG_ON(type >= WAKE_LOCK_TYPE_COUNT); list_for_each_entry(lock, &active_wake_locks[type], link) { if (lock->flags & WAKE_LOCK_AUTO_EXPIRE) { long timeout = lock->expires - jiffies; - if (timeout <= 0) - pr_info("wake lock %s, expired\n", lock->name); - else + if (timeout > 0) pr_info("active wake lock %s, time left %ld\n", lock->name, timeout); - } else + else if (print_expired) + pr_info("wake lock %s, expired\n", lock->name); + } else { pr_info("active wake lock %s\n", lock->name); + if (!debug_mask & DEBUG_EXPIRE) + print_expired = false; + } } } @@ -250,6 +253,8 @@ long has_wake_lock(int type) unsigned long irqflags; spin_lock_irqsave(&list_lock, irqflags); ret = has_wake_lock_locked(type); + if (ret && (debug_mask & DEBUG_SUSPEND) && type == WAKE_LOCK_SUSPEND) + print_active_locks(type); spin_unlock_irqrestore(&list_lock, irqflags); return ret; } |