spi: bitbang: Replace hard coded number of SPI modes
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 17 May 2024 19:40:22 +0000 (22:40 +0300)
committerMark Brown <broonie@kernel.org>
Mon, 27 May 2024 00:33:24 +0000 (01:33 +0100)
Instead of using hard coded number of modes, replace it with
SPI_MODE_X_MASK + 1 to show relation to the SPI modes.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://msgid.link/r/20240517194104.747328-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/linux/spi/spi_bitbang.h

index 7ca08b430ed560c1aaf247b4259ab9450798036f..d4cb83195f7a9a9a6d3143b13da40b4237bb30c3 100644 (file)
@@ -30,7 +30,7 @@ struct spi_bitbang {
        int     (*txrx_bufs)(struct spi_device *spi, struct spi_transfer *t);
 
        /* txrx_word[SPI_MODE_*]() just looks like a shift register */
-       spi_bb_txrx_word_fn txrx_word[4];
+       spi_bb_txrx_word_fn txrx_word[SPI_MODE_X_MASK + 1];
 
        int     (*set_line_direction)(struct spi_device *spi, bool output);
 };