From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
To: linux-spi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, bert@biot.com,
sander@svanheule.net, mail@birger-koblitz.de,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Subject: [PATCH v3 2/2] spi: realtek-rtl: Improve readability when clearing the size mask
Date: Sun, 31 Jul 2022 22:21:52 +0200 [thread overview]
Message-ID: <20220731202152.1358252-3-martin.blumenstingl@googlemail.com> (raw)
In-Reply-To: <20220731202152.1358252-1-martin.blumenstingl@googlemail.com>
Define the bitmask RTL_SPI_SFCSR_LEN_MASK so it only sets the bits of
this specific part of the register instead of setting all bits except
the relevant ones. This makes it consistent with single bit macros in
the spi-realtek-rtl driver as well as with the approach that many other
drivers use.
Suggested-by: Sander Vanheule <sander@svanheule.net>
Tested-by: Sander Vanheule <sander@svanheule.net>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
drivers/spi/spi-realtek-rtl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-realtek-rtl.c b/drivers/spi/spi-realtek-rtl.c
index 866b0477dbd7..0371d44cbfbd 100644
--- a/drivers/spi/spi-realtek-rtl.c
+++ b/drivers/spi/spi-realtek-rtl.c
@@ -20,7 +20,7 @@ struct rtspi {
#define RTL_SPI_SFCSR_CSB1 BIT(30)
#define RTL_SPI_SFCSR_RDY BIT(27)
#define RTL_SPI_SFCSR_CS BIT(24)
-#define RTL_SPI_SFCSR_LEN_MASK ~(0x03 << 28)
+#define RTL_SPI_SFCSR_LEN_MASK (0x03 << 28)
#define RTL_SPI_SFCSR_LEN1 (0x00 << 28)
#define RTL_SPI_SFCSR_LEN4 (0x03 << 28)
@@ -49,7 +49,7 @@ static void set_size(struct rtspi *rtspi, int size)
u32 value;
value = readl(REG(RTL_SPI_SFCSR));
- value &= RTL_SPI_SFCSR_LEN_MASK;
+ value &= ~RTL_SPI_SFCSR_LEN_MASK;
if (size == 4)
value |= RTL_SPI_SFCSR_LEN4;
else if (size == 1)
--
2.37.1
prev parent reply other threads:[~2022-07-31 20:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-31 20:21 [PATCH v3 0/2] spi: realtek-rtl: two small improvements Martin Blumenstingl
2022-07-31 20:21 ` [PATCH v3 1/2] spi: realtek-rtl: Add compile testing support Martin Blumenstingl
2022-08-16 19:55 ` Sander Vanheule
2022-07-31 20:21 ` Martin Blumenstingl [this message]
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=20220731202152.1358252-3-martin.blumenstingl@googlemail.com \
--to=martin.blumenstingl@googlemail.com \
--cc=bert@biot.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mail@birger-koblitz.de \
--cc=sander@svanheule.net \
/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
all inboxes | Powered by JetHome®