summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-npcm-pspi.c
diff options
context:
space:
mode:
authorTomer Maimon <tmaimon77@gmail.com>2018-12-04 15:40:35 +0200
committerMark Brown <broonie@kernel.org>2018-12-06 20:23:26 +0000
commit1fa33be36cfc8908be951ed56113906f422add50 (patch)
tree3c004a10a58eb87d3152d50a3519958f006cc27b /drivers/spi/spi-npcm-pspi.c
parent194276b073a10f04b420484bd81fa4dbb3ae0e1e (diff)
spi: npcm: Modify pspi send function
Align pspi send function code with the recieve function code, Also simplify the code a bit with early return. Signed-off-by: Tomer Maimon <tmaimon77@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-npcm-pspi.c')
-rw-r--r--drivers/spi/spi-npcm-pspi.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/spi/spi-npcm-pspi.c b/drivers/spi/spi-npcm-pspi.c
index dda91c19af93..e1dca79b9090 100644
--- a/drivers/spi/spi-npcm-pspi.c
+++ b/drivers/spi/spi-npcm-pspi.c
@@ -199,14 +199,22 @@ static void npcm_pspi_send(struct npcm_pspi *priv)
wsize = min(bytes_per_word(priv->bits_per_word), priv->tx_bytes);
priv->tx_bytes -= wsize;
- if (priv->tx_buf) {
- if (wsize == 1)
- iowrite8(*priv->tx_buf, NPCM_PSPI_DATA + priv->base);
- if (wsize == 2)
- iowrite16(*priv->tx_buf, NPCM_PSPI_DATA + priv->base);
+ if (!priv->tx_buf)
+ return;
- priv->tx_buf += wsize;
+ switch (wsize) {
+ case 1:
+ iowrite8(*priv->tx_buf, NPCM_PSPI_DATA + priv->base);
+ break;
+ case 2:
+ iowrite16(*priv->tx_buf, NPCM_PSPI_DATA + priv->base);
+ break;
+ default:
+ WARN_ON_ONCE(1);
+ return;
}
+
+ priv->tx_buf += wsize;
}
static void npcm_pspi_recv(struct npcm_pspi *priv)