Skip to content

Commit

Permalink
spi: tegra: Use DIV_ROUND_UP instead of open coded
Browse files Browse the repository at this point in the history
This also makes the intention more clear.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Axel Lin authored and Mark Brown committed Sep 16, 2013
1 parent 272b98c commit e91d235
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/spi/spi-tegra114.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/spi/spi-tegra20-sflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/spi/spi-tegra20-slink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e91d235

Please sign in to comment.