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>
This commit is contained in:
parent
194276b073
commit
1fa33be36c
1 changed files with 14 additions and 6 deletions
|
@ -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);
|
wsize = min(bytes_per_word(priv->bits_per_word), priv->tx_bytes);
|
||||||
priv->tx_bytes -= wsize;
|
priv->tx_bytes -= wsize;
|
||||||
|
|
||||||
if (priv->tx_buf) {
|
if (!priv->tx_buf)
|
||||||
if (wsize == 1)
|
return;
|
||||||
iowrite8(*priv->tx_buf, NPCM_PSPI_DATA + priv->base);
|
|
||||||
if (wsize == 2)
|
|
||||||
iowrite16(*priv->tx_buf, NPCM_PSPI_DATA + priv->base);
|
|
||||||
|
|
||||||
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)
|
static void npcm_pspi_recv(struct npcm_pspi *priv)
|
||||||
|
|
Loading…
Reference in a new issue