diff options
| author | Andy Shevchenko <[email protected]> | 2023-07-14 09:17:47 +0000 |
|---|---|---|
| committer | Mark Brown <[email protected]> | 2023-07-14 13:44:38 +0000 |
| commit | 169f5312dc46deb986e368b6828bedbedd297f6e (patch) | |
| tree | 65499556fecf727930f26370fd9ec3509a547b94 /drivers/spi/spi.c | |
| parent | spi: Kill spi_add_device_locked() (diff) | |
| download | kernel-169f5312dc46deb986e368b6828bedbedd297f6e.tar.gz kernel-169f5312dc46deb986e368b6828bedbedd297f6e.zip | |
spi: Use BITS_TO_BYTES()
BITS_TO_BYTES() is the existing macro which takes care about full
bytes that may fully hold the given amount of bits. Use it.
Signed-off-by: Andy Shevchenko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
Diffstat (limited to 'drivers/spi/spi.c')
| -rw-r--r-- | drivers/spi/spi.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 05f702339182..8d6304cb061e 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3877,11 +3877,9 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message) */ if ((spi->mode & SPI_CS_WORD) && (!(ctlr->mode_bits & SPI_CS_WORD) || spi_get_csgpiod(spi, 0))) { - size_t maxsize; + size_t maxsize = BITS_TO_BYTES(spi->bits_per_word); int ret; - maxsize = (spi->bits_per_word + 7) / 8; - /* spi_split_transfers_maxsize() requires message->spi */ message->spi = spi; |
