Skip to content

Commit c7ac15c

Browse files
andy-shevgregkh
authored andcommitted
serial: core: move UPF_NO_TXEN_TEST to quirks and rename
First 16 bits in the flags field are user-visible except UPF_NO_TXEN_TEST. To keep it clean we introduce internal quirks and move UPF_NO_TXEN_TEST to them. Rename the constant to UPQ_NO_TXEN_TEST to distinguish with port flags. Users are converted accordingly. The quirks field might be extended later to hold the additional ones. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a17e74c commit c7ac15c

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

drivers/tty/serial/8250/8250_core.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,11 @@ static void univ8250_rsa_support(struct uart_ops *ops)
497497
#define univ8250_rsa_support(x) do { } while (0)
498498
#endif /* CONFIG_SERIAL_8250_RSA */
499499

500+
static inline void serial8250_apply_quirks(struct uart_8250_port *up)
501+
{
502+
up->port.quirks |= skip_txen_test ? UPQ_NO_TXEN_TEST : 0;
503+
}
504+
500505
static void __init serial8250_isa_init_ports(void)
501506
{
502507
struct uart_8250_port *up;
@@ -577,9 +582,7 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev)
577582

578583
up->port.dev = dev;
579584

580-
if (skip_txen_test)
581-
up->port.flags |= UPF_NO_TXEN_TEST;
582-
585+
serial8250_apply_quirks(up);
583586
uart_add_one_port(drv, &up->port);
584587
}
585588
}
@@ -1006,9 +1009,6 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
10061009
if (up->port.dev)
10071010
uart->port.dev = up->port.dev;
10081011

1009-
if (skip_txen_test)
1010-
uart->port.flags |= UPF_NO_TXEN_TEST;
1011-
10121012
if (up->port.flags & UPF_FIXED_TYPE)
10131013
uart->port.type = up->port.type;
10141014

@@ -1047,6 +1047,7 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
10471047
serial8250_isa_config(0, &uart->port,
10481048
&uart->capabilities);
10491049

1050+
serial8250_apply_quirks(uart);
10501051
ret = uart_add_one_port(&serial8250_reg, &uart->port);
10511052
if (ret == 0)
10521053
ret = uart->port.line;
@@ -1081,11 +1082,10 @@ void serial8250_unregister_port(int line)
10811082
uart_remove_one_port(&serial8250_reg, &uart->port);
10821083
if (serial8250_isa_devs) {
10831084
uart->port.flags &= ~UPF_BOOT_AUTOCONF;
1084-
if (skip_txen_test)
1085-
uart->port.flags |= UPF_NO_TXEN_TEST;
10861085
uart->port.type = PORT_UNKNOWN;
10871086
uart->port.dev = &serial8250_isa_devs->dev;
10881087
uart->capabilities = 0;
1088+
serial8250_apply_quirks(uart);
10891089
uart_add_one_port(&serial8250_reg, &uart->port);
10901090
} else {
10911091
uart->port.dev = NULL;

drivers/tty/serial/8250/8250_pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,7 @@ static int skip_tx_en_setup(struct serial_private *priv,
15481548
const struct pciserial_board *board,
15491549
struct uart_8250_port *port, int idx)
15501550
{
1551-
port->port.flags |= UPF_NO_TXEN_TEST;
1551+
port->port.quirks |= UPQ_NO_TXEN_TEST;
15521552
dev_dbg(&priv->dev->dev,
15531553
"serial8250: skipping TxEn test for device [%04x:%04x] subsystem [%04x:%04x]\n",
15541554
priv->dev->vendor, priv->dev->device,

drivers/tty/serial/8250/8250_port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2304,7 +2304,7 @@ int serial8250_do_startup(struct uart_port *port)
23042304
* test if we receive TX irq. This way, we'll never enable
23052305
* UART_BUG_TXEN.
23062306
*/
2307-
if (up->port.flags & UPF_NO_TXEN_TEST)
2307+
if (up->port.quirks & UPQ_NO_TXEN_TEST)
23082308
goto dont_test_tx_en;
23092309

23102310
/*

include/linux/serial_core.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#ifndef LINUX_SERIAL_CORE_H
2121
#define LINUX_SERIAL_CORE_H
2222

23-
23+
#include <linux/bitops.h>
2424
#include <linux/compiler.h>
2525
#include <linux/interrupt.h>
2626
#include <linux/circ_buf.h>
@@ -144,7 +144,7 @@ struct uart_port {
144144
unsigned char x_char; /* xon/xoff char */
145145
unsigned char regshift; /* reg offset shift */
146146
unsigned char iotype; /* io access style */
147-
unsigned char unused1;
147+
unsigned char quirks; /* internal quirks */
148148

149149
#define UPIO_PORT (SERIAL_IO_PORT) /* 8b I/O port access */
150150
#define UPIO_HUB6 (SERIAL_IO_HUB6) /* Hub6 ISA card */
@@ -155,6 +155,9 @@ struct uart_port {
155155
#define UPIO_MEM32BE (SERIAL_IO_MEM32BE) /* 32b big endian */
156156
#define UPIO_MEM16 (SERIAL_IO_MEM16) /* 16b little endian */
157157

158+
/* quirks must be updated while holding port mutex */
159+
#define UPQ_NO_TXEN_TEST BIT(0)
160+
158161
unsigned int read_status_mask; /* driver specific */
159162
unsigned int ignore_status_mask; /* driver specific */
160163
struct uart_state *state; /* pointer to parent state */
@@ -175,7 +178,6 @@ struct uart_port {
175178
* [for bit definitions in the UPF_CHANGE_MASK]
176179
*
177180
* Bits [0..UPF_LAST_USER] are userspace defined/visible/changeable
178-
* except bit 15 (UPF_NO_TXEN_TEST) which is masked off.
179181
* The remaining bits are serial-core specific and not modifiable by
180182
* userspace.
181183
*/
@@ -192,7 +194,6 @@ struct uart_port {
192194
#define UPF_SPD_SHI ((__force upf_t) ASYNC_SPD_SHI /* 12 */ )
193195
#define UPF_LOW_LATENCY ((__force upf_t) ASYNC_LOW_LATENCY /* 13 */ )
194196
#define UPF_BUGGY_UART ((__force upf_t) ASYNC_BUGGY_UART /* 14 */ )
195-
#define UPF_NO_TXEN_TEST ((__force upf_t) (1 << 15))
196197
#define UPF_MAGIC_MULTIPLIER ((__force upf_t) ASYNC_MAGIC_MULTIPLIER /* 16 */ )
197198

198199
#define UPF_NO_THRE_TEST ((__force upf_t) (1 << 19))

0 commit comments

Comments
 (0)