summaryrefslogtreecommitdiffstats
path: root/Documentation/driver-api/serial
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2022-06-06 13:04:19 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-06-10 13:49:57 +0200
commitbe2e2cb1d28195792539ac2539f8c40c39d3dd4c (patch)
tree4249ae287f350aa0713c4db269bc50dbdff87da9 /Documentation/driver-api/serial
parentaeae8f222fdd34bdddc1050dc073e56b2242c9b5 (diff)
downloadlinux-stable-be2e2cb1d28195792539ac2539f8c40c39d3dd4c.tar.gz
linux-stable-be2e2cb1d28195792539ac2539f8c40c39d3dd4c.tar.bz2
linux-stable-be2e2cb1d28195792539ac2539f8c40c39d3dd4c.zip
serial: Sanitize rs485_struct
Sanitize serial_rs485 struct before calling into rs485_setup. The drivers provide supported_rs485 to help sanitization of the fields. If neither of SER_RS485_RTS_ON_SEND or SER_RS485_RTS_AFTER_SEND supported, don't pretend they can be set to sane settings but clear them both instead. If only one of them is supported it may look tempting to use the one driver supports to set the other, however, the userspace does not have that information readily available so it wouldn't be helpful. While adjusting the documentation, remove also the claim that TIOCGRS485 would call driver specific code. In reality, it does nothing else than copies the stored serial_rs485 structure from uart_port to userspace. Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20220606100433.13793-23-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'Documentation/driver-api/serial')
-rw-r--r--Documentation/driver-api/serial/serial-rs485.rst12
1 files changed, 8 insertions, 4 deletions
diff --git a/Documentation/driver-api/serial/serial-rs485.rst b/Documentation/driver-api/serial/serial-rs485.rst
index 6bc824f948f9..00b5d333acba 100644
--- a/Documentation/driver-api/serial/serial-rs485.rst
+++ b/Documentation/driver-api/serial/serial-rs485.rst
@@ -38,10 +38,14 @@ RS485 Serial Communications
the values given by the device tree.
Any driver for devices capable of working both as RS232 and RS485 should
- implement the rs485_config callback in the uart_port structure. The
- serial_core calls rs485_config to do the device specific part in response
- to TIOCSRS485 and TIOCGRS485 ioctls (see below). The rs485_config callback
- receives a pointer to struct serial_rs485.
+ implement the rs485_config callback and provide rs485_supported in the
+ uart_port structure. The serial core calls rs485_config to do the device
+ specific part in response to TIOCSRS485 ioctl (see below). The rs485_config
+ callback receives a pointer to a sanitizated serial_rs485 structure. The
+ serial_rs485 userspace provides is sanitized before calling rs485_config
+ using rs485_supported that indicates what RS485 features the driver supports
+ for the uart_port. TIOCGRS485 ioctl can be used to read back the
+ serial_rs485 structure matching to the current configuration.
4. Usage from user-level
========================