Re: [PATCH v1 1/3] serial: 8250: move UPF_NO_TXEN_TEST to quirks and rename

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 10, 2016 at 01:52:51PM +0300, Andy Shevchenko wrote:
> 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.
> 
> The quirks field will be extended later to hold the additional ones.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
>  drivers/tty/serial/8250/8250_core.c | 6 +++---
>  drivers/tty/serial/8250/8250_pci.c  | 2 +-
>  drivers/tty/serial/8250/8250_port.c | 2 +-
>  include/linux/serial_core.h         | 9 ++++++---
>  4 files changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
> index 240a361..5a75146 100644
> --- a/drivers/tty/serial/8250/8250_core.c
> +++ b/drivers/tty/serial/8250/8250_core.c
> @@ -578,7 +578,7 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev)
>  		up->port.dev = dev;
>  
>  		if (skip_txen_test)
> -			up->port.flags |= UPF_NO_TXEN_TEST;
> +			up->port.quirks |= UPQ_NO_TXEN_TEST;
>  
>  		uart_add_one_port(drv, &up->port);
>  	}
> @@ -1006,7 +1006,7 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
>  			uart->port.dev = up->port.dev;
>  
>  		if (skip_txen_test)
> -			uart->port.flags |= UPF_NO_TXEN_TEST;
> +			uart->port.quirks |= UPQ_NO_TXEN_TEST;
>  
>  		if (up->port.flags & UPF_FIXED_TYPE)
>  			uart->port.type = up->port.type;
> @@ -1090,7 +1090,7 @@ void serial8250_unregister_port(int line)
>  	if (serial8250_isa_devs) {
>  		uart->port.flags &= ~UPF_BOOT_AUTOCONF;
>  		if (skip_txen_test)
> -			uart->port.flags |= UPF_NO_TXEN_TEST;
> +			uart->port.quirks |= UPQ_NO_TXEN_TEST;
>  		uart->port.type = PORT_UNKNOWN;
>  		uart->port.dev = &serial8250_isa_devs->dev;
>  		uart->capabilities = 0;
> diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
> index b98c157..6a82059 100644
> --- a/drivers/tty/serial/8250/8250_pci.c
> +++ b/drivers/tty/serial/8250/8250_pci.c
> @@ -1518,7 +1518,7 @@ static int skip_tx_en_setup(struct serial_private *priv,
>  			const struct pciserial_board *board,
>  			struct uart_8250_port *port, int idx)
>  {
> -	port->port.flags |= UPF_NO_TXEN_TEST;
> +	port->port.quirks |= UPQ_NO_TXEN_TEST;
>  	dev_dbg(&priv->dev->dev,
>  		"serial8250: skipping TxEn test for device [%04x:%04x] subsystem [%04x:%04x]\n",
>  		priv->dev->vendor, priv->dev->device,
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index b4b5cd4..cc03737 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -2274,7 +2274,7 @@ int serial8250_do_startup(struct uart_port *port)
>  	 * test if we receive TX irq.  This way, we'll never enable
>  	 * UART_BUG_TXEN.
>  	 */
> -	if (up->port.flags & UPF_NO_TXEN_TEST)
> +	if (up->port.quirks & UPQ_NO_TXEN_TEST)
>  		goto dont_test_tx_en;
>  
>  	/*
> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> index 3442014..509f6c5 100644
> --- a/include/linux/serial_core.h
> +++ b/include/linux/serial_core.h
> @@ -173,7 +173,6 @@ struct uart_port {
>  	 * [for bit definitions in the UPF_CHANGE_MASK]
>  	 *
>  	 * Bits [0..UPF_LAST_USER] are userspace defined/visible/changeable
> -	 * except bit 15 (UPF_NO_TXEN_TEST) which is masked off.
>  	 * The remaining bits are serial-core specific and not modifiable by
>  	 * userspace.
>  	 */
> @@ -190,7 +189,6 @@ struct uart_port {
>  #define UPF_SPD_SHI		((__force upf_t) ASYNC_SPD_SHI        /* 12 */ )
>  #define UPF_LOW_LATENCY		((__force upf_t) ASYNC_LOW_LATENCY    /* 13 */ )
>  #define UPF_BUGGY_UART		((__force upf_t) ASYNC_BUGGY_UART     /* 14 */ )
> -#define UPF_NO_TXEN_TEST	((__force upf_t) (1 << 15))
>  #define UPF_MAGIC_MULTIPLIER	((__force upf_t) ASYNC_MAGIC_MULTIPLIER /* 16 */ )
>  
>  /* Port has hardware-assisted h/w flow control */
> @@ -244,7 +242,12 @@ struct uart_port {
>  	unsigned char		hub6;			/* this should be in the 8250 driver */
>  	unsigned char		suspended;
>  	unsigned char		irq_wake;
> -	unsigned char		unused[2];
> +
> +	unsigned char		quirks;			/* internal quirks */
> +
> +	/* quirks must be updated while holding port mutex */
> +#define UPQ_NO_TXEN_TEST	(1 << 0)
> +

BIT(0)?
And you dropped the other "unused" byte, why?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux