lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1358185698.1223.13.camel@cliu38-desktop-build>
Date:	Tue, 15 Jan 2013 01:48:18 +0800
From:	Chuansheng Liu <chuansheng.liu@...el.com>
To:	rjw@...k.pl
Cc:	linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
	chuansheng.liu@...el.com
Subject: [PATCH] PM / Runtime: Fix the twice judgement in
 rpm_suspend/resume()


In function rpm_suspend/resume(), when going into the for(;;),
the pre-condition judgement has been done, and the variable runtime_status
are always protected by &power.lock, so it is not necessary to judge
them again before unlock_irq &power.lock in for(;;).

This patch clean them up.

Signed-off-by: liu chuansheng <chuansheng.liu@...el.com>
---
 drivers/base/power/runtime.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 3148b10..32d6497 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -377,14 +377,14 @@ static int rpm_suspend(struct device *dev, int rpmflags)
 		for (;;) {
 			prepare_to_wait(&dev->power.wait_queue, &wait,
 					TASK_UNINTERRUPTIBLE);
-			if (dev->power.runtime_status != RPM_SUSPENDING)
-				break;
 
 			spin_unlock_irq(&dev->power.lock);
 
 			schedule();
 
 			spin_lock_irq(&dev->power.lock);
+			if (dev->power.runtime_status != RPM_SUSPENDING)
+				break;
 		}
 		finish_wait(&dev->power.wait_queue, &wait);
 		goto repeat;
@@ -557,15 +557,15 @@ static int rpm_resume(struct device *dev, int rpmflags)
 		for (;;) {
 			prepare_to_wait(&dev->power.wait_queue, &wait,
 					TASK_UNINTERRUPTIBLE);
-			if (dev->power.runtime_status != RPM_RESUMING
-			    && dev->power.runtime_status != RPM_SUSPENDING)
-				break;
 
 			spin_unlock_irq(&dev->power.lock);
 
 			schedule();
 
 			spin_lock_irq(&dev->power.lock);
+			if (dev->power.runtime_status != RPM_RESUMING
+			    && dev->power.runtime_status != RPM_SUSPENDING)
+				break;
 		}
 		finish_wait(&dev->power.wait_queue, &wait);
 		goto repeat;
@@ -989,15 +989,15 @@ static void __pm_runtime_barrier(struct device *dev)
 		for (;;) {
 			prepare_to_wait(&dev->power.wait_queue, &wait,
 					TASK_UNINTERRUPTIBLE);
-			if (dev->power.runtime_status != RPM_SUSPENDING
-			    && dev->power.runtime_status != RPM_RESUMING
-			    && !dev->power.idle_notification)
-				break;
 			spin_unlock_irq(&dev->power.lock);
 
 			schedule();
 
 			spin_lock_irq(&dev->power.lock);
+			if (dev->power.runtime_status != RPM_SUSPENDING
+			    && dev->power.runtime_status != RPM_RESUMING
+			    && !dev->power.idle_notification)
+				break;
 		}
 		finish_wait(&dev->power.wait_queue, &wait);
 	}
-- 
1.7.0.4



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ