]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
spi: loopback-test: add ability to test zero-length transfer
authorAkinobu Mita <akinobu.mita@gmail.com>
Fri, 17 Mar 2017 18:17:28 +0000 (03:17 +0900)
committerMark Brown <broonie@kernel.org>
Fri, 17 Mar 2017 21:54:00 +0000 (21:54 +0000)
commit8916671e93a38c509e2ffb02c2ce3f37efe8af40
tree17937b733f5a6fee8439b945523ab3ece032c0e2
parent8494801db1fc21867f587dae465236100bf228cc
spi: loopback-test: add ability to test zero-length transfer

The spi-loopback-test module currently cannot test the spi_message
including a zero-length transfer.  Because the zero-length transfer is
treated as a special value in several meanings.

1. The number of spi_transfer to execute in one test case is described
by spi_test.transfer_count.  It is normally computed by counting number
of transfers with len > 0 in spi_test.transfers array.

This change stops the detection for the number of spi_transfer.  Each
spi_test.transfer_count needs to be filled by hand now.

2. The spi_test.iterate_len is a list of transfer length to iterate on.
This list is terminated by zero, so zero-length transfer cannot be
included.

This changes the terminal value from 0 to -1.

3. The length for the spi_transfer masked by spi_test.iterate_transfer_mask
is iterated.  Before starting the iteration, the default value which
is statically initialized is applied.  In order to specify the default
value, zero-length is reserved.

Currently, the default values are always '1'.  So this removes this
trick and add '1' to iterate_len list.

By applying all these changes, the spi-loopback-test can execute spi
messages with zero-length transfer.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-loopback-test.c
drivers/spi/spi-test.h