Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jiri Slaby and committed by
Greg Kroah-Hartman
d8f0209b 8ea43acc

+6 -6
+6 -6
drivers/usb/serial/cypress_m8.c
··· 326 326 327 327 /* fill the feature_buffer with new configuration */ 328 328 put_unaligned_le32(new_baudrate, feature_buffer); 329 - feature_buffer[4] |= data_bits; /* assign data bits in 2 bit space ( max 3 ) */ 329 + feature_buffer[4] |= data_bits - 5; /* assign data bits in 2 bit space ( max 3 ) */ 330 330 /* 1 bit gap */ 331 331 feature_buffer[4] |= (stop_bits << 3); /* assign stop bits in 1 bit space */ 332 332 feature_buffer[4] |= (parity_enable << 4); /* assign parity flag in 1 bit space */ ··· 889 889 890 890 switch (cflag & CSIZE) { 891 891 case CS5: 892 - data_bits = 0; 892 + data_bits = 5; 893 893 break; 894 894 case CS6: 895 - data_bits = 1; 895 + data_bits = 6; 896 896 break; 897 897 case CS7: 898 - data_bits = 2; 898 + data_bits = 7; 899 899 break; 900 900 case CS8: 901 - data_bits = 3; 901 + data_bits = 8; 902 902 break; 903 903 default: 904 904 dev_err(dev, "%s - CSIZE was set, but not CS5-CS8\n", __func__); 905 - data_bits = 3; 905 + data_bits = 8; 906 906 } 907 907 spin_lock_irqsave(&priv->lock, flags); 908 908 oldlines = priv->line_control;