]> git.baikalelectronics.ru Git - kernel.git/commit
serial: core, 8250: set RS485 termination GPIO in serial core
authorLino Sanfilippo <l.sanfilippo@kunbus.com>
Sun, 10 Jul 2022 16:44:37 +0000 (18:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Jul 2022 14:34:23 +0000 (16:34 +0200)
commit851e505ec5ffe107551a1fddceb33179205a5867
tree4d1c4f804e398e6a3d8f61518745c50722a0651f
parent2ef0d61e9751d826d8d620ac45902c4be4e56816
serial: core, 8250: set RS485 termination GPIO in serial core

In serial8250_em485_config() the termination GPIO is set with the uart_port
spinlock held. This is an issue if setting the GPIO line can sleep (e.g.
since the concerning GPIO expander is connected via SPI or I2C).

Fix this by setting the termination line outside of the uart_port spinlock
in the serial core and using gpiod_set_value_cansleep() which instead of
gpiod_set_value() allows it to sleep.

Beside fixing the termination GPIO line setting for the 8250 driver this
change also makes setting the termination GPIO generic for all UART
drivers.

Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com>
Link: https://lore.kernel.org/r/20220710164442.2958979-4-LinoSanfilippo@gmx.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_port.c
drivers/tty/serial/serial_core.c