Skip to content

Commit 8c99268

Browse files
vdsaoglikely
authored andcommitted
spi/bitbang: initialize bits_per_word as specified by spi message
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 <[email protected]> Signed-off-by: Grant Likely <[email protected]>
1 parent 8b20c8c commit 8c99268

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/spi/spi_bitbang.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static unsigned bitbang_txrx_8(
6868
unsigned ns,
6969
struct spi_transfer *t
7070
) {
71-
unsigned bits = spi->bits_per_word;
71+
unsigned bits = t->bits_per_word ? : spi->bits_per_word;
7272
unsigned count = t->len;
7373
const u8 *tx = t->tx_buf;
7474
u8 *rx = t->rx_buf;
@@ -94,7 +94,7 @@ static unsigned bitbang_txrx_16(
9494
unsigned ns,
9595
struct spi_transfer *t
9696
) {
97-
unsigned bits = spi->bits_per_word;
97+
unsigned bits = t->bits_per_word ? : spi->bits_per_word;
9898
unsigned count = t->len;
9999
const u16 *tx = t->tx_buf;
100100
u16 *rx = t->rx_buf;
@@ -120,7 +120,7 @@ static unsigned bitbang_txrx_32(
120120
unsigned ns,
121121
struct spi_transfer *t
122122
) {
123-
unsigned bits = spi->bits_per_word;
123+
unsigned bits = t->bits_per_word ? : spi->bits_per_word;
124124
unsigned count = t->len;
125125
const u32 *tx = t->tx_buf;
126126
u32 *rx = t->rx_buf;

0 commit comments

Comments
 (0)