@@ -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)
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> --- drivers/usb/serial/xr_serial.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-)