diff mbox

spi: bitbang: initialize bits_per_word as specified by spi message

Message ID 1306946209-28553-1-git-send-email-agust@denx.de (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Anatolij Gustschin June 1, 2011, 4:36 p.m. UTC
SPI protocol drivers can submit messages specifying needed bits_per_word
parameter for a message transfer. The bitbang driver currently ignores
bits_per_word given by a singe message and always uses master's
bits_per_word parameter. Only use master's bits_per_word when a
message didn't specify needed bits_per_word for ongoing transfer.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 drivers/spi/spi_bitbang.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Comments

Grant Likely June 3, 2011, 9:01 p.m. UTC | #1
On Wed, Jun 01, 2011 at 06:36:49PM +0200, Anatolij Gustschin wrote:
> SPI protocol drivers can submit messages specifying needed bits_per_word
> parameter for a message transfer. The bitbang driver currently ignores
> bits_per_word given by a singe message and always uses master's
> bits_per_word parameter. Only use master's bits_per_word when a
> message didn't specify needed bits_per_word for ongoing transfer.
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>

Looks right to me.  Merged.

g.

> ---
>  drivers/spi/spi_bitbang.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c
> index 14a63f6..bb38c83 100644
> --- a/drivers/spi/spi_bitbang.c
> +++ b/drivers/spi/spi_bitbang.c
> @@ -68,7 +68,7 @@ static unsigned bitbang_txrx_8(
>  	unsigned		ns,
>  	struct spi_transfer	*t
>  ) {
> -	unsigned		bits = spi->bits_per_word;
> +	unsigned		bits = t->bits_per_word ? : spi->bits_per_word;
>  	unsigned		count = t->len;
>  	const u8		*tx = t->tx_buf;
>  	u8			*rx = t->rx_buf;
> @@ -94,7 +94,7 @@ static unsigned bitbang_txrx_16(
>  	unsigned		ns,
>  	struct spi_transfer	*t
>  ) {
> -	unsigned		bits = spi->bits_per_word;
> +	unsigned		bits = t->bits_per_word ? : spi->bits_per_word;
>  	unsigned		count = t->len;
>  	const u16		*tx = t->tx_buf;
>  	u16			*rx = t->rx_buf;
> @@ -120,7 +120,7 @@ static unsigned bitbang_txrx_32(
>  	unsigned		ns,
>  	struct spi_transfer	*t
>  ) {
> -	unsigned		bits = spi->bits_per_word;
> +	unsigned		bits = t->bits_per_word ? : spi->bits_per_word;
>  	unsigned		count = t->len;
>  	const u32		*tx = t->tx_buf;
>  	u32			*rx = t->rx_buf;
> -- 
> 1.7.1
> 

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2
diff mbox

Patch

diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c
index 14a63f6..bb38c83 100644
--- a/drivers/spi/spi_bitbang.c
+++ b/drivers/spi/spi_bitbang.c
@@ -68,7 +68,7 @@  static unsigned bitbang_txrx_8(
 	unsigned		ns,
 	struct spi_transfer	*t
 ) {
-	unsigned		bits = spi->bits_per_word;
+	unsigned		bits = t->bits_per_word ? : spi->bits_per_word;
 	unsigned		count = t->len;
 	const u8		*tx = t->tx_buf;
 	u8			*rx = t->rx_buf;
@@ -94,7 +94,7 @@  static unsigned bitbang_txrx_16(
 	unsigned		ns,
 	struct spi_transfer	*t
 ) {
-	unsigned		bits = spi->bits_per_word;
+	unsigned		bits = t->bits_per_word ? : spi->bits_per_word;
 	unsigned		count = t->len;
 	const u16		*tx = t->tx_buf;
 	u16			*rx = t->rx_buf;
@@ -120,7 +120,7 @@  static unsigned bitbang_txrx_32(
 	unsigned		ns,
 	struct spi_transfer	*t
 ) {
-	unsigned		bits = spi->bits_per_word;
+	unsigned		bits = t->bits_per_word ? : spi->bits_per_word;
 	unsigned		count = t->len;
 	const u32		*tx = t->tx_buf;
 	u32			*rx = t->rx_buf;