From 43e89a08623db81fd636774cc672471ebdd698fb Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Tue, 31 Oct 2023 14:05:38 +0000 Subject: [PATCH] tty: Replace unsigned char to u8 for Linux 6.6 Based on following change, replace the unsigned char to u8 for serial:wch_serial. -- commit dcaafbe6ee3b39f2df11a1352f85172f8ade17a5 Author: Jiri Slaby (SUSE) tty: propagate u8 data to tty_operations::put_char() --- Bug 4346767 Change-Id: I2555383d59fe8c95a7a1b6220e3209138416c2eb Signed-off-by: Laxman Dewangan Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3007447 Tested-by: Bitan Biswas Reviewed-by: Bitan Biswas GVS: Gerrit_Virtual_Submit --- Makefile | 3 +++ drivers/tty/serial/wch_35x/wch_serial.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/Makefile b/Makefile index f3d2c2e4..47faf16c 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,9 @@ subdir-ccflags-y += -DNV_SND_SOC_DAI_OPS_STRUCT_HAS_PROBE_ARG # probe_new is removed from i2c driver structure subdir-ccflags-y += -DNV_I2C_LEGACY_PROBE_NEW_REMOVED + +# API changes to replace u8 with unsigned char +subdir-ccflags-y += -DNV_TTY_SERIAL_TYPE_U8_CHANGE endif ifeq ($(CONFIG_TEGRA_VIRTUALIZATION),y) diff --git a/drivers/tty/serial/wch_35x/wch_serial.c b/drivers/tty/serial/wch_35x/wch_serial.c index 44721695..1f824b5d 100644 --- a/drivers/tty/serial/wch_35x/wch_serial.c +++ b/drivers/tty/serial/wch_35x/wch_serial.c @@ -54,7 +54,11 @@ static void ser_tasklet_action(unsigned long); static int ser_startup(struct ser_state *, int); static void ser_shutdown(struct ser_state *); static _INLINE_ void _ser_put_char(struct ser_port *, struct circ_buf *, unsigned char); +#if defined(NV_TTY_SERIAL_TYPE_U8_CHANGE) +static int ser_put_char(struct tty_struct *, u8); +#else static int ser_put_char(struct tty_struct *, unsigned char); +#endif static void ser_flush_chars(struct tty_struct *); static unsigned int ser_chars_in_buffer(struct tty_struct *tty); static void ser_flush_buffer(struct tty_struct *); @@ -64,7 +68,11 @@ static void ser_unthrottle(struct tty_struct *); static int ser_get_info(struct ser_state *, struct serial_struct *); static int ser_set_info(struct ser_state *, struct serial_struct *); static unsigned int ser_write_room(struct tty_struct *tty); +#if defined(NV_TTY_SERIAL_TYPE_U8_CHANGE) +static ssize_t ser_write(struct tty_struct *, const u8 *, size_t); +#else static int ser_write(struct tty_struct *, const unsigned char *, int); +#endif // static int ser_get_lsr_info(struct ser_state *, unsigned int *); static int ser_tiocmget(struct tty_struct *); static int ser_tiocmset(struct tty_struct *, unsigned int, unsigned int); @@ -614,7 +622,11 @@ static _INLINE_ void _ser_put_char(struct ser_port *port, struct circ_buf *circ, spin_unlock_irqrestore(&port->lock, flags); } +#if defined(NV_TTY_SERIAL_TYPE_U8_CHANGE) +static int ser_put_char(struct tty_struct *tty, u8 ch) +#else static int ser_put_char(struct tty_struct *tty, unsigned char ch) +#endif { struct ser_state *state = NULL; int line = WCH_SER_DEVNUM(tty); @@ -909,7 +921,11 @@ static unsigned int ser_write_room(struct tty_struct *tty) return status; } +#if defined(NV_TTY_SERIAL_TYPE_U8_CHANGE) +static ssize_t ser_write(struct tty_struct *tty, const u8 *buf, size_t count) +#else static int ser_write(struct tty_struct *tty, const unsigned char *buf, int count) +#endif { struct ser_state *state = tty->driver_data; struct ser_port *port = NULL;