public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] omap2: off by 1
@ 2009-02-25 13:06 Roel Kluin
  2009-05-14 21:15 ` Paul Walmsley
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-02-25 13:06 UTC (permalink / raw)
  To: rmk+kernel; +Cc: linux-omap, Andrew Morton

with while (i++ < MAX_CLOCK_ENABLE_WAIT); i can reach MAX_CLOCK_ENABLE_WAIT + 1
after the loop, so if (i == MAX_CLOCK_ENABLE_WAIT) that's still success.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
 arch/arm/mach-omap2/clock.c       |    2 +-
 arch/arm/mach-omap2/powerdomain.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index ce4d46a..da185ff 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -202,7 +202,7 @@ int omap2_wait_clock_ready(void __iomem *reg, u32 mask, const char *name)
 		udelay(1);
 	}
 
-	if (i < MAX_CLOCK_ENABLE_WAIT)
+	if (i <= MAX_CLOCK_ENABLE_WAIT)
 		pr_debug("Clock %s stable after %d loops\n", name, i);
 	else
 		printk(KERN_ERR "Clock %s didn't enable in %d tries\n",
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 73e2971..983f1cb 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -1099,7 +1099,7 @@ int pwrdm_wait_transition(struct powerdomain *pwrdm)
 	       (c++ < PWRDM_TRANSITION_BAILOUT))
 		udelay(1);
 
-	if (c >= PWRDM_TRANSITION_BAILOUT) {
+	if (c > PWRDM_TRANSITION_BAILOUT) {
 		printk(KERN_ERR "powerdomain: waited too long for "
 		       "powerdomain %s to complete transition\n", pwrdm->name);
 		return -EAGAIN;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] omap2: off by 1
  2009-02-25 13:06 [PATCH] omap2: off by 1 Roel Kluin
@ 2009-05-14 21:15 ` Paul Walmsley
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Walmsley @ 2009-05-14 21:15 UTC (permalink / raw)
  To: Roel Kluin; +Cc: rmk+kernel, linux-omap, tony, Andrew Morton

On Wed, 25 Feb 2009, Roel Kluin wrote:

> with while (i++ < MAX_CLOCK_ENABLE_WAIT); i can reach MAX_CLOCK_ENABLE_WAIT + 1
> after the loop, so if (i == MAX_CLOCK_ENABLE_WAIT) that's still success.

Hi Roel

it's a worst-case bailout value that is significantly larger than it needs 
to be, so being off by 1 doesn't matter here.  But I'll take the patch on 
pedantic grounds.  Queued in the omap-clocks-upstream branch.

- Paul

> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
>  arch/arm/mach-omap2/clock.c       |    2 +-
>  arch/arm/mach-omap2/powerdomain.c |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
> index ce4d46a..da185ff 100644
> --- a/arch/arm/mach-omap2/clock.c
> +++ b/arch/arm/mach-omap2/clock.c
> @@ -202,7 +202,7 @@ int omap2_wait_clock_ready(void __iomem *reg, u32 mask, const char *name)
>  		udelay(1);
>  	}
>  
> -	if (i < MAX_CLOCK_ENABLE_WAIT)
> +	if (i <= MAX_CLOCK_ENABLE_WAIT)
>  		pr_debug("Clock %s stable after %d loops\n", name, i);
>  	else
>  		printk(KERN_ERR "Clock %s didn't enable in %d tries\n",
> diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
> index 73e2971..983f1cb 100644
> --- a/arch/arm/mach-omap2/powerdomain.c
> +++ b/arch/arm/mach-omap2/powerdomain.c
> @@ -1099,7 +1099,7 @@ int pwrdm_wait_transition(struct powerdomain *pwrdm)
>  	       (c++ < PWRDM_TRANSITION_BAILOUT))
>  		udelay(1);
>  
> -	if (c >= PWRDM_TRANSITION_BAILOUT) {
> +	if (c > PWRDM_TRANSITION_BAILOUT) {
>  		printk(KERN_ERR "powerdomain: waited too long for "
>  		       "powerdomain %s to complete transition\n", pwrdm->name);
>  		return -EAGAIN;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


- Paul

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-14 21:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-25 13:06 [PATCH] omap2: off by 1 Roel Kluin
2009-05-14 21:15 ` Paul Walmsley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox