diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-01-15 02:47:41 +0300 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2016-02-15 23:42:33 +0300 |
commit | 2428c9704a853cdddf9905695ad376c117c1228a (patch) | |
tree | 1fa763774008368c10b6d27bfbf899053aff6359 /drivers/staging | |
parent | 362f7aa7711bc38a3cb9f1c3bfe83fa41405bc9d (diff) | |
download | linux-2428c9704a853cdddf9905695ad376c117c1228a.tar.xz |
Staging: speakup: Fix getting port information
[ Upstream commit 327b882d3bcc1fba82dbd39b5cf5a838c81218e2 ]
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)
Fixes: f79b0d9c223c ("staging: speakup: Fixed warning <linux/serial.h> instead of <asm/serial.h>")
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: stable <stable@vger.kernel.org> # 3.18
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/speakup/serialio.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c index 1d9d51bdf517..f41a7da1949d 100644 --- 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_init(int index) 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); |