From 714fdaf2e80b2cd7514c7f37b762ed65ae510c43 Mon Sep 17 00:00:00 2001 From: Mike Chan Date: Tue, 25 Aug 2009 18:10:32 -0700 Subject: [PATCH] power: Prevent spinlock recursion when wake_unlock() is called Signed-off-by: Mike Chan (cherry picked from commit 97a0a74383d19a1a43ffca81271894ba3edc07b6) --- kernel/power/wakelock.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/power/wakelock.c b/kernel/power/wakelock.c index aea33d643b3b..d839d22b47af 100644 --- a/kernel/power/wakelock.c +++ b/kernel/power/wakelock.c @@ -211,13 +211,13 @@ static void expire_wake_lock(struct wake_lock *lock) pr_info("expired wake lock %s\n", lock->name); } +/* Caller must acquire the list_lock spinlock */ static void print_active_locks(int type) { unsigned long irqflags; struct wake_lock *lock; BUG_ON(type >= WAKE_LOCK_TYPE_COUNT); - spin_lock_irqsave(&list_lock, irqflags); list_for_each_entry(lock, &active_wake_locks[type], link) { if (lock->flags & WAKE_LOCK_AUTO_EXPIRE) { long timeout = lock->expires - jiffies; @@ -229,7 +229,6 @@ static void print_active_locks(int type) } else pr_info("active wake lock %s\n", lock->name); } - spin_unlock_irqrestore(&list_lock, irqflags); } static long has_wake_lock_locked(int type) @@ -386,9 +385,9 @@ static void expire_wake_locks(unsigned long data) unsigned long irqflags; if (debug_mask & DEBUG_EXPIRE) pr_info("expire_wake_locks: start\n"); + spin_lock_irqsave(&list_lock, irqflags); if (debug_mask & DEBUG_SUSPEND) print_active_locks(WAKE_LOCK_SUSPEND); - spin_lock_irqsave(&list_lock, irqflags); has_lock = has_wake_lock_locked(WAKE_LOCK_SUSPEND); if (debug_mask & DEBUG_EXPIRE) pr_info("expire_wake_locks: done, has_lock %ld\n", has_lock);