History

tty: serial: Cleanup the bit shift with macro

This patch replaces the bit shift code with "_BITUL()" macro inside "serial_rs485" struct.

Crescent CY Hsieh committed 2 years ago

Commit 76ac8e21 parent d4303e01 file · +9 −8Browse files

Showing the changes to include/uapi (1 of 1 file). Show all

Unified · Split

include/uapi/linux/serial.h+9−8
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #ifndef _UAPI_LINUX_SERIAL_H
1212 #define _UAPI_LINUX_SERIAL_H
1313
14+#include <linux/const.h>
1415 #include <linux/types.h>
1516
1617 #include <linux/tty_flags.h>
@@ -140,14 +141,14 @@ struct serial_icounter_struct { · 123 unmodified lines
140141 */
141142 struct serial_rs485 {
142143 __u32 flags;
143−#define SER_RS485_ENABLED (1 << 0)
144−#define SER_RS485_RTS_ON_SEND (1 << 1)
145−#define SER_RS485_RTS_AFTER_SEND (1 << 2)
146−#define SER_RS485_RX_DURING_TX (1 << 4)
147−#define SER_RS485_TERMINATE_BUS (1 << 5)
148−#define SER_RS485_ADDRB (1 << 6)
149−#define SER_RS485_ADDR_RECV (1 << 7)
150−#define SER_RS485_ADDR_DEST (1 << 8)
144+#define SER_RS485_ENABLED _BITUL(0)
145+#define SER_RS485_RTS_ON_SEND _BITUL(1)
146+#define SER_RS485_RTS_AFTER_SEND _BITUL(2)
147+#define SER_RS485_RX_DURING_TX _BITUL(3)
148+#define SER_RS485_TERMINATE_BUS _BITUL(4)
149+#define SER_RS485_ADDRB _BITUL(5)
150+#define SER_RS485_ADDR_RECV _BITUL(6)
151+#define SER_RS485_ADDR_DEST _BITUL(7)
151152
152153 __u32 delay_rts_before_send;
153154 __u32 delay_rts_after_send;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t