Skip to contentSkip to conversation

PM: fix runtime accounting calculation error

PATCH Applied [email protected] 2 participants 4 messages Oct 28, 2011 – Nov 3, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 PM: fix runtime accounting calculation error

From: venu byravarasu <[email protected]>

With delta type being int, its value is made zero
for all values of now > 0x80000000.
Hence fixing it.

---
changes since v1:
Removed max_num and its usage references.
..........

 drivers/base/power/runtime.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/base/power/runtime.c +1 -4
index 1079e03..e8a5172 100644
@@ -30,13 +30,10 @@ static int rpm_suspend(struct device *dev, int rpmflags);
 void update_pm_runtime_accounting(struct device *dev)
 {
 	unsigned long now = jiffies;
-	int delta;
+	unsigned long delta;
 
 	delta = now - dev->power.accounting_timestamp;
 
-	if (delta < 0)
-		delta = 0;
-
 	dev->power.accounting_timestamp = now;
 
 	if (dev->power.disable_depth > 0)
Signature · 1 line
1.7.1.1
#1 lore raw
Quoted 7 lines · On Friday, October 28, 2011, [email protected] wrote:

From: venu byravarasu <[email protected]>

With delta type being int, its value is made zero
for all values of now > 0x80000000.
Hence fixing it.

Thanks, looks good. I'll add it to the linux-pm tree's pm-fixes branch when I'm back home later this week.

Rafael

Quoted 28 lines

---
changes since v1:
Removed max_num and its usage references.
..........

 drivers/base/power/runtime.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/base/power/runtime.c +1 -4
index 1079e03..e8a5172 100644
@@ -30,13 +30,10 @@ static int rpm_suspend(struct device *dev, int rpmflags);
 void update_pm_runtime_accounting(struct device *dev)
 {
 	unsigned long now = jiffies;
-	int delta;
+	unsigned long delta;
 
 	delta = now - dev->power.accounting_timestamp;
 
-	if (delta < 0)
-		delta = 0;
-
 	dev->power.accounting_timestamp = now;
 
 	if (dev->power.disable_depth > 0)
#2 lore raw
In reply to [email protected]
Quoted 7 lines · On Friday, October 28, 2011, [email protected] wrote:

From: venu byravarasu <[email protected]>

With delta type being int, its value is made zero
for all values of now > 0x80000000.
Hence fixing it.

Applied to linux-pm/linux-next.

Thanks,
Rafael

Quoted 28 lines

---
changes since v1:
Removed max_num and its usage references.
..........

 drivers/base/power/runtime.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/base/power/runtime.c +1 -4
index 1079e03..e8a5172 100644
@@ -30,13 +30,10 @@ static int rpm_suspend(struct device *dev, int rpmflags);
 void update_pm_runtime_accounting(struct device *dev)
 {
 	unsigned long now = jiffies;
-	int delta;
+	unsigned long delta;
 
 	delta = now - dev->power.accounting_timestamp;
 
-	if (delta < 0)
-		delta = 0;
-
 	dev->power.accounting_timestamp = now;
 
 	if (dev->power.disable_depth > 0)
#3 lore raw

-----Original Message-----

Quoted 10 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Thursday, November 03, 2011 5:49 AM
To: Venu Byravarasu
Cc: [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; Peter De Schrijver
Subject: Re: [PATCH v2] PM: fix runtime accounting calculation error

Quoted 2 lines · On Friday, October 28, 2011, [email protected] wrote:

From: venu byravarasu <[email protected]>

Quoted 7 lines
Quoted 5 lines

With delta type being int, its value is made zero
for all values of now > 0x80000000.
Hence fixing it.

Applied to linux-pm/linux-next.

Thanks Rafael.
Venu