[PATCH v1 01/19] hid-ft260: fix incompatible-pointer-types error

From: Michael Zaidman
Date: Sat Feb 10 2024 - 16:53:04 EST


Fixed compilation error introduced by "hid-ft260: Add serial driver" patch
https://lore.kernel.org/all/20231218093153.192268-1-contact@xxxxxxxxxxxxxxxxxx/

You are using: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
CC [M] /home/michael/sw/hid-ft260/hid-ft260.o
/home/michael/sw/hid-ft260/hid-ft260.c:1426:35: error: initialization of ‘int (*)(struct tty_struct *,
const unsigned char *, int)’ from incompatible pointer type ‘ssize_t (*)(struct tty_struct *,
const unsigned char *, size_t)’ {aka ‘long int (*)(struct tty_struct *, const unsigned char *,
long unsigned int)’} [-Werror=incompatible-pointer-types]
1426 | .write = ft260_uart_write,
| ^~~~~~~~~~~~~~~~
/home/michael/sw/hid-ft260/hid-ft260.c:1426:35: note: (near initialization for ‘ft260_uart_ops.write’)
cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:251: /home/michael/sw/hid-ft260/hid-ft260.o] Error 1
make[2]: *** [/usr/src/linux-headers-6.5.0-14-generic/Makefile:2037: /home/michael/sw/hid-ft260] Error 2
make[1]: *** [Makefile:234: __sub-make] Error 2

Signed-off-by: Michael Zaidman <michael.zaidman@xxxxxxxxx>
---
drivers/hid/hid-ft260.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c
index cc2cce3698e3..7273d401337a 100644
--- a/drivers/hid/hid-ft260.c
+++ b/drivers/hid/hid-ft260.c
@@ -1220,8 +1220,8 @@ static int ft260_uart_receive_chars(struct ft260_device *port,
return ret;
}

-static ssize_t ft260_uart_write(struct tty_struct *tty, const unsigned char *buf,
- size_t count)
+static int ft260_uart_write(struct tty_struct *tty, const unsigned char *buf,
+ int count)
{
struct ft260_device *port = tty->driver_data;
struct hid_device *hdev = port->hdev;
--
2.40.1