All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: speakup: Fix getting port information
@ 2016-01-02 23:25 Samuel Thibault
  2016-01-02 23:49 ` Samuel Thibault
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Samuel Thibault @ 2016-01-02 23:25 UTC (permalink / raw)
  To: William Hubbs, Chris Brannon, Kirk Reiser, Greg Kroah-Hartman,
	speakup, devel, linux-kernel

5e6dc54 broke the port information in the speakup driver:
SERIAL_PORT_DFNS only gets defined if asm/serial.h is included.

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

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

--- 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
@@ -26,6 +29,11 @@ const struct old_serial_port *spk_serial
 	const struct old_serial_port *ser = rs_table + index;
 	int err;
 
+	if (index > sizeof(rs_table) / sizeof(*rs_table)) {
+		pr_info("no port info for ttyS%d\n", index);
+		return NULL;
+	}
+
 	/*	Divisor, bytesize and parity */
 	quot = ser->baud_base / baud;
 	cval = cflag & (CSIZE | CSTOPB);

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Staging: speakup: Fix getting port information
  2016-01-02 23:25 [PATCH] Staging: speakup: Fix getting port information Samuel Thibault
@ 2016-01-02 23:49 ` Samuel Thibault
  2016-01-03  0:10 ` covici
  2016-01-04 12:20 ` Dan Carpenter
  2 siblings, 0 replies; 15+ messages in thread
From: Samuel Thibault @ 2016-01-02 23:49 UTC (permalink / raw)
  To: William Hubbs, Chris Brannon, Kirk Reiser, Greg Kroah-Hartman,
	speakup, devel, linux-kernel

Samuel Thibault, on Sun 03 Jan 2016 00:25:29 +0100, wrote:
> 5e6dc54 broke the port information in the speakup driver:
> SERIAL_PORT_DFNS only gets defined if asm/serial.h is included.
> 
> Along the way, make sure that we do have information for the requested
> serial port number (index)

(It'd be good to get this into 4.4 and 4.3.4).

> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> 
> --- 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
> @@ -26,6 +29,11 @@ const struct old_serial_port *spk_serial
>  	const struct old_serial_port *ser = rs_table + index;
>  	int err;
>  
> +	if (index > sizeof(rs_table) / sizeof(*rs_table)) {
> +		pr_info("no port info for ttyS%d\n", index);
> +		return NULL;
> +	}
> +
>  	/*	Divisor, bytesize and parity */
>  	quot = ser->baud_base / baud;
>  	cval = cflag & (CSIZE | CSTOPB);

-- 
Samuel
AUTHOR
     FvwmM4 is the result of a random  bit  mutation  on  a  hard
     disk,  presumably  a  result  of  a  cosmic-ray or some such
     thing.
(extrait de la page de man de FvwmM4)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Staging: speakup: Fix getting port information
  2016-01-02 23:25 [PATCH] Staging: speakup: Fix getting port information Samuel Thibault
  2016-01-02 23:49 ` Samuel Thibault
@ 2016-01-03  0:10 ` covici
  2016-01-03  0:56   ` Samuel Thibault
  2016-01-04 12:20 ` Dan Carpenter
  2 siblings, 1 reply; 15+ messages in thread
From: covici @ 2016-01-03  0:10 UTC (permalink / raw)
  To: Samuel Thibault, William Hubbs, Chris Brannon, Kirk Reiser,
	Greg Kroah-Hartman, speakup, devel, linux-kernel

I had a patch which also worked, but yours may be better -- I enclose it
here for your information.

--- drivers/staging/speakup/serialio.h.old	2015-08-30 14:34:09.000000000 -0400
+++ drivers/staging/speakup/serialio.h	2015-10-07 06:27:04.880829874 -0400
@@ -1,22 +1,24 @@
 #ifndef _SPEAKUP_SERIAL_H
 #define _SPEAKUP_SERIAL_H
 
+#include <linux/serial_core.h>
 #include <linux/serial.h>	/* for rs_table, serial constants */
 #include <linux/serial_reg.h>	/* for more serial constants */
 #ifndef __sparc__
-#include <linux/serial.h>
+#include <asm/serial.h>
 #endif
 
 /*
  * this is cut&paste from 8250.h. Get rid of the structure, the definitions
  * and this whole broken driver.
  */
+
 struct old_serial_port {
 	unsigned int uart; /* unused */
 	unsigned int baud_base;
 	unsigned int port;
 	unsigned int irq;
-	unsigned int flags; /* unused */
+  upf_t        flags; /*unused*/
 };
 
 /* countdown values for serial timeouts in us */
@@ -34,7 +36,6 @@
 #define SPK_TIMEOUT 100
 #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
 
-#define spk_serial_tx_busy() \
-	((inb(speakup_info.port_tts + UART_LSR) & BOTH_EMPTY) != BOTH_EMPTY)
+#define spk_serial_tx_busy() ((inb(speakup_info.port_tts + UART_LSR) & BOTH_EMPTY) != BOTH_EMPTY)
 
 #endif

Samuel Thibault <samuel.thibault@ens-lyon.org> wrote:

> 5e6dc54 broke the port information in the speakup driver:
> SERIAL_PORT_DFNS only gets defined if asm/serial.h is included.
> 
> Along the way, make sure that we do have information for the requested
> serial port number (index)
> 
> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> 
> --- 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
> @@ -26,6 +29,11 @@ const struct old_serial_port *spk_serial
>  	const struct old_serial_port *ser = rs_table + index;
>  	int err;
>  
> +	if (index > sizeof(rs_table) / sizeof(*rs_table)) {
> +		pr_info("no port info for ttyS%d\n", index);
> +		return NULL;
> +	}
> +
>  	/*	Divisor, bytesize and parity */
>  	quot = ser->baud_base / baud;
>  	cval = cflag & (CSIZE | CSTOPB);
> _______________________________________________
> Speakup mailing list
> Speakup@linux-speakup.org
> http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup
> 

-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

         John Covici
         covici@ccs.covici.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Staging: speakup: Fix getting port information
  2016-01-03  0:10 ` covici
@ 2016-01-03  0:56   ` Samuel Thibault
  2016-01-03  1:31     ` covici
  2016-01-04 12:22     ` Dan Carpenter
  0 siblings, 2 replies; 15+ messages in thread
From: Samuel Thibault @ 2016-01-03  0:56 UTC (permalink / raw)
  To: William Hubbs, Chris Brannon, Kirk Reiser, Greg Kroah-Hartman,
	speakup, devel, linux-kernel

covici@ccs.covici.com, on Sat 02 Jan 2016 19:10:36 -0500, wrote:
> I had a patch which also worked, but yours may be better -- I enclose it
> here for your information.

Well, it's not up to serialio.h to include things for serialio.c. That
however makes me realize that the culprit is actually
f79b0d9 (which actually doesn't make much sense since linux/serial.h is
getting included a couple of lines above...).

I don't know what this "use <linux/serial.h> instead <asm/serial.h>"
warning is about, but *no* header in include/ includes asm/serial.h, so
there is no way to get the SERIAL_PORT_DFNS definition just by including
linux/serial.h, we really need asm/serial.h, just like 8250*.c do.

So we really need serialio.c to include linux/serial_core.h then
asm/serial.h, as my patch does.

Samuel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Staging: speakup: Fix getting port information
  2016-01-03  0:56   ` Samuel Thibault
@ 2016-01-03  1:31     ` covici
  2016-01-04 12:22     ` Dan Carpenter
  1 sibling, 0 replies; 15+ messages in thread
From: covici @ 2016-01-03  1:31 UTC (permalink / raw)
  To: Samuel Thibault, William Hubbs, Chris Brannon, Kirk Reiser,
	Greg Kroah-Hartman, speakup, devel, linux-kernel

Well, OK with me, I will use yours instead because I don't know if they
will backport the thing, thanks so much for doing this.

Samuel Thibault <samuel.thibault@ens-lyon.org> wrote:

> covici@ccs.covici.com, on Sat 02 Jan 2016 19:10:36 -0500, wrote:
> > I had a patch which also worked, but yours may be better -- I enclose it
> > here for your information.
> 
> Well, it's not up to serialio.h to include things for serialio.c. That
> however makes me realize that the culprit is actually
> f79b0d9 (which actually doesn't make much sense since linux/serial.h is
> getting included a couple of lines above...).
> 
> I don't know what this "use <linux/serial.h> instead <asm/serial.h>"
> warning is about, but *no* header in include/ includes asm/serial.h, so
> there is no way to get the SERIAL_PORT_DFNS definition just by including
> linux/serial.h, we really need asm/serial.h, just like 8250*.c do.
> 
> So we really need serialio.c to include linux/serial_core.h then
> asm/serial.h, as my patch does.
> 
> Samuel
> _______________________________________________
> Speakup mailing list
> Speakup@linux-speakup.org
> http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup
> 

-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

         John Covici
         covici@ccs.covici.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Staging: speakup: Fix getting port information
  2016-01-02 23:25 [PATCH] Staging: speakup: Fix getting port information Samuel Thibault
  2016-01-02 23:49 ` Samuel Thibault
  2016-01-03  0:10 ` covici
@ 2016-01-04 12:20 ` Dan Carpenter
  2016-01-05  1:14   ` Samuel Thibault
  2 siblings, 1 reply; 15+ messages in thread
From: Dan Carpenter @ 2016-01-04 12:20 UTC (permalink / raw)
  To: Samuel Thibault, Chen Gang, William Hubbs, Chris Brannon,
	Kirk Reiser, Greg Kroah-Hartman, speakup, devel, linux-kernel

On Sun, Jan 03, 2016 at 12:25:29AM +0100, Samuel Thibault wrote:
> 5e6dc54 broke the port information in the speakup driver:

There is a correct format for this.

Patch 5e6dc548e453 ('drivers: staging: speakup: serialio: only use
platform specific SERIAL_PORT_DFNS.') broke the port information ...

If you specify fewer than 12 numbers from the git hash it might not be
unique next year.  If you leave out the patch title then no one
knows what you are talking about because we are not robots and we are
better at remembering text instead if hex numbers.  Also CC the guilty
party instead of discussing them behind their backs.

> SERIAL_PORT_DFNS only gets defined if asm/serial.h is included.

No, that's not true.  There is a #define SERIAL_PORT_DFN at the start of
the file.  I am confused.

> 
> Along the way, make sure that we do have information for the requested
> serial port number (index)
> 
> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> 
> --- 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>

This should be: <linux/serial.h> probably.

> +
>  #ifndef SERIAL_PORT_DFNS
>  #define SERIAL_PORT_DFNS
>  #endif
> @@ -26,6 +29,11 @@ const struct old_serial_port *spk_serial
>  	const struct old_serial_port *ser = rs_table + index;
>  	int err;
>  
> +	if (index > sizeof(rs_table) / sizeof(*rs_table)) {

This has an off-by-one bug > vs >=.  Also use the ARRAY_SIZE() macro.

	if (index >= ARRAY_SIZE(rs_table)) {

Could you move the use of index below the check?  Current static
analysis tools are deficient and prefer "check first and then use" order.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Staging: speakup: Fix getting port information
  2016-01-03  0:56   ` Samuel Thibault
  2016-01-03  1:31     ` covici
@ 2016-01-04 12:22     ` Dan Carpenter
  2016-01-04 12:26       ` Dan Carpenter
  1 sibling, 1 reply; 15+ messages in thread
From: Dan Carpenter @ 2016-01-04 12:22 UTC (permalink / raw)
  To: Samuel Thibault, William Hubbs, Chris Brannon, Kirk Reiser,
	Greg Kroah-Hartman, speakup, devel, linux-kernel

On Sun, Jan 03, 2016 at 01:56:20AM +0100, Samuel Thibault wrote:
> covici@ccs.covici.com, on Sat 02 Jan 2016 19:10:36 -0500, wrote:
> > I had a patch which also worked, but yours may be better -- I enclose it
> > here for your information.
> 
> Well, it's not up to serialio.h to include things for serialio.c. That
> however makes me realize that the culprit is actually
> f79b0d9 (which actually doesn't make much sense since linux/serial.h is
> getting included a couple of lines above...).

CC the guilty.

Also we have a Fixes tag.  Please use it.

> 
> I don't know what this "use <linux/serial.h> instead <asm/serial.h>"
> warning is about, but *no* header in include/ includes asm/serial.h, so
> there is no way to get the SERIAL_PORT_DFNS definition just by including
> linux/serial.h, we really need asm/serial.h, just like 8250*.c do.
> 
> So we really need serialio.c to include linux/serial_core.h then
> asm/serial.h, as my patch does.

Ah...  Ok.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Staging: speakup: Fix getting port information
  2016-01-04 12:22     ` Dan Carpenter
@ 2016-01-04 12:26       ` Dan Carpenter
  0 siblings, 0 replies; 15+ messages in thread
From: Dan Carpenter @ 2016-01-04 12:26 UTC (permalink / raw)
  To: Samuel Thibault, William Hubbs, Chris Brannon, Kirk Reiser,
	Greg Kroah-Hartman, speakup, devel, linux-kernel

On Mon, Jan 04, 2016 at 03:22:49PM +0300, Dan Carpenter wrote:
> On Sun, Jan 03, 2016 at 01:56:20AM +0100, Samuel Thibault wrote:
> > covici@ccs.covici.com, on Sat 02 Jan 2016 19:10:36 -0500, wrote:
> > > I had a patch which also worked, but yours may be better -- I enclose it
> > > here for your information.
> > 
> > Well, it's not up to serialio.h to include things for serialio.c. That
> > however makes me realize that the culprit is actually
> > f79b0d9 (which actually doesn't make much sense since linux/serial.h is
> > getting included a couple of lines above...).
> 

Btw, the patch title of that patch f79b0d9c223a ('staging: speakup:
Fixed warning <linux/serial.h> instead of <asm/serial.h>') describes
exactly everything about the patch.  So including the title really does
help save time for everyone.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Staging: speakup: Fix getting port information
  2016-01-04 12:20 ` Dan Carpenter
@ 2016-01-05  1:14   ` Samuel Thibault
  0 siblings, 0 replies; 15+ messages in thread
From: Samuel Thibault @ 2016-01-05  1:14 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Chen Gang, William Hubbs, Chris Brannon, Kirk Reiser,
	Greg Kroah-Hartman, speakup, devel, linux-kernel

Mmm, sorry.  I don't submit patches often enough, so that each time I do
it, there are new things to know about it :)

Thanks for the comments,
Samuel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Staging: speakup: Fix getting port information
  2016-01-25  0:29 ` Samuel Thibault
@ 2016-01-25  2:52   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 15+ messages in thread
From: Greg Kroah-Hartman @ 2016-01-25  2:52 UTC (permalink / raw)
  To: Samuel Thibault, Dan Carpenter, William Hubbs, Chris Brannon,
	Kirk Reiser, Melike Yurtoglu, speakup, devel, linux-kernel

On Mon, Jan 25, 2016 at 01:29:36AM +0100, Samuel Thibault wrote:
> Ping?

It's in my queue, I couldn't do anything until after 4.5-rc1 is out.
Yours is one of 2000+ other patches I will be digging through this
week...

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Staging: speakup: Fix getting port information
  2016-01-14 23:47 Samuel Thibault
  2016-01-15  5:59 ` Dan Carpenter
@ 2016-01-25  0:29 ` Samuel Thibault
  2016-01-25  2:52   ` Greg Kroah-Hartman
  1 sibling, 1 reply; 15+ messages in thread
From: Samuel Thibault @ 2016-01-25  0:29 UTC (permalink / raw)
  To: Dan Carpenter, William Hubbs, Chris Brannon, Kirk Reiser,
	Melike Yurtoglu, Greg Kroah-Hartman, speakup, devel,
	linux-kernel

Ping?

Samuel Thibault, on Fri 15 Jan 2016 00:47:41 +0100, wrote:
> 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@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);

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Staging: speakup: Fix getting port information
  2016-01-14 23:47 Samuel Thibault
@ 2016-01-15  5:59 ` Dan Carpenter
  2016-01-25  0:29 ` Samuel Thibault
  1 sibling, 0 replies; 15+ messages in thread
From: Dan Carpenter @ 2016-01-15  5:59 UTC (permalink / raw)
  To: Samuel Thibault, William Hubbs, Chris Brannon, Kirk Reiser,
	Melike Yurtoglu, Greg Kroah-Hartman, speakup, devel,
	linux-kernel

Great!  Thanks.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH] Staging: speakup: Fix getting port information
@ 2016-01-14 23:47 Samuel Thibault
  2016-01-15  5:59 ` Dan Carpenter
  2016-01-25  0:29 ` Samuel Thibault
  0 siblings, 2 replies; 15+ messages in thread
From: Samuel Thibault @ 2016-01-14 23:47 UTC (permalink / raw)
  To: Dan Carpenter, William Hubbs, Chris Brannon, Kirk Reiser,
	Melike Yurtoglu, Greg Kroah-Hartman
  Cc: speakup, devel, linux-kernel

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@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);

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Staging: speakup: Fix getting port information
  2016-01-05  1:19 Samuel Thibault
@ 2016-01-05  9:36 ` Dan Carpenter
  0 siblings, 0 replies; 15+ messages in thread
From: Dan Carpenter @ 2016-01-05  9:36 UTC (permalink / raw)
  To: Samuel Thibault, William Hubbs, Chris Brannon, Kirk Reiser,
	Melike Yurtoglu, Greg Kroah-Hartman, speakup, devel,
	linux-kernel

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


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH] Staging: speakup: Fix getting port information
@ 2016-01-05  1:19 Samuel Thibault
  2016-01-05  9:36 ` Dan Carpenter
  0 siblings, 1 reply; 15+ messages in thread
From: Samuel Thibault @ 2016-01-05  1:19 UTC (permalink / raw)
  To: William Hubbs, Chris Brannon, Kirk Reiser, Melike Yurtoglu,
	Greg Kroah-Hartman, speakup, devel, linux-kernel

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);

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-01-25  2:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-02 23:25 [PATCH] Staging: speakup: Fix getting port information Samuel Thibault
2016-01-02 23:49 ` Samuel Thibault
2016-01-03  0:10 ` covici
2016-01-03  0:56   ` Samuel Thibault
2016-01-03  1:31     ` covici
2016-01-04 12:22     ` Dan Carpenter
2016-01-04 12:26       ` Dan Carpenter
2016-01-04 12:20 ` Dan Carpenter
2016-01-05  1:14   ` Samuel Thibault
2016-01-05  1:19 Samuel Thibault
2016-01-05  9:36 ` Dan Carpenter
2016-01-14 23:47 Samuel Thibault
2016-01-15  5:59 ` Dan Carpenter
2016-01-25  0:29 ` Samuel Thibault
2016-01-25  2:52   ` Greg Kroah-Hartman

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.