]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.6.4/usb-acm-fix-the-computation-of-the-number-of-data-bits.patch
Linux 5.1.4
[thirdparty/kernel/stable-queue.git] / releases / 3.6.4 / usb-acm-fix-the-computation-of-the-number-of-data-bits.patch
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
5
6 From: Nicolas Boullis <nboullis@debian.org>
7
8 commit 301a29da6e891e7eb95c843af0ecdbe86d01f723 upstream.
9
10 The current code assumes that CSIZE is 0000060, which appears to be
11 wrong on some arches (such as powerpc).
12
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>
16
17 ---
18 drivers/usb/class/cdc-acm.c | 20 +++++++++++++++-----
19 1 file changed, 15 insertions(+), 5 deletions(-)
20
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
25 };
26
27 -static const __u8 acm_tty_size[] = {
28 - 5, 6, 7, 8
29 -};
30 -
31 static void acm_tty_set_termios(struct tty_struct *tty,
32 struct ktermios *termios_old)
33 {
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) {
40 + case CS5:
41 + newline.bDataBits = 5;
42 + break;
43 + case CS6:
44 + newline.bDataBits = 6;
45 + break;
46 + case CS7:
47 + newline.bDataBits = 7;
48 + break;
49 + case CS8:
50 + default:
51 + newline.bDataBits = 8;
52 + break;
53 + }
54 /* FIXME: Needs to clear unsupported bits in the termios */
55 acm->clocal = ((termios->c_cflag & CLOCAL) != 0);
56