]> Pileus Git - ~andy/linux/commitdiff
spi: tegra: Use DIV_ROUND_UP instead of open coded
authorAxel Lin <axel.lin@ingics.com>
Fri, 30 Aug 2013 03:00:23 +0000 (11:00 +0800)
committerMark Brown <broonie@linaro.org>
Mon, 16 Sep 2013 23:24:56 +0000 (00:24 +0100)
This also makes the intention more clear.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi-tegra114.c
drivers/spi/spi-tegra20-sflash.c
drivers/spi/spi-tegra20-slink.c

index 145dd435483b2d12e304ce3bb46f97a2f4baab4e..946ff7377352d5cf8bc41d77bb69e849eac0b7ae 100644 (file)
@@ -267,7 +267,7 @@ static unsigned tegra_spi_calculate_curr_xfer_param(
        unsigned max_len;
        unsigned total_fifo_words;
 
-       tspi->bytes_per_word = (bits_per_word - 1) / 8 + 1;
+       tspi->bytes_per_word = DIV_ROUND_UP(bits_per_word, 8);
 
        if (bits_per_word == 8 || bits_per_word == 16) {
                tspi->is_packed = 1;
index 1d814dc6e0000c7743b6844db332f46a6516389c..64c9cf5111750185212d63899d992f35f006db84 100644 (file)
@@ -173,7 +173,7 @@ static unsigned tegra_sflash_calculate_curr_xfer_param(
        unsigned remain_len = t->len - tsd->cur_pos;
        unsigned max_word;
 
-       tsd->bytes_per_word = (t->bits_per_word - 1) / 8 + 1;
+       tsd->bytes_per_word = DIV_ROUND_UP(t->bits_per_word, 8);
        max_word = remain_len / tsd->bytes_per_word;
        if (max_word > SPI_FIFO_DEPTH)
                max_word = SPI_FIFO_DEPTH;
index c70353672a23df85234c5089c28af6a155d33a99..231b84523d3794fd79a5307988beee103905e173 100644 (file)
@@ -283,7 +283,7 @@ static unsigned tegra_slink_calculate_curr_xfer_param(
        unsigned total_fifo_words;
 
        bits_per_word = t->bits_per_word;
-       tspi->bytes_per_word = (bits_per_word - 1) / 8 + 1;
+       tspi->bytes_per_word = DIV_ROUND_UP(bits_per_word, 8);
 
        if (bits_per_word == 8 || bits_per_word == 16) {
                tspi->is_packed = 1;