From: Artem Shimko <a.shimko.dev@gmail.com>
To: sashal@kernel.org, miquel.raynal@bootlin.com,
phil.edworthy@renesas.com,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Jiri Slaby" <jirislaby@kernel.org>
Cc: Artem Shimko <a.shimko.dev@gmail.com>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: [PATCH] serial: 8250_dw: Clean up register macros and error handling
Date: Sat, 25 Apr 2026 00:05:24 +0300 [thread overview]
Message-ID: <20260424210525.1574497-1-a.shimko.dev@gmail.com> (raw)
Align register offset definitions for DW_UART_USR, DW_UART_DMASA,
OCTEON_UART_USR, RZN1_UART_TDMACR and RZN1_UART_RDMACR to improve
readability. Replace raw shift with FIELD_PREP() and GENMASK() for
RZN1_UART_xDMACR burst field definitions — this documents that the
field occupies bits [2:1] and prevents accidental overflow when new
burst values are added.
Simplify ENXIO handling in dw8250_probe(): instead of explicitly
zeroing 'err' and then checking it, use a single conditional that
allows -ENXIO (no interrupt, fall back to polling) while treating
any other error as fatal. No functional change intended.
Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com>
---
Hi,
This small cleanup patch addresses a few minor style and robustness
issues I noticed while working with the driver.
Thank you.
--
Regards,
Artem
drivers/tty/serial/8250/8250_dw.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index 94beadb4024d..3e7b79154d9d 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -35,13 +35,13 @@
#include "8250_dwlib.h"
/* Offsets for the DesignWare specific registers */
-#define DW_UART_USR 0x1f /* UART Status Register */
-#define DW_UART_DMASA 0xa8 /* DMA Software Ack */
+#define DW_UART_USR 0x1f /* UART Status Register */
+#define DW_UART_DMASA 0xa8 /* DMA Software Ack */
-#define OCTEON_UART_USR 0x27 /* UART Status Register */
+#define OCTEON_UART_USR 0x27 /* UART Status Register */
-#define RZN1_UART_TDMACR 0x10c /* DMA Control Register Transmit Mode */
-#define RZN1_UART_RDMACR 0x110 /* DMA Control Register Receive Mode */
+#define RZN1_UART_TDMACR 0x10c /* DMA Control Register Transmit Mode */
+#define RZN1_UART_RDMACR 0x110 /* DMA Control Register Receive Mode */
/* DesignWare specific register fields */
#define DW_UART_IIR_IID GENMASK(3, 0)
@@ -52,9 +52,10 @@
/* Renesas specific register fields */
#define RZN1_UART_xDMACR_DMA_EN BIT(0)
-#define RZN1_UART_xDMACR_1_WORD_BURST (0 << 1)
-#define RZN1_UART_xDMACR_4_WORD_BURST (1 << 1)
-#define RZN1_UART_xDMACR_8_WORD_BURST (2 << 1)
+#define RZN1_UART_xDMACR_BURST_MASK GENMASK(2, 1)
+#define RZN1_UART_xDMACR_1_WORD_BURST FIELD_PREP(RZN1_UART_xDMACR_BURST_MASK, 0)
+#define RZN1_UART_xDMACR_4_WORD_BURST FIELD_PREP(RZN1_UART_xDMACR_BURST_MASK, 1)
+#define RZN1_UART_xDMACR_8_WORD_BURST FIELD_PREP(RZN1_UART_xDMACR_BURST_MASK, 2)
#define RZN1_UART_xDMACR_BLK_SZ(x) ((x) << 3)
/* Quirks */
@@ -729,9 +730,7 @@ static int dw8250_probe(struct platform_device *pdev)
err = uart_read_port_properties(p);
/* no interrupt -> fall back to polling */
- if (err == -ENXIO)
- err = 0;
- if (err)
+ if (err && err != -ENXIO)
return err;
switch (p->iotype) {
--
2.43.0
next reply other threads:[~2026-04-24 21:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-24 21:05 Artem Shimko [this message]
2026-04-27 7:02 ` [PATCH] serial: 8250_dw: Clean up register macros and error handling Andy Shevchenko
2026-05-05 12:15 ` Artem Shimko
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=20260424210525.1574497-1-a.shimko.dev@gmail.com \
--to=a.shimko.dev@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=miquel.raynal@bootlin.com \
--cc=phil.edworthy@renesas.com \
--cc=sashal@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.