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

tty: remove BOTHER ifdefs

BOTHER is defined by all architectures since commit d0ffb805b729
("arch/alpha, termios: implement BOTHER, IBSHIFT and termios2").

Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220513082906.11096-3-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ilpo Järvinen and committed by
Greg Kroah-Hartman
69648d7b 9fafe733

+7 -20
+2 -3
drivers/tty/mxser.c
··· 528 528 outb(quot >> 8, info->ioaddr + UART_DLM); /* MS of divisor */ 529 529 outb(cval, info->ioaddr + UART_LCR); /* reset DLAB */ 530 530 531 - #ifdef BOTHER 532 531 if (C_BAUD(tty) == BOTHER) { 533 532 quot = MXSER_BAUD_BASE % newspd; 534 533 quot *= 8; ··· 538 539 quot /= newspd; 539 540 540 541 mxser_set_must_enum_value(info->ioaddr, quot); 541 - } else 542 - #endif 542 + } else { 543 543 mxser_set_must_enum_value(info->ioaddr, 0); 544 + } 544 545 545 546 return 0; 546 547 }
+5 -15
drivers/tty/tty_baudrate.c
··· 61 61 62 62 cbaud = termios->c_cflag & CBAUD; 63 63 64 - #ifdef BOTHER 65 64 /* Magic token for arbitrary speed via c_ispeed/c_ospeed */ 66 65 if (cbaud == BOTHER) 67 66 return termios->c_ospeed; 68 - #endif 67 + 69 68 if (cbaud & CBAUDEX) { 70 69 cbaud &= ~CBAUDEX; 71 70 ··· 96 97 97 98 if (cbaud == B0) 98 99 return tty_termios_baud_rate(termios); 99 - #ifdef BOTHER 100 + 100 101 /* Magic token for arbitrary speed via c_ispeed*/ 101 102 if (cbaud == BOTHER) 102 103 return termios->c_ispeed; 103 - #endif 104 + 104 105 if (cbaud & CBAUDEX) { 105 106 cbaud &= ~CBAUDEX; 106 107 ··· 156 157 if (((termios->c_cflag >> IBSHIFT) & CBAUD) != B0) 157 158 ibinput = 1; /* An input speed was specified */ 158 159 #endif 159 - #ifdef BOTHER 160 160 /* If the user asked for a precise weird speed give a precise weird 161 161 * answer. If they asked for a Bfoo speed they may have problems 162 162 * digesting non-exact replies so fuzz a bit. ··· 168 170 } 169 171 if (((termios->c_cflag >> IBSHIFT) & CBAUD) == BOTHER) 170 172 iclose = 0; 171 - #endif 173 + 172 174 termios->c_cflag &= ~CBAUD; 173 175 #ifdef IBSHIFT 174 176 termios->c_cflag &= ~(CBAUD << IBSHIFT); ··· 203 205 } 204 206 } while (++i < n_baud_table); 205 207 206 - /* 207 - * If we found no match then use BOTHER if provided or warn 208 - * the user their platform maintainer needs to wake up if not. 209 - */ 210 - #ifdef BOTHER 208 + /* If we found no match then use BOTHER. */ 211 209 if (ofound == -1) 212 210 termios->c_cflag |= BOTHER; 213 211 /* Set exact input bits only if the input and output differ or the ··· 211 217 */ 212 218 if (ifound == -1 && (ibaud != obaud || ibinput)) 213 219 termios->c_cflag |= (BOTHER << IBSHIFT); 214 - #else 215 - if (ifound == -1 || ofound == -1) 216 - pr_warn_once("tty: Unable to return correct speed data as your architecture needs updating.\n"); 217 - #endif 218 220 } 219 221 EXPORT_SYMBOL_GPL(tty_termios_encode_baud_rate); 220 222
-2
drivers/tty/tty_ioctl.c
··· 562 562 termios.c_cc[VKILL] = tmp.sg_kill; 563 563 set_sgflags(&termios, tmp.sg_flags); 564 564 /* Try and encode into Bfoo format */ 565 - #ifdef BOTHER 566 565 tty_termios_encode_baud_rate(&termios, termios.c_ispeed, 567 566 termios.c_ospeed); 568 - #endif 569 567 up_write(&tty->termios_rwsem); 570 568 tty_set_termios(tty, &termios); 571 569 return 0;