History

tty,serial: Unify UPF_* and ASYNC_* flag definitions

The userspace-defined ASYNC_* flags in include/uapi/linux/tty_flags.h are the authoritative bit definitions for the serial_struct flags, and thus for any derivative values or fields. Although the serial core provides the TIOCSSERIAL and TIOCGSERIAL ioctls to set and retrieve these flags from userspace, it defines these bits independently, as UPF_* macros. Define the UPF_* macros which are userspace-modifiable directly from the ASYNC_* symbolic constants. Add compile-time test to ensure the bits changeable by TIOCSSERIAL match the defined range in the uapi header. Add ASYNCB_MAGIC_MULTIPLIER to the uapi header since this bit is programmable by userspace.

Peter Hurley committed 12 years ago

Commit 904326e1 parent 7c8ab962 files · +37 −16Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/tty_flags.h+5−1
@@ -6,6 +6,8 @@ · 5 unmodified lines
6 * shared by the tty_port flags structures.6 * shared by the tty_port flags structures.
7 *7 *
8 * Define ASYNCB_* for convenient use with {test,set,clear}_bit.8 * Define ASYNCB_* for convenient use with {test,set,clear}_bit.
9 *
10 * Bits [0..ASYNCB_LAST_USER] are userspace defined/visible/changeable
9 */11 */
10#define ASYNCB_HUP_NOTIFY 0 /* Notify getty on hangups and closes12#define ASYNCB_HUP_NOTIFY 0 /* Notify getty on hangups and closes
11 * on the callout port */13 * on the callout port */
@@ -26,7 +28,8 @@ · 14 unmodified lines
26#define ASYNCB_BUGGY_UART 14 /* This is a buggy UART, skip some safety28#define ASYNCB_BUGGY_UART 14 /* This is a buggy UART, skip some safety
27 * checks. Note: can be dangerous! */29 * checks. Note: can be dangerous! */
28#define ASYNCB_AUTOPROBE 15 /* Port was autoprobed by PCI or PNP code */30#define ASYNCB_AUTOPROBE 15 /* Port was autoprobed by PCI or PNP code */
29#define ASYNCB_LAST_USER 1531#define ASYNCB_MAGIC_MULTIPLIER 16 /* Use special CLK or divisor */
32#define ASYNCB_LAST_USER 16
30 33
31/* Internal flags used only by kernel */34/* Internal flags used only by kernel */
32#define ASYNCB_INITIALIZED 31 /* Serial port was initialized */35#define ASYNCB_INITIALIZED 31 /* Serial port was initialized */
@@ -57,6 +60,7 @@ · 24 unmodified lines
57#define ASYNC_LOW_LATENCY (1U << ASYNCB_LOW_LATENCY)60#define ASYNC_LOW_LATENCY (1U << ASYNCB_LOW_LATENCY)
58#define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART)61#define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART)
59#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE)62#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE)
63#define ASYNC_MAGIC_MULTIPLIER (1U << ASYNCB_MAGIC_MULTIPLIER)
60 64
61#define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1)65#define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1)
62#define ASYNC_USR_MASK (ASYNC_SPD_MASK|ASYNC_CALLOUT_NOHUP| \66#define ASYNC_USR_MASK (ASYNC_SPD_MASK|ASYNC_CALLOUT_NOHUP| \