From ca740803856f23dbc5b1872039291231bc131ecb Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 21 Jan 2006 20:06:14 +0000 Subject: [SERIAL] Remove UPF_AUTOPROBE and UPF_BOOT_ONLYMCA The functionality UPF_BOOT_ONLYMCA provided has been replaced by the 8250_mca module, which only registers MCA ports if MCA is present. UPF_AUTOPROBE has no functional effect - in fact, it's never tested. Only ibmasm set the flag. Signed-off-by: Russell King --- include/linux/serial_core.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index ec351005bf9..f3af47713a4 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -245,9 +245,7 @@ struct uart_port { #define UPF_HARDPPS_CD (1 << 11) #define UPF_LOW_LATENCY (1 << 13) #define UPF_BUGGY_UART (1 << 14) -#define UPF_AUTOPROBE (1 << 15) #define UPF_MAGIC_MULTIPLIER (1 << 16) -#define UPF_BOOT_ONLYMCA (1 << 22) #define UPF_CONS_FLOW (1 << 23) #define UPF_SHARE_IRQ (1 << 24) #define UPF_BOOT_AUTOCONF (1 << 28) -- cgit v1.2.3 From ba899dbc036d24ab6b45faf64e3648a268721cc9 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 21 Jan 2006 22:45:50 +0000 Subject: [SERIAL] Make port->ops constant No one should write to the port->ops structure, so make it constant. Signed-off-by: Russell King --- include/linux/serial_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index f3af47713a4..b74ff34469b 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -257,7 +257,7 @@ struct uart_port { unsigned int mctrl; /* current modem ctrl settings */ unsigned int timeout; /* character-based timeout */ unsigned int type; /* port type */ - struct uart_ops *ops; + const struct uart_ops *ops; unsigned int custom_divisor; unsigned int line; /* port index */ unsigned long mapbase; /* for ioremap */ -- cgit v1.2.3 From 747c8a55946ed037bf7d62454c3c599c02af2262 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 21 Jan 2006 22:50:36 +0000 Subject: [SERIAL] Make uart_info flags a bitwise type The potential for confusing the flags is fairly high. Make uart_info's flags a bitwise type so sparse can check that the right flag definitions are used with the right structure. Signed-off-by: Russell King --- include/linux/serial_core.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index b74ff34469b..90f681789a6 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -287,6 +287,9 @@ struct uart_state { }; #define UART_XMIT_SIZE PAGE_SIZE + +typedef unsigned int __bitwise__ uif_t; + /* * This is the state information which is only valid when the port * is open; it may be freed by the core driver once the device has @@ -296,17 +299,16 @@ struct uart_state { struct uart_info { struct tty_struct *tty; struct circ_buf xmit; - unsigned int flags; + uif_t flags; /* - * These are the flags that specific to info->flags, and reflect our - * internal state. They can not be accessed via port->flags. Low - * level drivers must not change these, but may query them instead. + * Definitions for info->flags. These are _private_ to serial_core, and + * are specific to this structure. They may be queried by low level drivers. */ -#define UIF_CHECK_CD (1 << 25) -#define UIF_CTS_FLOW (1 << 26) -#define UIF_NORMAL_ACTIVE (1 << 29) -#define UIF_INITIALIZED (1 << 31) +#define UIF_CHECK_CD ((__force uif_t) (1 << 25)) +#define UIF_CTS_FLOW ((__force uif_t) (1 << 26)) +#define UIF_NORMAL_ACTIVE ((__force uif_t) (1 << 29)) +#define UIF_INITIALIZED ((__force uif_t) (1 << 31)) int blocked_open; -- cgit v1.2.3 From 27ae7a7435634820e7f7e2b922d8119f79cfc6e4 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 21 Jan 2006 22:54:06 +0000 Subject: [SERIAL] Fix UPF_ flag usage with uart_info->flags The previous change found a bug in the serial SAK handling - because we were looking for UPF_SAK set in uart_info->flags, we would never raise a SAK condition. UPF_SAK is in uart_port->flags. Signed-off-by: Russell King --- include/linux/serial_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 90f681789a6..1a8cd0169c9 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -430,7 +430,7 @@ static inline int uart_handle_break(struct uart_port *port) port->sysrq = 0; } #endif - if (info->flags & UPF_SAK) + if (port->flags & UPF_SAK) do_SAK(info->tty); return 0; } -- cgit v1.2.3 From 0077d45e46fe2af3aaee5813c99268afcd0e7c0e Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 21 Jan 2006 23:03:28 +0000 Subject: [SERIAL] Make uart_port flags a bitwise type Same reasoning as commit 747c8a55946ed037bf7d62454c3c599c02af2262 but this time we're making uart_port flags a bitwise type - not all of these flags correspond with the old ASYNC_ flags, so there is the possibility for bugs if the wrong ASYNC_* constants are used. Always use UPF_* constants for uart_port->flags. Signed-off-by: Russell King --- include/linux/serial_8250.h | 2 +- include/linux/serial_core.h | 48 +++++++++++++++++++++++---------------------- 2 files changed, 26 insertions(+), 24 deletions(-) (limited to 'include') diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index cee302aefdb..73b464f0926 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h @@ -26,7 +26,7 @@ struct plat_serial8250_port { unsigned char regshift; /* register shift */ unsigned char iotype; /* UPIO_* */ unsigned char hub6; - unsigned int flags; /* UPF_* flags */ + upf_t flags; /* UPF_* flags */ }; /* diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 1a8cd0169c9..4041122dabf 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -203,6 +203,8 @@ struct uart_icount { __u32 buf_overrun; }; +typedef unsigned int __bitwise__ upf_t; + struct uart_port { spinlock_t lock; /* port lock */ unsigned int iobase; /* in/out[bwl] */ @@ -230,29 +232,29 @@ struct uart_port { unsigned long sysrq; /* sysrq timeout */ #endif - unsigned int flags; - -#define UPF_FOURPORT (1 << 1) -#define UPF_SAK (1 << 2) -#define UPF_SPD_MASK (0x1030) -#define UPF_SPD_HI (0x0010) -#define UPF_SPD_VHI (0x0020) -#define UPF_SPD_CUST (0x0030) -#define UPF_SPD_SHI (0x1000) -#define UPF_SPD_WARP (0x1010) -#define UPF_SKIP_TEST (1 << 6) -#define UPF_AUTO_IRQ (1 << 7) -#define UPF_HARDPPS_CD (1 << 11) -#define UPF_LOW_LATENCY (1 << 13) -#define UPF_BUGGY_UART (1 << 14) -#define UPF_MAGIC_MULTIPLIER (1 << 16) -#define UPF_CONS_FLOW (1 << 23) -#define UPF_SHARE_IRQ (1 << 24) -#define UPF_BOOT_AUTOCONF (1 << 28) -#define UPF_IOREMAP (1 << 31) - -#define UPF_CHANGE_MASK (0x17fff) -#define UPF_USR_MASK (UPF_SPD_MASK|UPF_LOW_LATENCY) + upf_t flags; + +#define UPF_FOURPORT ((__force upf_t) (1 << 1)) +#define UPF_SAK ((__force upf_t) (1 << 2)) +#define UPF_SPD_MASK ((__force upf_t) (0x1030)) +#define UPF_SPD_HI ((__force upf_t) (0x0010)) +#define UPF_SPD_VHI ((__force upf_t) (0x0020)) +#define UPF_SPD_CUST ((__force upf_t) (0x0030)) +#define UPF_SPD_SHI ((__force upf_t) (0x1000)) +#define UPF_SPD_WARP ((__force upf_t) (0x1010)) +#define UPF_SKIP_TEST ((__force upf_t) (1 << 6)) +#define UPF_AUTO_IRQ ((__force upf_t) (1 << 7)) +#define UPF_HARDPPS_CD ((__force upf_t) (1 << 11)) +#define UPF_LOW_LATENCY ((__force upf_t) (1 << 13)) +#define UPF_BUGGY_UART ((__force upf_t) (1 << 14)) +#define UPF_MAGIC_MULTIPLIER ((__force upf_t) (1 << 16)) +#define UPF_CONS_FLOW ((__force upf_t) (1 << 23)) +#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24)) +#define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28)) +#define UPF_IOREMAP ((__force upf_t) (1 << 31)) + +#define UPF_CHANGE_MASK ((__force upf_t) (0x17fff)) +#define UPF_USR_MASK ((__force upf_t) (UPF_SPD_MASK|UPF_LOW_LATENCY)) unsigned int mctrl; /* current modem ctrl settings */ unsigned int timeout; /* character-based timeout */ -- cgit v1.2.3