Re: [PATCH v5] tty: serial: Add RS422 flag to struct serial_rs485

From: Greg Kroah-Hartman
Date: Thu Nov 23 2023 - 12:23:12 EST


On Tue, Nov 21, 2023 at 05:51:22PM +0800, Crescent CY Hsieh wrote:
> --- a/include/uapi/linux/serial.h
> +++ b/include/uapi/linux/serial.h
> @@ -11,6 +11,7 @@
> #ifndef _UAPI_LINUX_SERIAL_H
> #define _UAPI_LINUX_SERIAL_H
>
> +#include <linux/const.h>
> #include <linux/types.h>
>
> #include <linux/tty_flags.h>
> @@ -137,17 +138,19 @@ struct serial_icounter_struct {
> * * %SER_RS485_ADDRB - Enable RS485 addressing mode.
> * * %SER_RS485_ADDR_RECV - Receive address filter (enables @addr_recv). Requires %SER_RS485_ADDRB.
> * * %SER_RS485_ADDR_DEST - Destination address (enables @addr_dest). Requires %SER_RS485_ADDRB.
> + * * %SER_RS485_MODE_RS422 - Enable RS422. Requires %SER_RS485_ENABLED.
> */
> struct serial_rs485 {
> __u32 flags;
> -#define SER_RS485_ENABLED (1 << 0)
> -#define SER_RS485_RTS_ON_SEND (1 << 1)
> -#define SER_RS485_RTS_AFTER_SEND (1 << 2)
> -#define SER_RS485_RX_DURING_TX (1 << 4)
> -#define SER_RS485_TERMINATE_BUS (1 << 5)
> -#define SER_RS485_ADDRB (1 << 6)
> -#define SER_RS485_ADDR_RECV (1 << 7)
> -#define SER_RS485_ADDR_DEST (1 << 8)
> +#define SER_RS485_ENABLED _BITUL(0)
> +#define SER_RS485_RTS_ON_SEND _BITUL(1)
> +#define SER_RS485_RTS_AFTER_SEND _BITUL(2)
> +#define SER_RS485_RX_DURING_TX _BITUL(3)
> +#define SER_RS485_TERMINATE_BUS _BITUL(4)
> +#define SER_RS485_ADDRB _BITUL(5)
> +#define SER_RS485_ADDR_RECV _BITUL(6)
> +#define SER_RS485_ADDR_DEST _BITUL(7)
> +#define SER_RS485_MODE_RS422 _BITUL(8)

You just broke userspace by changing the flags for existing values :(

Please be much more careful in the future, do not do "cleanup" patches
along with a "add a new feature" patch, as it would have been much more
obvious as to what happened here if you had done that.

thanks,

greg k-h