Skip to content

serial: core: Do not hold the port lock when setting the term GPIO

Created by: linosanfilippo-kunbus

Both callers of uart_rs485_config() call the function with the port lock held. uart_rs485_config() however may sleep so in both cases the call results in a warning splat.

Fix this by moving the sleepable part (i.e. the call to uart_set_rs485_termination()) out of uart_rs485_config() into the callers and only call uart_set_rs485_termination() if the RS 485 configuration was successful.

This has also the advantage that the termination GPIO is not set if setting the RS 485 configuration has failed.

Fixes: 7c7f9bc9 ("serial: Deassert Transmit Enable on probe in driver-specific way")

Merge request reports