Thread (20 messages) flat view 20 messages, 3 authors, 2013-03-16

[PATCH 1/8] memory: emif: Correct the lpmode timeout calculation

From: Santosh Shilimkar <hidden>
Date: 2013-03-11 05:32:24
Also in: linux-omap, lkml

minor nit.
$subject
s/Correct/Fix

On Monday 11 March 2013 10:35 AM, Lokesh Vutla wrote:
The driver tries to round up the specified timeout cycles to
the next power of 2 value. But this is done wrongly.
Correcting this here.
Change needs to be improved here. See below.
 
quoted hunk ↗ jump to hunk
Reported-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Lokesh Vutla <redacted>
---
 drivers/memory/emif.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c
index df08736..622638c 100644
--- a/drivers/memory/emif.c
+++ b/drivers/memory/emif.c
@@ -732,9 +732,9 @@ static u32 get_pwr_mgmt_ctrl(u32 freq, struct emif_data *emif, u32 ip_rev)
 	if (timeout < 16) {
 		timeout = 0;
 	} else {
-		timeout = __fls(timeout) - 3;
 		if (timeout & (timeout - 1))
So from the change, it appears that, the timeout
check for power of 2 should be done before updating
the variable which seems to be the right fix.
-			timeout++;
+			timeout <<= 1;
+		timeout = __fls(timeout) - 3;
 	}
 
 	switch (lpmode) {
So just make changelog verbose as well as add a
comment about the calculation in the code.

Otherwise, patch looks fine to me.
Acked-by: Santosh Shilimkar <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help