public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] davinci: simplify if-statement
@ 2010-10-25 12:41 Nicolas Kaiser
  2010-11-12 16:07 ` Kevin Hilman
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Kaiser @ 2010-10-25 12:41 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: davinci-linux-open-source, linux-kernel

A common do-while loop can be factored out from the end of
the branches.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
---
 arch/arm/mach-davinci/psc.c |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-davinci/psc.c b/arch/arm/mach-davinci/psc.c
index 1b15dbd..a415804 100644
--- a/arch/arm/mach-davinci/psc.c
+++ b/arch/arm/mach-davinci/psc.c
@@ -83,21 +83,16 @@ void davinci_psc_config(unsigned int domain, unsigned int ctlr,
 		pdctl1 = __raw_readl(psc_base + PDCTL1);
 		pdctl1 |= 0x100;
 		__raw_writel(pdctl1, psc_base + PDCTL1);
-
-		do {
-			ptstat = __raw_readl(psc_base +
-					       PTSTAT);
-		} while (!(((ptstat >> domain) & 1) == 0));
 	} else {
 		ptcmd = 1 << domain;
 		__raw_writel(ptcmd, psc_base + PTCMD);
-
-		do {
-			ptstat = __raw_readl(psc_base + PTSTAT);
-		} while (!(((ptstat >> domain) & 1) == 0));
 	}
 
 	do {
+		ptstat = __raw_readl(psc_base + PTSTAT);
+	} while (!(((ptstat >> domain) & 1) == 0));
+
+	do {
 		mdstat = __raw_readl(psc_base + MDSTAT + 4 * id);
 	} while (!((mdstat & MDSTAT_STATE_MASK) == next_state));
 
-- 
1.7.2.2

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

* Re: [PATCH] davinci: simplify if-statement
  2010-10-25 12:41 [PATCH] davinci: simplify if-statement Nicolas Kaiser
@ 2010-11-12 16:07 ` Kevin Hilman
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Hilman @ 2010-11-12 16:07 UTC (permalink / raw)
  To: Nicolas Kaiser; +Cc: davinci-linux-open-source, linux-kernel

Nicolas Kaiser <nikai@nikai.net> writes:

> A common do-while loop can be factored out from the end of
> the branches.
>
> Signed-off-by: Nicolas Kaiser <nikai@nikai.net>

Applied, queueing for 2.6.38.

Kevin

> ---
>  arch/arm/mach-davinci/psc.c |   13 ++++---------
>  1 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/psc.c b/arch/arm/mach-davinci/psc.c
> index 1b15dbd..a415804 100644
> --- a/arch/arm/mach-davinci/psc.c
> +++ b/arch/arm/mach-davinci/psc.c
> @@ -83,21 +83,16 @@ void davinci_psc_config(unsigned int domain, unsigned int ctlr,
>  		pdctl1 = __raw_readl(psc_base + PDCTL1);
>  		pdctl1 |= 0x100;
>  		__raw_writel(pdctl1, psc_base + PDCTL1);
> -
> -		do {
> -			ptstat = __raw_readl(psc_base +
> -					       PTSTAT);
> -		} while (!(((ptstat >> domain) & 1) == 0));
>  	} else {
>  		ptcmd = 1 << domain;
>  		__raw_writel(ptcmd, psc_base + PTCMD);
> -
> -		do {
> -			ptstat = __raw_readl(psc_base + PTSTAT);
> -		} while (!(((ptstat >> domain) & 1) == 0));
>  	}
>  
>  	do {
> +		ptstat = __raw_readl(psc_base + PTSTAT);
> +	} while (!(((ptstat >> domain) & 1) == 0));
> +
> +	do {
>  		mdstat = __raw_readl(psc_base + MDSTAT + 4 * id);
>  	} while (!((mdstat & MDSTAT_STATE_MASK) == next_state));

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

end of thread, other threads:[~2010-11-12 16:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-25 12:41 [PATCH] davinci: simplify if-statement Nicolas Kaiser
2010-11-12 16:07 ` Kevin Hilman

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