]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
spi: Replace open coded variant of spi_bpw_to_bytes()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 23 Mar 2026 14:04:45 +0000 (15:04 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 23 Mar 2026 15:45:00 +0000 (15:45 +0000)
__spi_validate() open codes the functionality of spi_bpw_to_bytes().
Replace the custom piece by the call to the mentioned function.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20260323140445.3496736-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c

index bf1df365f795eb3418b73b6d02eb2f691cef0f36..418d69f8916279d7e9b1c0351a618894d5e780af 100644 (file)
@@ -4282,12 +4282,7 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
                 * SPI transfer length should be multiple of SPI word size
                 * where SPI word size should be power-of-two multiple.
                 */
-               if (xfer->bits_per_word <= 8)
-                       w_size = 1;
-               else if (xfer->bits_per_word <= 16)
-                       w_size = 2;
-               else
-                       w_size = 4;
+               w_size = spi_bpw_to_bytes(xfer->bits_per_word);
 
                /* No partial transfers accepted */
                if (xfer->len % w_size)