Skip to contentSkip to conversation

Xilinx: SPI: Fix bits_per_word for transfers

PATCH In review John Linn 2 participants 2 messages Sep 14, 2009

Subsystems (2)
lore
Share & tools
lore

John Linn

author
#0 lore raw

PATCH 1/1 Xilinx: SPI: Fix bits_per_word for transfers

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.

---
 drivers/spi/xilinx_spi.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/spi/xilinx_spi.c +2 -1
index 46b8c5c..5a143b9 100644
@@ -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);
Signature · 5 lines
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.
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · 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.

Looks good to me.

drivers/spi/xilinx_spi.c static int xilinx_spi_setup_transfer(struct spi_devic=

Quoted 9 lines

---
=A0drivers/spi/xilinx_spi.c | =A0 =A03 ++- =A01 files changed, 2 insertions(+), 1 deletions(-)

drivers/spi/xilinx_spi.c +0 -0
index 46b8c5c..5a143b9 100644
@@ -148,7 +148,8 @@ static int xilinx_spi_setup_transfer(struct spi_devic=

e *spi,

drivers/spi/xilinx_spi.c static int xilinx_spi_setup_transfer(struct spi_devic= · line 151

Quoted 4 lines
drivers/spi/xilinx_spi.c +0 -1
 =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;

drivers/spi/xilinx_spi.c static int xilinx_spi_setup_transfer(struct spi_devic= · line 152

Quoted 2 lines
drivers/spi/xilinx_spi.c +2 -0
+ =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;

Quoted 2 lines
drivers/spi/xilinx_spi.c +0 -0
 =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",

Quoted 7 lines

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

Quoted 3 lines

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