From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Dan Carpenter <dan.carpenter@oracle.com>,
William Hubbs <w.d.hubbs@gmail.com>,
Chris Brannon <chris@the-brannons.com>,
Kirk Reiser <kirk@reisers.ca>,
Melike Yurtoglu <aysemelikeyurtoglu@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: speakup@linux-speakup.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] Staging: speakup: Fix getting port information
Date: Fri, 15 Jan 2016 00:47:41 +0100 [thread overview]
Message-ID: <20160114234741.GD3574@var.home> (raw)
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);
next reply other threads:[~2016-01-14 23:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-14 23:47 Samuel Thibault [this message]
2016-01-15 5:59 ` [PATCH] Staging: speakup: Fix getting port information Dan Carpenter
2016-01-25 0:29 ` Samuel Thibault
2016-01-25 2:52 ` Greg Kroah-Hartman
-- strict thread matches above, loose matches on Subject: below --
2016-01-05 1:19 Samuel Thibault
2016-01-05 9:36 ` Dan Carpenter
2016-01-02 23:25 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160114234741.GD3574@var.home \
--to=samuel.thibault@ens-lyon.org \
--cc=aysemelikeyurtoglu@gmail.com \
--cc=chris@the-brannons.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=kirk@reisers.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=speakup@linux-speakup.org \
--cc=w.d.hubbs@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.