summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2021-06-10 11:02:46 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-06-15 14:03:27 +0200
commitd8f0209bfedb801d06a81a74b003a882dee3ea3f (patch)
tree37baec7fd22a0f66ef79ee7646dc72da71706be9
parentmxs-auart: redefine AUART_LINECTRL_WLEN to accept bits count (diff)
downloadlinux-d8f0209bfedb801d06a81a74b003a882dee3ea3f.tar.xz
linux-d8f0209bfedb801d06a81a74b003a882dee3ea3f.zip
cypress_m8: switch data_bits to real character bits
Make data_bits what it really is. Assign proper bit counts to data_bits instead of magic 0..3. There are two reasons: 1) it's clear what we store there, and 2) it will make the transition to tty_tty_get_char_size() in the next patch easier. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20210610090247.2593-3-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/serial/cypress_m8.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index 166ee2286fda..4dea3ec2d8b5 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -326,7 +326,7 @@ static int cypress_serial_control(struct tty_struct *tty,
/* fill the feature_buffer with new configuration */
put_unaligned_le32(new_baudrate, feature_buffer);
- feature_buffer[4] |= data_bits; /* assign data bits in 2 bit space ( max 3 ) */
+ feature_buffer[4] |= data_bits - 5; /* assign data bits in 2 bit space ( max 3 ) */
/* 1 bit gap */
feature_buffer[4] |= (stop_bits << 3); /* assign stop bits in 1 bit space */
feature_buffer[4] |= (parity_enable << 4); /* assign parity flag in 1 bit space */
@@ -889,20 +889,20 @@ static void cypress_set_termios(struct tty_struct *tty,
switch (cflag & CSIZE) {
case CS5:
- data_bits = 0;
+ data_bits = 5;
break;
case CS6:
- data_bits = 1;
+ data_bits = 6;
break;
case CS7:
- data_bits = 2;
+ data_bits = 7;
break;
case CS8:
- data_bits = 3;
+ data_bits = 8;
break;
default:
dev_err(dev, "%s - CSIZE was set, but not CS5-CS8\n", __func__);
- data_bits = 3;
+ data_bits = 8;
}
spin_lock_irqsave(&priv->lock, flags);
oldlines = priv->line_control;