Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1301219 > unrolled thread

[PATCH] Staging: speakup: Fix getting port information

Started bySamuel Thibault <samuel.thibault@ens-lyon.org>
First post2016-01-05 02:20 +0100
Last post2016-01-05 10:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] Staging: speakup: Fix getting port information Samuel Thibault <samuel.thibault@ens-lyon.org> - 2016-01-05 02:20 +0100
    Re: [PATCH] Staging: speakup: Fix getting port information Dan Carpenter <dan.carpenter@oracle.com> - 2016-01-05 10:40 +0100

#1301219 — [PATCH] Staging: speakup: Fix getting port information

FromSamuel Thibault <samuel.thibault@ens-lyon.org>
Date2016-01-05 02:20 +0100
Subject[PATCH] Staging: speakup: Fix getting port information
Message-ID<qNos2-34q-7@gated-at.bofh.it>
Patch 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@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,9 @@
 #include "spk_priv.h"
 #include "serialio.h"
 
+#include <linux/serial_core.h>
+#include <asm/serial.h>
+
 #ifndef SERIAL_PORT_DFNS
 #define SERIAL_PORT_DFNS
 #endif
@@ -23,9 +26,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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1301375

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-01-05 10:40 +0100
Message-ID<qNwfU-ag-25@gated-at.bofh.it>
In reply to#1301219
On Tue, Jan 05, 2016 at 02:19:12AM +0100, Samuel Thibault wrote:
> --- a/drivers/staging/speakup/serialio.c
> +++ b/drivers/staging/speakup/serialio.c
> @@ -6,6 +6,9 @@
>  #include "spk_priv.h"
>  #include "serialio.h"
>  
> +#include <linux/serial_core.h>
> +#include <asm/serial.h>
> +

I'm sorry to do this but can you add a comment here, otherwise someone
is going to just change it back because it causes a checkpatch.pl
warning.  Make it a big ugly warning.

#include <linux/serial_core.h>
/* WARNING:  Do not change this to <linux/serial.h> without testing. */
#include <asm/serial.h>

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web