mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
serial: 8250: Remove serial_rs485 sanitization from em485
Serial core handles serial_rs485 sanitization.
When em485 init fails, there are two possible paths of entry:
1) uart_rs485_config (init path) that fully clears port->rs485 on
error.
2) ioctl path with a pre-existing, valid port->rs485 unto which the
kernel falls back on error and port->rs485 should therefore be
kept untouched. The temporary rs485 struct is not returned to
userspace in case of error so its flag don't matter.
...Thus SER_RS485_ENABLED clearing on error can/should be dropped.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220606100433.13793-37-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
bbdcbc1301
commit
84f2faa785
@@ -675,13 +675,6 @@ int serial8250_em485_config(struct uart_port *port, struct serial_rs485 *rs485)
|
|||||||
rs485->flags &= ~SER_RS485_RTS_AFTER_SEND;
|
rs485->flags &= ~SER_RS485_RTS_AFTER_SEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clamp the delays to [0, 100ms] */
|
|
||||||
rs485->delay_rts_before_send = min(rs485->delay_rts_before_send, 100U);
|
|
||||||
rs485->delay_rts_after_send = min(rs485->delay_rts_after_send, 100U);
|
|
||||||
|
|
||||||
memset(rs485->padding, 0, sizeof(rs485->padding));
|
|
||||||
port->rs485 = *rs485;
|
|
||||||
|
|
||||||
gpiod_set_value(port->rs485_term_gpio,
|
gpiod_set_value(port->rs485_term_gpio,
|
||||||
rs485->flags & SER_RS485_TERMINATE_BUS);
|
rs485->flags & SER_RS485_TERMINATE_BUS);
|
||||||
|
|
||||||
@@ -689,15 +682,8 @@ int serial8250_em485_config(struct uart_port *port, struct serial_rs485 *rs485)
|
|||||||
* Both serial8250_em485_init() and serial8250_em485_destroy()
|
* Both serial8250_em485_init() and serial8250_em485_destroy()
|
||||||
* are idempotent.
|
* are idempotent.
|
||||||
*/
|
*/
|
||||||
if (rs485->flags & SER_RS485_ENABLED) {
|
if (rs485->flags & SER_RS485_ENABLED)
|
||||||
int ret = serial8250_em485_init(up);
|
return serial8250_em485_init(up);
|
||||||
|
|
||||||
if (ret) {
|
|
||||||
rs485->flags &= ~SER_RS485_ENABLED;
|
|
||||||
port->rs485.flags &= ~SER_RS485_ENABLED;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
serial8250_em485_destroy(up);
|
serial8250_em485_destroy(up);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user