spi: dw: Convert to using BITS_TO_BYTES() macro
authorSerge Semin <fancer.lancer@gmail.com>
Wed, 24 Apr 2024 15:06:42 +0000 (18:06 +0300)
committerMark Brown <broonie@kernel.org>
Fri, 3 May 2024 02:09:22 +0000 (11:09 +0900)
Since commit dd3e7cba1627 ("ocfs2/dlm: move BITS_TO_BYTES() to bitops.h
for wider use") there is a generic helper available to calculate a number
of bytes needed to accommodate the specified number of bits. Let's use it
instead of the hard-coded DIV_ROUND_UP() macro function.

Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240424150657.9678-2-fancer.lancer@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-dw-core.c

index 0274c9295514c089685455fc383fad67344f634d..722b5eb1f7098aeb398b4368c9f93abf994d5c36 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <linux/bitfield.h>
+#include <linux/bitops.h>
 #include <linux/dma-mapping.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
@@ -421,10 +422,7 @@ static int dw_spi_transfer_one(struct spi_controller *host,
        int ret;
 
        dws->dma_mapped = 0;
-       dws->n_bytes =
-               roundup_pow_of_two(DIV_ROUND_UP(transfer->bits_per_word,
-                                               BITS_PER_BYTE));
-
+       dws->n_bytes = roundup_pow_of_two(BITS_TO_BYTES(transfer->bits_per_word));
        dws->tx = (void *)transfer->tx_buf;
        dws->tx_len = transfer->len / dws->n_bytes;
        dws->rx = transfer->rx_buf;