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

serial: 8250_omap: Fix gpio check for auto RTS/CTS

There are two checks to see if the manual gpio is configured, but
these the check is seeing if the structure is NULL instead it
should check to see if there are CTS and/or RTS pins defined.

This patch uses checks for those individual pins instead of
checking for the structure itself to restore auto RTS/CTS.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Yegor Yefremov <yegorslists@googlemail.com>
Link: https://lore.kernel.org/r/20191006163314.23191-2-aford173@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Adam Ford and committed by
Greg Kroah-Hartman
fc64f7ab 37e3ab00

+3 -2
+3 -2
drivers/tty/serial/8250/8250_omap.c
··· 141 141 142 142 serial8250_do_set_mctrl(port, mctrl); 143 143 144 - if (!up->gpios) { 144 + if (!mctrl_gpio_to_gpiod(up->gpios, UART_GPIO_RTS)) { 145 145 /* 146 146 * Turn off autoRTS if RTS is lowered and restore autoRTS 147 147 * setting if RTS is raised ··· 456 456 up->port.status &= ~(UPSTAT_AUTOCTS | UPSTAT_AUTORTS | UPSTAT_AUTOXOFF); 457 457 458 458 if (termios->c_cflag & CRTSCTS && up->port.flags & UPF_HARD_FLOW && 459 - !up->gpios) { 459 + !mctrl_gpio_to_gpiod(up->gpios, UART_GPIO_RTS) && 460 + !mctrl_gpio_to_gpiod(up->gpios, UART_GPIO_CTS)) { 460 461 /* Enable AUTOCTS (autoRTS is enabled when RTS is raised) */ 461 462 up->port.status |= UPSTAT_AUTOCTS | UPSTAT_AUTORTS; 462 463 priv->efr |= UART_EFR_CTS;