Skip to content

Commit 3793809

Browse files
Rasmus Villemoesgregkh
authored andcommitted
spi: spi-fsl-spi: relax message sanity checking a little
commit 17ecffa upstream. The comment says that we should not allow changes (to bits_per_word/speed_hz) while CS is active, and indeed the code below does fsl_spi_setup_transfer() when the ->cs_change of the previous spi_transfer was set (and for the very first transfer). So the sanity checking is a bit too strict - we can change it to follow the same logic as is used by the actual transfer loop. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0269533 commit 3793809

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

drivers/spi/spi-fsl-spi.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,13 +373,15 @@ static int fsl_spi_do_one_msg(struct spi_master *master,
373373
}
374374

375375
/* Don't allow changes if CS is active */
376-
first = list_first_entry(&m->transfers, struct spi_transfer,
377-
transfer_list);
376+
cs_change = 1;
378377
list_for_each_entry(t, &m->transfers, transfer_list) {
378+
if (cs_change)
379+
first = t;
380+
cs_change = t->cs_change;
379381
if ((first->bits_per_word != t->bits_per_word) ||
380382
(first->speed_hz != t->speed_hz)) {
381383
dev_err(&spi->dev,
382-
"bits_per_word/speed_hz should be same for the same SPI transfer\n");
384+
"bits_per_word/speed_hz cannot change while CS is active\n");
383385
return -EINVAL;
384386
}
385387
}

0 commit comments

Comments
 (0)