On 03.07.22 20:31, Andy Shevchenko wrote:
On Sun, Jul 3, 2022 at 7:02 PM Lino Sanfilippo [off-list ref] wrote:
quoted
From: Lino Sanfilippo <redacted>
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 to sleep.
allows it to
Ok.
quoted
Beside fixing the termination GPIO line setting for the 8250 driver this
change also makes setting the termination GPIO generic for all UART
drivers.
...
quoted
+static void uart_set_rs485_termination(struct uart_port *port,
+ const struct serial_rs485 *rs485)
+{
quoted
+ if (!port->rs485_term_gpio
This duplicates the check the GPIO library does. Drop it.
Ok.
quoted
|| !(rs485->flags & SER_RS485_ENABLED))
+ return;
+
+ gpiod_set_value_cansleep(port->rs485_term_gpio,
+ !!(rs485->flags & SER_RS485_TERMINATE_BUS));
+}
Thanks for the review!
Regards,
Lino