Skip to content

Commit 11ae2e6

Browse files
fancerbroonie
authored andcommitted
spi: dw: Convert to using BITS_TO_BYTES() macro
Since commit dd3e7cb ("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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 6be871d commit 11ae2e6

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/spi/spi-dw-core.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#include <linux/bitfield.h>
9+
#include <linux/bitops.h>
910
#include <linux/dma-mapping.h>
1011
#include <linux/interrupt.h>
1112
#include <linux/module.h>
@@ -421,10 +422,7 @@ static int dw_spi_transfer_one(struct spi_controller *host,
421422
int ret;
422423

423424
dws->dma_mapped = 0;
424-
dws->n_bytes =
425-
roundup_pow_of_two(DIV_ROUND_UP(transfer->bits_per_word,
426-
BITS_PER_BYTE));
427-
425+
dws->n_bytes = roundup_pow_of_two(BITS_TO_BYTES(transfer->bits_per_word));
428426
dws->tx = (void *)transfer->tx_buf;
429427
dws->tx_len = transfer->len / dws->n_bytes;
430428
dws->rx = transfer->rx_buf;

0 commit comments

Comments
 (0)