Patchwork Fix obvious mistake in pxa2xx i2s driver

login
register
mail settings
Submitter Vasily Khoruzhick
Date Feb. 14, 2011, 4:59 p.m.
Message ID <1297702750-32203-1-git-send-email-anarsoul@gmail.com>
Download mbox | patch
Permalink /patch/83140/
State New
Headers show

Comments

Vasily Khoruzhick - Feb. 14, 2011, 4:59 p.m.
RST bit is (1 << 3) bit, not (1 << 2), fix condition
that enables i2s if ENB is set and RST is not set.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 hw/pxa2xx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Vasily Khoruzhick - Feb. 20, 2011, 2:19 p.m.
On Monday 14 February 2011 18:59:10 Vasily Khoruzhick wrote:
> RST bit is (1 << 3) bit, not (1 << 2), fix condition
> that enables i2s if ENB is set and RST is not set.
> 
Ping
Aurelien Jarno - Feb. 20, 2011, 6:24 p.m.
On Mon, Feb 14, 2011 at 06:59:10PM +0200, Vasily Khoruzhick wrote:
> RST bit is (1 << 3) bit, not (1 << 2), fix condition
> that enables i2s if ENB is set and RST is not set.
> 
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> ---
>  hw/pxa2xx.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c
> index d966846..68b67ae 100644
> --- a/hw/pxa2xx.c
> +++ b/hw/pxa2xx.c
> @@ -1631,7 +1631,7 @@ static void pxa2xx_i2s_write(void *opaque, target_phys_addr_t addr,
>          }
>          if (value & (1 << 4))				/* EFWR */
>              printf("%s: Attempt to use special function\n", __FUNCTION__);
> -        s->enable = ((value ^ 4) & 5) == 5;		/* ENB && !RST*/
> +        s->enable = ((value ^ (1 << 3)) & 9) == 9;		/* ENB && !RST*/
>          pxa2xx_i2s_update(s);
>          break;
>      case SACR1:

The fix looks fine, but the resulting code is probably over
engineered... What about:

         s->enable = (value & 9) == 1;

?
Vasily Khoruzhick - Feb. 20, 2011, 6:39 p.m.
On Sunday 20 February 2011 20:24:46 Aurelien Jarno wrote:

> The fix looks fine, but the resulting code is probably over
> engineered... What about:
> 
>          s->enable = (value & 9) == 1;
> 
> ?

Looks OK to me.

Regards
Vasily
Aurelien Jarno - Feb. 20, 2011, 6:45 p.m.
On Sun, Feb 20, 2011 at 08:39:20PM +0200, Vasily Khoruzhick wrote:
> On Sunday 20 February 2011 20:24:46 Aurelien Jarno wrote:
> 
> > The fix looks fine, but the resulting code is probably over
> > engineered... What about:
> > 
> >          s->enable = (value & 9) == 1;
> > 
> > ?
> 
> Looks OK to me.
> 

Can you please provide a new version with that code instead, I'll apply
it.

Patch

diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c
index d966846..68b67ae 100644
--- a/hw/pxa2xx.c
+++ b/hw/pxa2xx.c
@@ -1631,7 +1631,7 @@  static void pxa2xx_i2s_write(void *opaque, target_phys_addr_t addr,
         }
         if (value & (1 << 4))				/* EFWR */
             printf("%s: Attempt to use special function\n", __FUNCTION__);
-        s->enable = ((value ^ 4) & 5) == 5;		/* ENB && !RST*/
+        s->enable = ((value ^ (1 << 3)) & 9) == 9;		/* ENB && !RST*/
         pxa2xx_i2s_update(s);
         break;
     case SACR1: