linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libertas: check valid bits in SPI bus mode reg
@ 2009-07-31 18:35 Andrey Yurovsky
  2009-08-04 15:19 ` Dan Williams
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Yurovsky @ 2009-07-31 18:35 UTC (permalink / raw)
  To: linux-wireless; +Cc: tharvey, dcbw, Andrey Yurovsky

The SPI driver writes to the bus mode register and performs a sanity
check by reading back what we wrote, however only the lower four bits of
that register are defined.  In some cases, the device side seems to set
the higher bits, causing us to fail the sanity check unnecessarily.
Check only the lower four bits instead.

Thanks to John Goyette from Schick Technologies for pointing out the
problem.

Signed-off-by: Andrey Yurovsky <andrey@cozybit.com>
---
 drivers/net/wireless/libertas/if_spi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index 6564282..86263a9 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -376,7 +376,7 @@ static int spu_set_bus_mode(struct if_spi_card *card, u16 mode)
 	err = spu_read_u16(card, IF_SPI_SPU_BUS_MODE_REG, &rval);
 	if (err)
 		return err;
-	if (rval != mode) {
+	if ((rval & 0xF) != mode) {
 		lbs_pr_err("Can't read bus mode register.\n");
 		return -EIO;
 	}
-- 
1.5.6.3


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

* Re: [PATCH] libertas: check valid bits in SPI bus mode reg
  2009-07-31 18:35 [PATCH] libertas: check valid bits in SPI bus mode reg Andrey Yurovsky
@ 2009-08-04 15:19 ` Dan Williams
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Williams @ 2009-08-04 15:19 UTC (permalink / raw)
  To: Andrey Yurovsky; +Cc: linux-wireless, tharvey

On Fri, 2009-07-31 at 11:35 -0700, Andrey Yurovsky wrote:
> The SPI driver writes to the bus mode register and performs a sanity
> check by reading back what we wrote, however only the lower four bits of
> that register are defined.  In some cases, the device side seems to set
> the higher bits, causing us to fail the sanity check unnecessarily.
> Check only the lower four bits instead.
> 
> Thanks to John Goyette from Schick Technologies for pointing out the
> problem.
> 
> Signed-off-by: Andrey Yurovsky <andrey@cozybit.com>

Acked-by: Dan Williams <dcbw@redhat.com>

> ---
>  drivers/net/wireless/libertas/if_spi.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
> index 6564282..86263a9 100644
> --- a/drivers/net/wireless/libertas/if_spi.c
> +++ b/drivers/net/wireless/libertas/if_spi.c
> @@ -376,7 +376,7 @@ static int spu_set_bus_mode(struct if_spi_card *card, u16 mode)
>  	err = spu_read_u16(card, IF_SPI_SPU_BUS_MODE_REG, &rval);
>  	if (err)
>  		return err;
> -	if (rval != mode) {
> +	if ((rval & 0xF) != mode) {
>  		lbs_pr_err("Can't read bus mode register.\n");
>  		return -EIO;
>  	}


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

end of thread, other threads:[~2009-08-04 16:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-31 18:35 [PATCH] libertas: check valid bits in SPI bus mode reg Andrey Yurovsky
2009-08-04 15:19 ` Dan Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).