Help with serial synths in 4.X kernels

Samuel Thibault samuel.thibault at ens-lyon.org
Thu Feb 25 20:41:22 EST 2016


Hello,

covici at ccs.covici.com, on Tue 23 Feb 2016 10:05:22 -0500, wrote:
> Do you have the serialio.c patched to comment out the return null in
> around line 42?

Just wondering...

Is it known that passing

8250.nr_uarts=0

as a kernel command-line parameter has actually the same effect?  It'll
just prevent the normal serial driver from taking the ports, and thus
speakup will not have any trouble accessing them.

About the patches I have sent to the linux kernel mailing list, only the
attached one is needed to fix serial port access.

About proper serial port access, somebody from the Outreachy intern
program is currently having a look.

Samuel
-------------- next part --------------
Subject: [PATCH] Staging: speakup: Fix getting port information

Commit f79b0d9c223c ("staging: speakup: Fixed warning <linux/serial.h>
instead of <asm/serial.h>") broke the port information in the speakup
driver: SERIAL_PORT_DFNS only gets defined if asm/serial.h is included,
and no other header includes asm/serial.h.

We here make sure serialio.c does get the arch-specific definition of
SERIAL_PORT_DFNS from asm/serial.h, if any.

Along the way, this makes sure that we do have information for the
requested serial port number (index)

Signed-off-by: Samuel Thibault <samuel.thibault at ens-lyon.org>
Fixes: f79b0d9c223c ("staging: speakup: Fixed warning <linux/serial.h> instead of <asm/serial.h>")

--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -6,6 +6,11 @@
 #include "spk_priv.h"
 #include "serialio.h"
 
+#include <linux/serial_core.h>
+/* WARNING:  Do not change this to <linux/serial.h> without testing that
+ * SERIAL_PORT_DFNS does get defined to the appropriate value. */
+#include <asm/serial.h>
+
 #ifndef SERIAL_PORT_DFNS
 #define SERIAL_PORT_DFNS
 #endif
@@ -23,9 +28,15 @@ const struct old_serial_port *spk_serial
 	int baud = 9600, quot = 0;
 	unsigned int cval = 0;
 	int cflag = CREAD | HUPCL | CLOCAL | B9600 | CS8;
-	const struct old_serial_port *ser = rs_table + index;
+	const struct old_serial_port *ser;
 	int err;
 
+	if (index >= ARRAY_SIZE(rs_table)) {
+		pr_info("no port info for ttyS%d\n", index);
+		return NULL;
+	}
+	ser = rs_table + index;
+
 	/*	Divisor, bytesize and parity */
 	quot = ser->baud_base / baud;
 	cval = cflag & (CSIZE | CSTOPB);


More information about the Speakup mailing list