From: Tomer Maimon <tmaimon77@gmail.com>
To: broonie@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com,
yuenn@google.com, venture@google.com, brendanhiggins@google.com,
avifishman70@gmail.com, joel@jms.id.au
Cc: linux-spi@vger.kernel.org, openbmc@lists.ozlabs.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Tomer Maimon <tmaimon77@gmail.com>
Subject: [PATCH v1] spi: npcm: Modify pspi send function
Date: Tue, 4 Dec 2018 15:40:35 +0200 [thread overview]
Message-ID: <20181204134035.124079-1-tmaimon77@gmail.com> (raw)
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>
---
drivers/spi/spi-npcm-pspi.c | 20 ++++++++++++++------
1 file 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)
--
2.14.1
next reply other threads:[~2018-12-04 13:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-04 13:40 Tomer Maimon [this message]
2018-12-06 20:26 ` Applied "spi: npcm: Modify pspi send function" to the spi tree Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181204134035.124079-1-tmaimon77@gmail.com \
--to=tmaimon77@gmail.com \
--cc=avifishman70@gmail.com \
--cc=brendanhiggins@google.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=joel@jms.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=openbmc@lists.ozlabs.org \
--cc=robh+dt@kernel.org \
--cc=venture@google.com \
--cc=yuenn@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).