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 <thomas.petazzoni@bootlin.com>
In upstream Linux kernel commits:
95713967ba52389f7cea75704d0cf048080ec218 ("tty: make tty_operations::write()'s count size_t")
69851e4ab8feeb369119a44ddca430c0ee15f0d8 ("tty: propagate u8 data to tty_operations::write()")
The prototype of tty_operations->write() was changed from:
int (*write)(struct tty_struct * tty,
const unsigned char *buf, int count);
to:
ssize_t (*write)(struct tty_struct *tty, const u8 *buf, size_t count);
Both of those commits were merged in Linux 6.6, and this needs an
update in tty/module.c to avoid the following build failure:
/home/autobuild/autobuild/instance-7/output-1/build/igh-ethercat-1.6.2/./tty/module.c:740:14: error: initialization of "ssize_t (*)(struct tty_struct *, const u8 *, size_t)" {aka "long int (*)(struct tty_struct *, const unsigned char *, long unsigned int)"} from incompatible pointer type "int (*)(struct tty_struct *, const unsigned char *, int)" [-Werror=incompatible-pointer-types]
740 | .write = ec_tty_write,
| ^~~~~~~~~~~~
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
alloc_tty_driver was deprecated by tty_alloc_driver in commit 7f0bc6a68ed9
(TTY: pass flags to alloc_tty_driver) in 2012 but first in kernel
v5.15 it has been dropped (56ec5880a28e). Switch to tty_alloc_driver
when using kernels >= v5.15
As of v5.15, the put_tty_driver alias has been dropped in favor of
directly calling tty_driver_kref_put (9f90a4ddef4e). Switch to
tty_driver_kref_put when using kernels >= v5.15
As from v5.14 the write_room (03b3b1a2405c) and
chars_in_buffer (fff4ef17a940) methods' return type changed from int
to unsigned int in struct tty_operations. This has impact on
ec_tty_write_room() and ec_tty_chars_in_buffer().
tty/module.c: fixups for linux >= v6.1
See merge request etherlab.org/ethercat!68
(cherry picked from commit f8c9ec6e48)
bbb16b87 tty/module.c: adapt signature of ->set_termios method to v6.1
d39b4a59 tty/module.c: include proper header for INIT_C_CC definition