linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Xilinx: SPI: Fix bits_per_word for transfers
@ 2009-09-14 18:17 John Linn
  2009-09-14 18:37 ` Grant Likely
  0 siblings, 1 reply; 2+ messages in thread
From: John Linn @ 2009-09-14 18:17 UTC (permalink / raw)
  To: dbrownell, linuxppc-dev, grant.likely, jwboyer, akonovalov; +Cc: John Linn

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(-)

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.

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

* Re: [PATCH] Xilinx: SPI: Fix bits_per_word for transfers
  2009-09-14 18:17 [PATCH] Xilinx: SPI: Fix bits_per_word for transfers John Linn
@ 2009-09-14 18:37 ` Grant Likely
  0 siblings, 0 replies; 2+ messages in thread
From: Grant Likely @ 2009-09-14 18:37 UTC (permalink / raw)
  To: John Linn; +Cc: linuxppc-dev, akonovalov, dbrownell

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>

> ---
> =A0drivers/spi/xilinx_spi.c | =A0 =A03 ++-
> =A01 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_devic=
e *spi,
> =A0{
> =A0 =A0 =A0 =A0u8 bits_per_word;
>
> - =A0 =A0 =A0 bits_per_word =3D (t) ? t->bits_per_word : spi->bits_per_wo=
rd;
> + =A0 =A0 =A0 bits_per_word =3D (t && t->bits_per_word)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0? t->bits_per_word : spi=
->bits_per_word;
> =A0 =A0 =A0 =A0if (bits_per_word !=3D 8) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dev_err(&spi->dev, "%s, unsupported bits_p=
er_word=3D%d\n",
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0__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 proprieta=
ry, privileged or copyrighted under applicable law. If you are not the inte=
nded recipient, do not read, copy, or forward this email message or any att=
achments. Delete this email message and any attachments immediately.
>
>
>



--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

end of thread, other threads:[~2009-09-14 18:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-14 18:17 [PATCH] Xilinx: SPI: Fix bits_per_word for transfers John Linn
2009-09-14 18:37 ` Grant Likely

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).