aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Boullis <nboullis@debian.org>2012-10-16 00:06:23 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-28 10:02:12 -0700
commit24d76b99f3422973490ce436776978e419d46c16 (patch)
tree021b3df0525f386e41e970ae4d2ee8a8dad48d0f
parent1468380b7f96472fc03cf7c9459323cdc9d7d405 (diff)
downloadkernel_samsung_aries-24d76b99f3422973490ce436776978e419d46c16.zip
kernel_samsung_aries-24d76b99f3422973490ce436776978e419d46c16.tar.gz
kernel_samsung_aries-24d76b99f3422973490ce436776978e419d46c16.tar.bz2
usb: acm: fix the computation of the number of data bits
commit 301a29da6e891e7eb95c843af0ecdbe86d01f723 upstream. The current code assumes that CSIZE is 0000060, which appears to be wrong on some arches (such as powerpc). Signed-off-by: Nicolas Boullis <nboullis@debian.org> Acked-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/class/cdc-acm.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index e4eee29..b107339 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -760,10 +760,6 @@ static const __u32 acm_tty_speed[] = {
2500000, 3000000, 3500000, 4000000
};
-static const __u8 acm_tty_size[] = {
- 5, 6, 7, 8
-};
-
static void acm_tty_set_termios(struct tty_struct *tty,
struct ktermios *termios_old)
{
@@ -780,7 +776,21 @@ static void acm_tty_set_termios(struct tty_struct *tty,
newline.bParityType = termios->c_cflag & PARENB ?
(termios->c_cflag & PARODD ? 1 : 2) +
(termios->c_cflag & CMSPAR ? 2 : 0) : 0;
- newline.bDataBits = acm_tty_size[(termios->c_cflag & CSIZE) >> 4];
+ switch (termios->c_cflag & CSIZE) {
+ case CS5:
+ newline.bDataBits = 5;
+ break;
+ case CS6:
+ newline.bDataBits = 6;
+ break;
+ case CS7:
+ newline.bDataBits = 7;
+ break;
+ case CS8:
+ default:
+ newline.bDataBits = 8;
+ break;
+ }
/* FIXME: Needs to clear unsupported bits in the termios */
acm->clocal = ((termios->c_cflag & CLOCAL) != 0);