Commit bf1434c1 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman
Browse files

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: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210922075938.31390-4-jslaby@suse.cz


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 19236287
Loading
Loading
Loading
Loading
+20 −27
Original line number Diff line number Diff line
@@ -600,19 +600,13 @@ static void mxser_change_speed(struct tty_struct *tty, struct ktermios *old_term
	if (cflag & CMSPAR)
		cval |= UART_LCR_SPAR;

	if ((info->type == PORT_8250) || (info->type == PORT_16450)) {
		if (info->board->must_hwid) {
			fcr = UART_FCR_ENABLE_FIFO;
			fcr |= MOXA_MUST_FCR_GDA_MODE_ENABLE;
			mxser_set_must_fifo_value(info);
		} else
	fcr = 0;
	} else {
		fcr = UART_FCR_ENABLE_FIFO;
	if (info->board->must_hwid) {
			fcr |= MOXA_MUST_FCR_GDA_MODE_ENABLE;
		fcr |= UART_FCR_ENABLE_FIFO |
			MOXA_MUST_FCR_GDA_MODE_ENABLE;
		mxser_set_must_fifo_value(info);
		} else {
	} else if (info->type != PORT_8250 && info->type != PORT_16450) {
		fcr |= UART_FCR_ENABLE_FIFO;
		switch (info->rx_high_water) {
		case 1:
			fcr |= UART_FCR_TRIGGER_1;
@@ -628,7 +622,6 @@ static void mxser_change_speed(struct tty_struct *tty, struct ktermios *old_term
			break;
		}
	}
	}

	/* CTS flow control flag and modem status interrupts */
	info->IER &= ~UART_IER_MSI;