diff mbox

Xilinx: SPI: Fix bits_per_word for transfers

Message ID 20090914181617.ACF4B17B804F@mail59-sin.bigfish.com (mailing list archive)
State Accepted, archived
Commit 1a8d3b777dd71813b87c66c0eb161cc87f042126
Delegated to: Grant Likely
Headers show

Commit Message

John Linn Sept. 14, 2009, 6:17 p.m. UTC
The bits_per_word value can be set for each transfer, or can
be set to zero in each transfer in which case it should default
to the value in the driver.

The driver was fixed to properly check the bits_per_word in
the transfer that is passed in.

Signed-off-by: John Linn <john.linn@xilinx.com>
---
 drivers/spi/xilinx_spi.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Grant Likely Sept. 14, 2009, 6:37 p.m. UTC | #1
On Mon, Sep 14, 2009 at 12:17 PM, John Linn <john.linn@xilinx.com> wrote:
> The bits_per_word value can be set for each transfer, or can
> be set to zero in each transfer in which case it should default
> to the value in the driver.
>
> The driver was fixed to properly check the bits_per_word in
> the transfer that is passed in.
>
> Signed-off-by: John Linn <john.linn@xilinx.com>

Looks good to me.

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  drivers/spi/xilinx_spi.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
> index 46b8c5c..5a143b9 100644
> --- a/drivers/spi/xilinx_spi.c
> +++ b/drivers/spi/xilinx_spi.c
> @@ -148,7 +148,8 @@ static int xilinx_spi_setup_transfer(struct spi_device *spi,
>  {
>        u8 bits_per_word;
>
> -       bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word;
> +       bits_per_word = (t && t->bits_per_word)
> +                        ? t->bits_per_word : spi->bits_per_word;
>        if (bits_per_word != 8) {
>                dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n",
>                        __func__, bits_per_word);
> --
> 1.6.2.1
>
>
>
> This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
>
>
>
diff mbox

Patch

diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index 46b8c5c..5a143b9 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -148,7 +148,8 @@  static int xilinx_spi_setup_transfer(struct spi_device *spi,
 {
 	u8 bits_per_word;
 
-	bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word;
+	bits_per_word = (t && t->bits_per_word)
+			 ? t->bits_per_word : spi->bits_per_word;
 	if (bits_per_word != 8) {
 		dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n",
 			__func__, bits_per_word);