From: Marc Kleine-Budde <mkl@pengutronix.de>
To: linux-spi@vger.kernel.org, Fabio Estevam <festevam@gmail.com>,
Marek Vasut <marex@denx.de>
Cc: kernel@pengutronix.de, linux-imx@nxp.com,
Mark Brown <broonie@kernel.org>,
linux-arm-kernel@lists.infradead.org,
Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [RFC 5/9] spi: spi-imx: spi_imx_buf_rx_swap_u32(): replace open coded swahw32()
Date: Mon, 2 May 2022 18:52:06 +0200 [thread overview]
Message-ID: <20220502165210.1956397-6-mkl@pengutronix.de> (raw)
In-Reply-To: <20220502165210.1956397-1-mkl@pengutronix.de>
This patch replaces an open coded swahw32().
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/spi/spi-imx.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index a63cb26f33fc..e817cf95eea6 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -289,17 +289,16 @@ static bool spi_imx_can_dma(struct spi_master *master, struct spi_device *spi,
static void spi_imx_buf_rx_swap_u32(struct spi_imx_data *spi_imx)
{
unsigned int val = readl(spi_imx->base + MXC_CSPIRXDATA);
-#ifdef __LITTLE_ENDIAN
- unsigned int bytes_per_word;
-#endif
if (spi_imx->rx_buf) {
#ifdef __LITTLE_ENDIAN
+ unsigned int bytes_per_word;
+
bytes_per_word = spi_imx_bytes_per_word(spi_imx->bits_per_word);
if (bytes_per_word == 1)
val = swab32(val);
else if (bytes_per_word == 2)
- val = (val << 16) | (val >> 16);
+ val = swahw32(val);
#endif
*(u32 *)spi_imx->rx_buf = val;
spi_imx->rx_buf += sizeof(u32);
@@ -355,7 +354,7 @@ static void spi_imx_buf_tx_swap_u32(struct spi_imx_data *spi_imx)
if (bytes_per_word == 1)
val = swab32(val);
else if (bytes_per_word == 2)
- val = (val << 16) | (val >> 16);
+ val = swahw32(val);
#endif
writel(val, spi_imx->base + MXC_CSPITXDATA);
}
--
2.35.1
next prev parent reply other threads:[~2022-05-02 16:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-02 16:52 [RFC 0/9] spi: spi-imx: cleanups and performance improvements Marc Kleine-Budde
2022-05-02 16:52 ` [RFC 1/9] spi: spi-imx: fix sparse warning: add identifier name to function definition Marc Kleine-Budde
2022-05-02 16:52 ` [RFC 2/9] spi: spi-imx: avoid unnecessary line continuations Marc Kleine-Budde
2022-05-02 16:52 ` [RFC 3/9] spi: spi-imx: mx51_ecspi_intctrl(): prefer 'unsigned int' to bare use of 'unsigned' Marc Kleine-Budde
2022-05-02 16:52 ` [RFC 4/9] spi: spi-imx: spi_imx_buf_rx_swap_u32(): fix sparse warning Marc Kleine-Budde
2022-05-02 16:52 ` Marc Kleine-Budde [this message]
2022-05-02 16:52 ` [RFC 6/9] spi: spi-imx: complete conversion from master -> controller Marc Kleine-Budde
2022-05-02 16:52 ` [RFC 7/9] spi: spi-imx: replace struct spi_imx_data::bitbang by pointer to struct spi_controller Marc Kleine-Budde
2022-05-02 17:14 ` Baruch Siach
2022-05-02 17:33 ` Marc Kleine-Budde
2022-05-02 16:52 ` [RFC 8/9] spi: spi-imx: add PIO polling support Marc Kleine-Budde
2022-05-02 16:52 ` [RFC 9/9] spi: spi-imx: mx51_ecspi_prepare_message(): skip writing MX51_ECSPI_CONFIG register if unchanged Marc Kleine-Budde
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=20220502165210.1956397-6-mkl@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=broonie@kernel.org \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-spi@vger.kernel.org \
--cc=marex@denx.de \
/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).