serial: omap: do not override settings for RS485 support
authorLino Sanfilippo <l.sanfilippo@kunbus.com>
Wed, 3 Jan 2024 06:18:17 +0000 (07:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Jan 2024 15:29:51 +0000 (16:29 +0100)
commit51f93776b84dee23e44a7be880736669a01cec2b
tree3e181579326643c41c2ddc369a18f2431842a64c
parent74eab89b26ac433ad857292f4707b43c1a8f0209
serial: omap: do not override settings for RS485 support

The drivers RS485 support is deactivated if there is no RTS GPIO available.
This is done by nullifying the ports rs485_supported struct. After that
however the settings in serial_omap_rs485_supported are assigned to the
same structure unconditionally, which results in an unintended reactivation
of RS485 support.

Fix this by moving the assignment to the beginning of
serial_omap_probe_rs485() and thus before uart_get_rs485_mode() gets
called.

Also replace the assignment of rs485_config() to have the complete RS485
setup in one function.

Fixes: e2752ae3cfc9 ("serial: omap: Disallow RS-485 if rts-gpio is not specified")
Cc: <stable@vger.kernel.org>
Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20240103061818.564-7-l.sanfilippo@kunbus.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/omap-serial.c