diff options
author | Johan Hovold <johan@kernel.org> | 2021-01-21 11:29:18 +0100 |
---|---|---|
committer | Johan Hovold <johan@kernel.org> | 2021-01-26 16:16:49 +0100 |
commit | 35567511595052a2c6fc020d4abab944fb4204b0 (patch) | |
tree | c12f181d1361d5cedd3e745739dfd70d8574826b /drivers/usb | |
parent | 72fc7fc7f36501103a5ffa0d29c9672b2314ce29 (diff) | |
download | linux-35567511595052a2c6fc020d4abab944fb4204b0.tar.bz2 |
USB: serial: xr: clean up line-settings handling
Shift the line-setting values when defining them rather than in
set_termios() for consistency and improved readability.
Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/serial/xr_serial.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/drivers/usb/serial/xr_serial.c b/drivers/usb/serial/xr_serial.c index 202263211ba9..2000277bacc1 100644 --- a/drivers/usb/serial/xr_serial.c +++ b/drivers/usb/serial/xr_serial.c @@ -71,17 +71,17 @@ struct xr_txrx_clk_mask { #define XR21V141X_UART_DATA_8 0x8 #define XR21V141X_UART_PARITY_MASK GENMASK(6, 4) -#define XR21V141X_UART_PARITY_SHIFT 0x4 -#define XR21V141X_UART_PARITY_NONE 0x0 -#define XR21V141X_UART_PARITY_ODD 0x1 -#define XR21V141X_UART_PARITY_EVEN 0x2 -#define XR21V141X_UART_PARITY_MARK 0x3 -#define XR21V141X_UART_PARITY_SPACE 0x4 +#define XR21V141X_UART_PARITY_SHIFT 4 +#define XR21V141X_UART_PARITY_NONE (0x0 << XR21V141X_UART_PARITY_SHIFT) +#define XR21V141X_UART_PARITY_ODD (0x1 << XR21V141X_UART_PARITY_SHIFT) +#define XR21V141X_UART_PARITY_EVEN (0x2 << XR21V141X_UART_PARITY_SHIFT) +#define XR21V141X_UART_PARITY_MARK (0x3 << XR21V141X_UART_PARITY_SHIFT) +#define XR21V141X_UART_PARITY_SPACE (0x4 << XR21V141X_UART_PARITY_SHIFT) #define XR21V141X_UART_STOP_MASK BIT(7) -#define XR21V141X_UART_STOP_SHIFT 0x7 -#define XR21V141X_UART_STOP_1 0x0 -#define XR21V141X_UART_STOP_2 0x1 +#define XR21V141X_UART_STOP_SHIFT 7 +#define XR21V141X_UART_STOP_1 (0x0 << XR21V141X_UART_STOP_SHIFT) +#define XR21V141X_UART_STOP_2 (0x1 << XR21V141X_UART_STOP_SHIFT) #define XR21V141X_UART_FLOW_MODE_NONE 0x0 #define XR21V141X_UART_FLOW_MODE_HW 0x1 @@ -477,25 +477,21 @@ static void xr_set_termios(struct tty_struct *tty, if (C_PARENB(tty)) { if (C_CMSPAR(tty)) { if (C_PARODD(tty)) - bits |= XR21V141X_UART_PARITY_MARK << - XR21V141X_UART_PARITY_SHIFT; + bits |= XR21V141X_UART_PARITY_MARK; else - bits |= XR21V141X_UART_PARITY_SPACE << - XR21V141X_UART_PARITY_SHIFT; + bits |= XR21V141X_UART_PARITY_SPACE; } else { if (C_PARODD(tty)) - bits |= XR21V141X_UART_PARITY_ODD << - XR21V141X_UART_PARITY_SHIFT; + bits |= XR21V141X_UART_PARITY_ODD; else - bits |= XR21V141X_UART_PARITY_EVEN << - XR21V141X_UART_PARITY_SHIFT; + bits |= XR21V141X_UART_PARITY_EVEN; } } if (C_CSTOPB(tty)) - bits |= XR21V141X_UART_STOP_2 << XR21V141X_UART_STOP_SHIFT; + bits |= XR21V141X_UART_STOP_2; else - bits |= XR21V141X_UART_STOP_1 << XR21V141X_UART_STOP_SHIFT; + bits |= XR21V141X_UART_STOP_1; ret = xr_set_reg_uart(port, XR21V141X_REG_FORMAT, bits); if (ret) |