spi: npcm: Modify pspi send function
authorTomer Maimon <tmaimon77@gmail.com>
Tue, 4 Dec 2018 13:40:35 +0000 (15:40 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 6 Dec 2018 20:23:26 +0000 (20:23 +0000)
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>
drivers/spi/spi-npcm-pspi.c

index dda91c19af93e7f0f523363cd7410f0d8fa1f652..e1dca79b9090358d36ed20d5239c4b05a2ed0d6d 100644 (file)
@@ -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)