1 From 301a29da6e891e7eb95c843af0ecdbe86d01f723 Mon Sep 17 00:00:00 2001
2 From: Nicolas Boullis <nboullis@debian.org>
3 Date: Tue, 16 Oct 2012 00:06:23 +0200
4 Subject: usb: acm: fix the computation of the number of data bits
6 From: Nicolas Boullis <nboullis@debian.org>
8 commit 301a29da6e891e7eb95c843af0ecdbe86d01f723 upstream.
10 The current code assumes that CSIZE is 0000060, which appears to be
11 wrong on some arches (such as powerpc).
13 Signed-off-by: Nicolas Boullis <nboullis@debian.org>
14 Acked-by: Oliver Neukum <oneukum@suse.de>
15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18 drivers/usb/class/cdc-acm.c | 20 +++++++++++++++-----
19 1 file changed, 15 insertions(+), 5 deletions(-)
21 --- a/drivers/usb/class/cdc-acm.c
22 +++ b/drivers/usb/class/cdc-acm.c
23 @@ -818,10 +818,6 @@ static const __u32 acm_tty_speed[] = {
24 2500000, 3000000, 3500000, 4000000
27 -static const __u8 acm_tty_size[] = {
31 static void acm_tty_set_termios(struct tty_struct *tty,
32 struct ktermios *termios_old)
34 @@ -835,7 +831,21 @@ static void acm_tty_set_termios(struct t
35 newline.bParityType = termios->c_cflag & PARENB ?
36 (termios->c_cflag & PARODD ? 1 : 2) +
37 (termios->c_cflag & CMSPAR ? 2 : 0) : 0;
38 - newline.bDataBits = acm_tty_size[(termios->c_cflag & CSIZE) >> 4];
39 + switch (termios->c_cflag & CSIZE) {
41 + newline.bDataBits = 5;
44 + newline.bDataBits = 6;
47 + newline.bDataBits = 7;
51 + newline.bDataBits = 8;
54 /* FIXME: Needs to clear unsupported bits in the termios */
55 acm->clocal = ((termios->c_cflag & CLOCAL) != 0);