aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/cm.c
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2009-12-08 18:33:16 -0500
committerpaul <paul@twilight.(none)>2009-12-11 19:00:43 -0500
commit6f8b7ff5b01e16a65c3b17865ce047faeca40907 (patch)
treeae5ecb4b377588b157c23176cf95a5c9631206ba /arch/arm/mach-omap2/cm.c
parent3863c74b512c1afd3ce6b2f81d8dea9f1d860968 (diff)
OMAP clock/hwmod: fix off-by-one errors
Fix loop bailout off-by-one bugs reported by Juha Leppänen <juha_motorsportcom@luukku.com>. This second version incorporates comments from Russell King <linux@arm.linux.org.uk>. A new macro, 'omap_test_timeout', has been created, with cleaner code, and existing code has been converted to use it. Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Juha Leppänen <juha_motorsportcom@luukku.com> Cc: Russell King <linux@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-omap2/cm.c')
-rw-r--r--arch/arm/mach-omap2/cm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/arm/mach-omap2/cm.c b/arch/arm/mach-omap2/cm.c
index 8eb2dab8c7db..58e4a1c557d8 100644
--- a/arch/arm/mach-omap2/cm.c
+++ b/arch/arm/mach-omap2/cm.c
@@ -21,6 +21,8 @@
21 21
22#include <asm/atomic.h> 22#include <asm/atomic.h>
23 23
24#include <plat/common.h>
25
24#include "cm.h" 26#include "cm.h"
25#include "cm-regbits-24xx.h" 27#include "cm-regbits-24xx.h"
26#include "cm-regbits-34xx.h" 28#include "cm-regbits-34xx.h"
@@ -61,9 +63,8 @@ int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
61 mask = 1 << idlest_shift; 63 mask = 1 << idlest_shift;
62 64
63 /* XXX should be OMAP2 CM */ 65 /* XXX should be OMAP2 CM */
64 while (((cm_read_mod_reg(prcm_mod, cm_idlest_reg) & mask) != ena) && 66 omap_test_timeout(((cm_read_mod_reg(prcm_mod, cm_idlest_reg) & mask) == ena),
65 (i++ < MAX_MODULE_READY_TIME)) 67 MAX_MODULE_READY_TIME, i);
66 udelay(1);
67 68
68 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY; 69 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
69} 70}