Skip to contentSkip to conversation

serial: 8250_keba: follow ups from review

PATCH New Gerhard Engleder 1 participant 4 messages Dec 16, 2025 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

cover serial: 8250_keba: follow ups from review

Andy Shevchenko and Ilpo Järvinen had some review comments after the 8250_keba driver was merged to tty/tty-next. So here are the follow ups from the review to bring the driver in the expected shape.

Gerhard Engleder (3):
serial: 8250_keba: Add missing includes
serial: 8250_keba: Add ICR defines
serial: 8250_keba: Use dev_err_probe()

 drivers/tty/serial/8250/8250_keba.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)
Signature · 1 line
2.39.5
#1 lore raw

PATCH 1/3 serial: 8250_keba: Add missing includes

From: Gerhard Engleder <[email protected]>

Andy and Ilpo suggested to add missing includes, because the code shall not rely on indirect includes. Add missing includes and remove one include, which only enabled indirect includes.

---
 drivers/tty/serial/8250/8250_keba.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_keba.c +9 -1
index c05b89551b12..e9e59ce79138 100644
@@ -6,10 +6,18 @@
  */
 
 #include <linux/auxiliary_bus.h>
-#include <linux/device.h>
+#include <linux/bits.h>
+#include <linux/container_of.h>
+#include <linux/dev_printk.h>
+#include <linux/device/devres.h>
+#include <linux/err.h>
 #include <linux/io.h>
 #include <linux/misc/keba.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
+#include <linux/serial_core.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
 
 #include "8250.h"
 
Signature · 1 line
2.39.5
#2 lore raw

PATCH 2/3 serial: 8250_keba: Add ICR defines

In reply to Gerhard Engleder

From: Gerhard Engleder <[email protected]>

Add defines for better readability of the Indexed Control Register (ICR) access. In enhanced mode SCR and LSR registers are used for ICR access. The behavior of these register is different in this mode and that shall be documented with dedicated defines.

---
 drivers/tty/serial/8250/8250_keba.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/tty/serial/8250/8250_keba.c +7 -3
index e9e59ce79138..149953c6a288 100644
@@ -51,6 +51,10 @@ enum kuart_mode {
 #define KUART_CAPABILITY_RS232	BIT(KUART_MODE_RS232)
 #define KUART_CAPABILITY_MASK	GENMASK(3, 0)
 
+/* registers for Indexed Control Register access in enhanced mode */
+#define KUART_EMODE_ICR_OFFSET	UART_SCR
+#define KUART_EMODE_ICR_VALUE	UART_LSR
+
 /* Additional Control Register DTR line configuration */
 #define UART_ACR_DTRLC_MASK		0x18
 #define UART_ACR_DTRLC_COMPAT		0x00
@@ -98,13 +102,13 @@ static void kuart_dtr_line_config(struct uart_8250_port *up, u8 dtrlc)
 	u8 acr;
 
 	/* set index register to 0 to access ACR register */
-	serial_out(up, UART_SCR, UART_ACR);
+	serial_out(up, KUART_EMODE_ICR_OFFSET, UART_ACR);
 
 	/* set value register to 0x10 writing DTR mode (1,0) */
-	acr = serial_in(up, UART_LSR);
+	acr = serial_in(up, KUART_EMODE_ICR_VALUE);
 	acr &= ~UART_ACR_DTRLC_MASK;
 	acr |= dtrlc;
-	serial_out(up, UART_LSR, acr);
+	serial_out(up, KUART_EMODE_ICR_VALUE, acr);
 }
 
 static int kuart_rs485_config(struct uart_port *port, struct ktermios *termios,
Signature · 1 line
2.39.5
#3 lore raw

PATCH 3/3 serial: 8250_keba: Use dev_err_probe()

In reply to Gerhard Engleder

From: Gerhard Engleder <[email protected]>

Simplify the probe() code by using dev_err_probe().

---
 drivers/tty/serial/8250/8250_keba.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/tty/serial/8250/8250_keba.c +3 -4
index 149953c6a288..f94d97e69dc5 100644
@@ -252,10 +252,9 @@ static int kuart_probe(struct auxiliary_device *auxdev,
 	}
 
 	retval = serial8250_register_8250_port(&uart);
-	if (retval < 0) {
-		dev_err(&auxdev->dev, "UART registration failed!\n");
-		return retval;
-	}
+	if (retval < 0)
+		return dev_err_probe(&auxdev->dev, retval,
+				     "UART registration failed!\n");
 	kuart->line = retval;
 
 	return 0;
Signature · 1 line
2.39.5