summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-altera.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2013-08-29 23:41:20 +0800
committerMark Brown <broonie@linaro.org>2013-08-31 14:10:41 +0100
commitf073d37de0468d517b1fb682b5bea5bfa9ce55c9 (patch)
treeb92e9fc29c88e73bf3fc6ac2f9c8ffb21539c830 /drivers/spi/spi-altera.c
parentb3136f8f7c49bb4ca71247046f688fdffa104310 (diff)
downloadop-kernel-dev-f073d37de0468d517b1fb682b5bea5bfa9ce55c9.zip
op-kernel-dev-f073d37de0468d517b1fb682b5bea5bfa9ce55c9.tar.gz
spi: altera: Use DIV_ROUND_UP to calculate hw->bytes_per_word
The Altera SPI hardware can be configured to support data width from 1 to 32 since Quartus II 8.1. To avoid truncation by integer division, use DIV_ROUND_UP to calculate hw->bytes_per_word. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Thomas Chou <thomas@wytron.com.tw> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi-altera.c')
-rw-r--r--drivers/spi/spi-altera.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c
index dce4a7e..523f2f6 100644
--- a/drivers/spi/spi-altera.c
+++ b/drivers/spi/spi-altera.c
@@ -134,7 +134,7 @@ static int altera_spi_txrx(struct spi_device *spi, struct spi_transfer *t)
hw->tx = t->tx_buf;
hw->rx = t->rx_buf;
hw->count = 0;
- hw->bytes_per_word = t->bits_per_word / 8;
+ hw->bytes_per_word = DIV_ROUND_UP(t->bits_per_word, 8);
hw->len = t->len / hw->bytes_per_word;
if (hw->irq >= 0) {
OpenPOWER on IntegriCloud