File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -200,21 +200,8 @@ static void ark3116_set_termios(struct tty_struct *tty,
200200 __u8 lcr , hcr , eval ;
201201
202202 /* set data bit count */
203- switch (cflag & CSIZE ) {
204- case CS5 :
205- lcr = UART_LCR_WLEN5 ;
206- break ;
207- case CS6 :
208- lcr = UART_LCR_WLEN6 ;
209- break ;
210- case CS7 :
211- lcr = UART_LCR_WLEN7 ;
212- break ;
213- default :
214- case CS8 :
215- lcr = UART_LCR_WLEN8 ;
216- break ;
217- }
203+ lcr = UART_LCR_WLEN (tty_get_char_size (cflag ));
204+
218205 if (cflag & CSTOPB )
219206 lcr |= UART_LCR_STOP ;
220207 if (cflag & PARENB )
Original file line number Diff line number Diff line change @@ -643,21 +643,7 @@ static void f81232_set_termios(struct tty_struct *tty,
643643 if (C_CSTOPB (tty ))
644644 new_lcr |= UART_LCR_STOP ;
645645
646- switch (C_CSIZE (tty )) {
647- case CS5 :
648- new_lcr |= UART_LCR_WLEN5 ;
649- break ;
650- case CS6 :
651- new_lcr |= UART_LCR_WLEN6 ;
652- break ;
653- case CS7 :
654- new_lcr |= UART_LCR_WLEN7 ;
655- break ;
656- default :
657- case CS8 :
658- new_lcr |= UART_LCR_WLEN8 ;
659- break ;
660- }
646+ new_lcr |= UART_LCR_WLEN (tty_get_char_size (tty -> termios .c_cflag ));
661647
662648 mutex_lock (& priv -> lock );
663649
Original file line number Diff line number Diff line change @@ -970,21 +970,7 @@ static void f81534_set_termios(struct tty_struct *tty,
970970 if (C_CSTOPB (tty ))
971971 new_lcr |= UART_LCR_STOP ;
972972
973- switch (C_CSIZE (tty )) {
974- case CS5 :
975- new_lcr |= UART_LCR_WLEN5 ;
976- break ;
977- case CS6 :
978- new_lcr |= UART_LCR_WLEN6 ;
979- break ;
980- case CS7 :
981- new_lcr |= UART_LCR_WLEN7 ;
982- break ;
983- default :
984- case CS8 :
985- new_lcr |= UART_LCR_WLEN8 ;
986- break ;
987- }
973+ new_lcr |= UART_LCR_WLEN (tty_get_char_size (tty -> termios .c_cflag ));
988974
989975 baud = tty_get_baud_rate (tty );
990976 if (!baud )
Original file line number Diff line number Diff line change @@ -1380,30 +1380,12 @@ static void change_port_settings(struct tty_struct *tty,
13801380 return ;
13811381 }
13821382
1383- lData = UART_LCR_WLEN8 ;
13841383 lStop = 0x00 ; /* 1 stop bit */
13851384 lParity = 0x00 ; /* No parity */
13861385
13871386 cflag = tty -> termios .c_cflag ;
13881387
1389- /* Change the number of bits */
1390- switch (cflag & CSIZE ) {
1391- case CS5 :
1392- lData = UART_LCR_WLEN5 ;
1393- break ;
1394-
1395- case CS6 :
1396- lData = UART_LCR_WLEN6 ;
1397- break ;
1398-
1399- case CS7 :
1400- lData = UART_LCR_WLEN7 ;
1401- break ;
1402- default :
1403- case CS8 :
1404- lData = UART_LCR_WLEN8 ;
1405- break ;
1406- }
1388+ lData = UART_LCR_WLEN (tty_get_char_size (cflag ));
14071389
14081390 /* Change the Parity bit */
14091391 if (cflag & PARENB ) {
Original file line number Diff line number Diff line change @@ -281,21 +281,7 @@ static void qt2_set_termios(struct tty_struct *tty,
281281 new_lcr |= SERIAL_EVEN_PARITY ;
282282 }
283283
284- switch (cflag & CSIZE ) {
285- case CS5 :
286- new_lcr |= UART_LCR_WLEN5 ;
287- break ;
288- case CS6 :
289- new_lcr |= UART_LCR_WLEN6 ;
290- break ;
291- case CS7 :
292- new_lcr |= UART_LCR_WLEN7 ;
293- break ;
294- default :
295- case CS8 :
296- new_lcr |= UART_LCR_WLEN8 ;
297- break ;
298- }
284+ new_lcr |= UART_LCR_WLEN (tty_get_char_size (cflag ));
299285
300286 baud = tty_get_baud_rate (tty );
301287 if (!baud )
Original file line number Diff line number Diff line change @@ -231,21 +231,7 @@ static void ssu100_set_termios(struct tty_struct *tty,
231231 urb_value |= SERIAL_EVEN_PARITY ;
232232 }
233233
234- switch (cflag & CSIZE ) {
235- case CS5 :
236- urb_value |= UART_LCR_WLEN5 ;
237- break ;
238- case CS6 :
239- urb_value |= UART_LCR_WLEN6 ;
240- break ;
241- case CS7 :
242- urb_value |= UART_LCR_WLEN7 ;
243- break ;
244- default :
245- case CS8 :
246- urb_value |= UART_LCR_WLEN8 ;
247- break ;
248- }
234+ urb_value |= UART_LCR_WLEN (tty_get_char_size (cflag ));
249235
250236 baud = tty_get_baud_rate (tty );
251237 if (!baud )
You can’t perform that action at this time.
0 commit comments