From 2824232792364140569d522627b48a64e5d3a690 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Tue, 31 Dec 2024 10:38:03 +0100 Subject: [PATCH] tty/module.c: fix ec_tty_send_xchar() prototype for Linux >= 6.8 In upstream Linux kernel commit: 3a00da027946cd08db1c1be2de4620950bbdf074 ("tty: make tty_operations::send_xchar accept u8 char") The prototype of tty_operations->send_xchar() was changed from: void (*send_xchar)(struct tty_struct *tty, char ch); to: void (*send_xchar)(struct tty_struct *tty, u8 ch); This commit was merged in Linux 6.8, and therefore the ec_tty_send_xchar() implementation needs to be changed to avoid the following build failure: /home/autobuild/autobuild/instance-7/output-1/build/igh-ethercat-1.6.2/./tty/module.c:751:19: error: initialization of "void (*)(struct tty_struct *, u8)" {aka "void (*)(struct tty_struct *, unsigned char)"} from incompatible pointer type "void (*)(struct tty_struct *, char)" [-Werror=incompatible-pointer-types] 751 | .send_xchar = ec_tty_send_xchar, | ^~~~~~~~~~~~~~~~~ Signed-off-by: Thomas Petazzoni --- tty/module.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tty/module.c b/tty/module.c index 354ddfd6..2b7b22bb 100644 --- a/tty/module.c +++ b/tty/module.c @@ -724,7 +724,11 @@ static int ec_tty_break(struct tty_struct *tty, int break_state) /****************************************************************************/ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0) +static void ec_tty_send_xchar(struct tty_struct *tty, u8 ch) +#else static void ec_tty_send_xchar(struct tty_struct *tty, char ch) +#endif { #if EC_TTY_DEBUG >= 2 printk(KERN_INFO PFX "%s(ch=%02x).\n", __func__, (unsigned int) ch);