aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNicolas Boullis <nboullis@debian.org>2012-10-15 18:06:23 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-17 16:45:49 -0400
commit301a29da6e891e7eb95c843af0ecdbe86d01f723 (patch)
tree06a394d2ee61a08f7ba07741eea2ff43fa67a82e /drivers
parent6e1babb3ff2651376f2e9843569fcb39cfe4686b (diff)
usb: acm: fix the computation of the number of data bits
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> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-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 572f4e7bd3ff..6e49ec6f3adc 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -817,10 +817,6 @@ static const __u32 acm_tty_speed[] = {
817 2500000, 3000000, 3500000, 4000000 817 2500000, 3000000, 3500000, 4000000
818}; 818};
819 819
820static const __u8 acm_tty_size[] = {
821 5, 6, 7, 8
822};
823
824static void acm_tty_set_termios(struct tty_struct *tty, 820static void acm_tty_set_termios(struct tty_struct *tty,
825 struct ktermios *termios_old) 821 struct ktermios *termios_old)
826{ 822{
@@ -834,7 +830,21 @@ static void acm_tty_set_termios(struct tty_struct *tty,
834 newline.bParityType = termios->c_cflag & PARENB ? 830 newline.bParityType = termios->c_cflag & PARENB ?
835 (termios->c_cflag & PARODD ? 1 : 2) + 831 (termios->c_cflag & PARODD ? 1 : 2) +
836 (termios->c_cflag & CMSPAR ? 2 : 0) : 0; 832 (termios->c_cflag & CMSPAR ? 2 : 0) : 0;
837 newline.bDataBits = acm_tty_size[(termios->c_cflag & CSIZE) >> 4]; 833 switch (termios->c_cflag & CSIZE) {
834 case CS5:
835 newline.bDataBits = 5;
836 break;
837 case CS6:
838 newline.bDataBits = 6;
839 break;
840 case CS7:
841 newline.bDataBits = 7;
842 break;
843 case CS8:
844 default:
845 newline.bDataBits = 8;
846 break;
847 }
838 /* FIXME: Needs to clear unsupported bits in the termios */ 848 /* FIXME: Needs to clear unsupported bits in the termios */
839 acm->clocal = ((termios->c_cflag & CLOCAL) != 0); 849 acm->clocal = ((termios->c_cflag & CLOCAL) != 0);
840 850