libs/xr_usb_serial_common: fix 6.6 kernel compile
[feed/packages.git] / libs / xr_usb_serial_common / patches / 0001-fix-kernel-6.6-builds.patch
1 From 5115918c11cc99e93586cef7f33d8d3907b7258a Mon Sep 17 00:00:00 2001
2 From: Adam Duskett <adam.duskett@amarulasolutions.com>
3 Date: Wed, 3 Apr 2024 12:45:41 -0600
4 Subject: [PATCH] Support Linux >= 6.2.0
5
6 FROM: https://github.com/kasbert/epsolar-tracer/pull/61
7
8 Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
9 ---
10 xr_usb_serial_common-1a/xr_usb_serial_common.c | 13 +++++++++++++
11 1 file changed, 13 insertions(+)
12
13 --- a/xr_usb_serial_common-1a/xr_usb_serial_common.c
14 +++ b/xr_usb_serial_common-1a/xr_usb_serial_common.c
15 @@ -643,8 +643,13 @@ static void xr_usb_serial_tty_close(stru
16 tty_port_close(&xr_usb_serial->port, tty, filp);
17 }
18
19 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)
20 +static ssize_t xr_usb_serial_tty_write(struct tty_struct *tty,
21 + const unsigned char *buf, size_t count)
22 +#else
23 static int xr_usb_serial_tty_write(struct tty_struct *tty,
24 const unsigned char *buf, int count)
25 +#endif
26 {
27 struct xr_usb_serial *xr_usb_serial = tty->driver_data;
28 int stat;
29 @@ -655,7 +660,11 @@ static int xr_usb_serial_tty_write(struc
30 if (!count)
31 return 0;
32
33 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)
34 + dev_vdbg(&xr_usb_serial->data->dev, "%s - count %ld\n", __func__, count);
35 +#else
36 dev_vdbg(&xr_usb_serial->data->dev, "%s - count %d\n", __func__, count);
37 +#endif
38
39 spin_lock_irqsave(&xr_usb_serial->write_lock, flags);
40 wbn = xr_usb_serial_wb_alloc(xr_usb_serial);
41 @@ -672,7 +681,11 @@ static int xr_usb_serial_tty_write(struc
42 }
43
44 count = (count > xr_usb_serial->writesize) ? xr_usb_serial->writesize : count;
45 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)
46 + dev_vdbg(&xr_usb_serial->data->dev, "%s - write %ld\n", __func__, count);
47 +#else
48 dev_vdbg(&xr_usb_serial->data->dev, "%s - write %d\n", __func__, count);
49 +#endif
50 memcpy(wb->buf, buf, count);
51 wb->len = count;
52