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

mxser: simplify FCR computation in mxser_change_speed()

Provided FIFO is always enabled for MUST chips, move its FCR setting out
of PORT_8250/PORT_16450 special case in mxser_change_speed(). Now, we
can pre-set fcr to zero and invert the condition of the 'if'.

This makes the code more readable (no functional change intended).

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210922075938.31390-4-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby and committed by
Greg Kroah-Hartman
bf1434c1 19236287

+20 -27
+20 -27
drivers/tty/mxser.c
··· 600 600 if (cflag & CMSPAR) 601 601 cval |= UART_LCR_SPAR; 602 602 603 - if ((info->type == PORT_8250) || (info->type == PORT_16450)) { 604 - if (info->board->must_hwid) { 605 - fcr = UART_FCR_ENABLE_FIFO; 606 - fcr |= MOXA_MUST_FCR_GDA_MODE_ENABLE; 607 - mxser_set_must_fifo_value(info); 608 - } else 609 - fcr = 0; 610 - } else { 611 - fcr = UART_FCR_ENABLE_FIFO; 612 - if (info->board->must_hwid) { 613 - fcr |= MOXA_MUST_FCR_GDA_MODE_ENABLE; 614 - mxser_set_must_fifo_value(info); 615 - } else { 616 - switch (info->rx_high_water) { 617 - case 1: 618 - fcr |= UART_FCR_TRIGGER_1; 619 - break; 620 - case 4: 621 - fcr |= UART_FCR_TRIGGER_4; 622 - break; 623 - case 8: 624 - fcr |= UART_FCR_TRIGGER_8; 625 - break; 626 - default: 627 - fcr |= UART_FCR_TRIGGER_14; 628 - break; 629 - } 603 + fcr = 0; 604 + if (info->board->must_hwid) { 605 + fcr |= UART_FCR_ENABLE_FIFO | 606 + MOXA_MUST_FCR_GDA_MODE_ENABLE; 607 + mxser_set_must_fifo_value(info); 608 + } else if (info->type != PORT_8250 && info->type != PORT_16450) { 609 + fcr |= UART_FCR_ENABLE_FIFO; 610 + switch (info->rx_high_water) { 611 + case 1: 612 + fcr |= UART_FCR_TRIGGER_1; 613 + break; 614 + case 4: 615 + fcr |= UART_FCR_TRIGGER_4; 616 + break; 617 + case 8: 618 + fcr |= UART_FCR_TRIGGER_8; 619 + break; 620 + default: 621 + fcr |= UART_FCR_TRIGGER_14; 622 + break; 630 623 } 631 624 } 632 625