From 99037697410f4df41558fc4227a9141dc1e24f59 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Mon, 31 Jul 2023 10:02:42 +0200 Subject: misc: ti-st: remove forward declarations and make st_int_recv() static st_kim_recv() is already declared in linux/ti_wilink_st.h. Given that is already included in st_core.c, drop the re-declaration from there. st_int_recv() is used only in st_core.c and the forward declaration is not needed. So drop the declaration and make the function static. Signed-off-by: Jiri Slaby (SUSE) Cc: Arnd Bergmann Link: https://lore.kernel.org/r/20230731080244.2698-9-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/misc/ti-st/st_core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/misc') diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index 01d2257deea4..389901276ce3 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c @@ -16,8 +16,6 @@ #include -extern void st_kim_recv(void *, const unsigned char *, long); -void st_int_recv(void *, const unsigned char *, long); /* * function pointer pointing to either, * st_kim_recv during registration to receive fw download responses @@ -225,7 +223,7 @@ static inline void st_wakeup_ack(struct st_data_s *st_gdata, * HCI-Events, ACL, SCO, 4 types of HCI-LL PM packets * CH-8 packets from FM, CH-9 packets from GPS cores. */ -void st_int_recv(void *disc_data, +static void st_int_recv(void *disc_data, const unsigned char *data, long count) { char *ptr; -- cgit v1.2.3 From a60b3017601ef7f338ac44b942e917362f222b1c Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Mon, 31 Jul 2023 10:02:43 +0200 Subject: misc: ti-st: remove ptr from recv functions ptr is the same as data, so use ptr directly as a parameter and drop the useless local variable. Likely, the two were introduced to have a different type. But 'char' and 'unsigned char' are the same in the kernel for a long time. Signed-off-by: Jiri Slaby (SUSE) Cc: Arnd Bergmann Link: https://lore.kernel.org/r/20230731080244.2698-10-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/misc/ti-st/st_core.c | 4 +--- drivers/misc/ti-st/st_kim.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'drivers/misc') diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index 389901276ce3..e2add50b191c 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c @@ -224,9 +224,8 @@ static inline void st_wakeup_ack(struct st_data_s *st_gdata, * CH-8 packets from FM, CH-9 packets from GPS cores. */ static void st_int_recv(void *disc_data, - const unsigned char *data, long count) + const unsigned char *ptr, long count) { - char *ptr; struct st_proto_s *proto; unsigned short payload_len = 0; int len = 0; @@ -235,7 +234,6 @@ static void st_int_recv(void *disc_data, struct st_data_s *st_gdata = (struct st_data_s *)disc_data; unsigned long flags; - ptr = (char *)data; /* tty_receive sent null ? */ if (unlikely(ptr == NULL) || (st_gdata == NULL)) { pr_err(" received null from TTY "); diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index f2f6cab97c08..8c801897ffa2 100644 --- a/drivers/misc/ti-st/st_kim.c +++ b/drivers/misc/ti-st/st_kim.c @@ -128,15 +128,13 @@ static inline int kim_check_data_len(struct kim_data_s *kim_gdata, int len) * tty_receive and hence the logic */ static void kim_int_recv(struct kim_data_s *kim_gdata, - const unsigned char *data, long count) + const unsigned char *ptr, long count) { - const unsigned char *ptr; int len = 0; unsigned char *plen; pr_debug("%s", __func__); /* Decode received bytes here */ - ptr = data; if (unlikely(ptr == NULL)) { pr_err(" received null from TTY "); return; -- cgit v1.2.3 From 9b5752d1a882c96c0319aebe55bbfe9ad0c9aa30 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Mon, 31 Jul 2023 10:02:44 +0200 Subject: misc: ti-st: don't check for tty data == NULL tty data passed to tty_ldisc_ops::receive_buf() are never NULL. Remove this check. Signed-off-by: Jiri Slaby (SUSE) Cc: Arnd Bergmann Link: https://lore.kernel.org/r/20230731080244.2698-11-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/misc/ti-st/st_core.c | 3 +-- drivers/misc/ti-st/st_kim.c | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) (limited to 'drivers/misc') diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index e2add50b191c..3b2145722bd7 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c @@ -234,8 +234,7 @@ static void st_int_recv(void *disc_data, struct st_data_s *st_gdata = (struct st_data_s *)disc_data; unsigned long flags; - /* tty_receive sent null ? */ - if (unlikely(ptr == NULL) || (st_gdata == NULL)) { + if (st_gdata == NULL) { pr_err(" received null from TTY "); return; } diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index 8c801897ffa2..5431a89924aa 100644 --- a/drivers/misc/ti-st/st_kim.c +++ b/drivers/misc/ti-st/st_kim.c @@ -135,11 +135,6 @@ static void kim_int_recv(struct kim_data_s *kim_gdata, pr_debug("%s", __func__); /* Decode received bytes here */ - if (unlikely(ptr == NULL)) { - pr_err(" received null from TTY "); - return; - } - while (count) { if (kim_gdata->rx_count) { len = min_t(unsigned int, kim_gdata->rx_count, count); -- cgit v1.2.3 From e8161447bb0ce2d59277e9276012dd1c6f357850 Mon Sep 17 00:00:00 2001 From: "Jiri Slaby (SUSE)" Date: Thu, 10 Aug 2023 11:14:49 +0200 Subject: tty: make tty_ldisc_ops::*buf*() hooks operate on size_t Count passed to tty_ldisc_ops::receive_buf*(), ::lookahead_buf(), and returned from ::receive_buf2() is expected to be size_t. So set it to size_t to unify with the rest of the code. Signed-off-by: "Jiri Slaby (SUSE)" Cc: William Hubbs Cc: Chris Brannon Cc: Kirk Reiser Cc: Samuel Thibault Cc: Marcel Holtmann Cc: Johan Hedberg Cc: Luiz Augusto von Dentz Cc: Dmitry Torokhov Cc: Arnd Bergmann Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: Max Staudt Cc: Wolfgang Grandegger Cc: Marc Kleine-Budde Cc: Dario Binacchi Cc: Andreas Koensgen Cc: Jeremy Kerr Cc: Matt Johnston Cc: Krzysztof Kozlowski Cc: Liam Girdwood Cc: Mark Brown Cc: Jaroslav Kysela Cc: Takashi Iwai Acked-by: Mark Brown Link: https://lore.kernel.org/r/20230810091510.13006-16-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/accessibility/speakup/spk_ttyio.c | 6 +++--- drivers/bluetooth/hci_ldisc.c | 2 +- drivers/input/serio/serport.c | 3 ++- drivers/misc/ti-st/st_core.c | 2 +- drivers/net/caif/caif_serial.c | 2 +- drivers/net/can/can327.c | 4 ++-- drivers/net/can/slcan/slcan-core.c | 2 +- drivers/net/hamradio/6pack.c | 2 +- drivers/net/hamradio/mkiss.c | 2 +- drivers/net/mctp/mctp-serial.c | 2 +- drivers/net/ppp/ppp_async.c | 2 +- drivers/net/ppp/ppp_synctty.c | 2 +- drivers/net/slip/slip.c | 2 +- drivers/tty/n_gsm.c | 2 +- drivers/tty/n_hdlc.c | 4 ++-- drivers/tty/n_tty.c | 14 ++++++++------ include/linux/tty_ldisc.h | 16 ++++++++-------- net/nfc/nci/uart.c | 2 +- sound/soc/codecs/cx20442.c | 2 +- 19 files changed, 38 insertions(+), 35 deletions(-) (limited to 'drivers/misc') diff --git a/drivers/accessibility/speakup/spk_ttyio.c b/drivers/accessibility/speakup/spk_ttyio.c index 5d4bafe118ec..736f622068ce 100644 --- a/drivers/accessibility/speakup/spk_ttyio.c +++ b/drivers/accessibility/speakup/spk_ttyio.c @@ -71,9 +71,9 @@ static void spk_ttyio_ldisc_close(struct tty_struct *tty) kfree(tty->disc_data); } -static int spk_ttyio_receive_buf2(struct tty_struct *tty, - const unsigned char *cp, - const char *fp, int count) +static size_t spk_ttyio_receive_buf2(struct tty_struct *tty, + const unsigned char *cp, const char *fp, + size_t count) { struct spk_ldisc_data *ldisc_data = tty->disc_data; struct spk_synth *synth = ldisc_data->synth; diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 5224b0961200..32bef61c5901 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c @@ -599,7 +599,7 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty) * Return Value: None */ static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data, - const char *flags, int count) + const char *flags, size_t count) { struct hci_uart *hu = tty->disc_data; diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c index a5d8953f5904..7fc6155131f8 100644 --- a/drivers/input/serio/serport.c +++ b/drivers/input/serio/serport.c @@ -115,7 +115,8 @@ static void serport_ldisc_close(struct tty_struct *tty) */ static void serport_ldisc_receive(struct tty_struct *tty, - const unsigned char *cp, const char *fp, int count) + const unsigned char *cp, const char *fp, + size_t count) { struct serport *serport = tty->disc_data; unsigned long flags; diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index 3b2145722bd7..c89024ab3d77 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c @@ -792,7 +792,7 @@ static void st_tty_close(struct tty_struct *tty) } static void st_tty_receive(struct tty_struct *tty, const unsigned char *data, - const char *tty_flags, int count) + const char *tty_flags, size_t count) { #ifdef VERBOSE print_hex_dump(KERN_DEBUG, ">in>", DUMP_PREFIX_NONE, diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c index 688075859ae4..feda04dbe837 100644 --- a/drivers/net/caif/caif_serial.c +++ b/drivers/net/caif/caif_serial.c @@ -159,7 +159,7 @@ static inline void debugfs_tx(struct ser_device *ser, const u8 *data, int size) #endif static void ldisc_receive(struct tty_struct *tty, const u8 *data, - const char *flags, int count) + const char *flags, size_t count) { struct sk_buff *skb = NULL; struct ser_device *ser; diff --git a/drivers/net/can/can327.c b/drivers/net/can/can327.c index 4533dc00f215..4bf970df7e84 100644 --- a/drivers/net/can/can327.c +++ b/drivers/net/can/can327.c @@ -886,7 +886,7 @@ static bool can327_is_valid_rx_char(u8 c) * functions may be called in parallel. */ static void can327_ldisc_rx(struct tty_struct *tty, const unsigned char *cp, - const char *fp, int count) + const char *fp, size_t count) { struct can327 *elm = tty->disc_data; size_t first_new_char_idx; @@ -904,7 +904,7 @@ static void can327_ldisc_rx(struct tty_struct *tty, const unsigned char *cp, while (count--) { if (elm->rxfill >= CAN327_SIZE_RXBUF) { netdev_err(elm->dev, - "Receive buffer overflowed. Bad chip or wiring? count = %i", + "Receive buffer overflowed. Bad chip or wiring? count = %zu", count); goto uart_failure; } diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c index 371af9d17b14..63371563d8e2 100644 --- a/drivers/net/can/slcan/slcan-core.c +++ b/drivers/net/can/slcan/slcan-core.c @@ -776,7 +776,7 @@ static const struct net_device_ops slcan_netdev_ops = { */ static void slcan_receive_buf(struct tty_struct *tty, const unsigned char *cp, const char *fp, - int count) + size_t count) { struct slcan *sl = tty->disc_data; diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 9fb567524220..2089efb0d360 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c @@ -428,7 +428,7 @@ out: * and sent on to some IP layer for further processing. */ static void sixpack_receive_buf(struct tty_struct *tty, - const unsigned char *cp, const char *fp, int count) + const unsigned char *cp, const char *fp, size_t count) { struct sixpack *sp; int count1; diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index c251e04ae047..1efab6037c7e 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c @@ -875,7 +875,7 @@ static int mkiss_ioctl(struct tty_struct *tty, unsigned int cmd, * and sent on to the AX.25 layer for further processing. */ static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp, - const char *fp, int count) + const char *fp, size_t count) { struct mkiss *ax = mkiss_get(tty); diff --git a/drivers/net/mctp/mctp-serial.c b/drivers/net/mctp/mctp-serial.c index 9f9eaf896047..6761f4ff2e7c 100644 --- a/drivers/net/mctp/mctp-serial.c +++ b/drivers/net/mctp/mctp-serial.c @@ -392,7 +392,7 @@ static void mctp_serial_push(struct mctp_serial *dev, unsigned char c) static void mctp_serial_tty_receive_buf(struct tty_struct *tty, const unsigned char *c, - const char *f, int len) + const char *f, size_t len) { struct mctp_serial *dev = tty->disc_data; int i; diff --git a/drivers/net/ppp/ppp_async.c b/drivers/net/ppp/ppp_async.c index f420bddb6a8c..79b8fca47edb 100644 --- a/drivers/net/ppp/ppp_async.c +++ b/drivers/net/ppp/ppp_async.c @@ -331,7 +331,7 @@ ppp_asynctty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) /* May sleep, don't call from interrupt level or with interrupts disabled */ static void ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, - const char *cflags, int count) + const char *cflags, size_t count) { struct asyncppp *ap = ap_get(tty); unsigned long flags; diff --git a/drivers/net/ppp/ppp_synctty.c b/drivers/net/ppp/ppp_synctty.c index 86dacef84c6c..767aca32b315 100644 --- a/drivers/net/ppp/ppp_synctty.c +++ b/drivers/net/ppp/ppp_synctty.c @@ -324,7 +324,7 @@ ppp_synctty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) /* May sleep, don't call from interrupt level or with interrupts disabled */ static void ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf, - const char *cflags, int count) + const char *cflags, size_t count) { struct syncppp *ap = sp_get(tty); unsigned long flags; diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c index 6865d32270e5..39450bf748a5 100644 --- a/drivers/net/slip/slip.c +++ b/drivers/net/slip/slip.c @@ -686,7 +686,7 @@ static void sl_setup(struct net_device *dev) */ static void slip_receive_buf(struct tty_struct *tty, const unsigned char *cp, - const char *fp, int count) + const char *fp, size_t count) { struct slip *sl = tty->disc_data; diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index c7a787f10a9c..2f85877b8ba1 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -3490,7 +3490,7 @@ static void gsmld_detach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) } static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp, - const char *fp, int count) + const char *fp, size_t count) { struct gsm_mux *gsm = tty->disc_data; char flags = TTY_NORMAL; diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c index 46b09bfb6f3a..ce3c779f5c03 100644 --- a/drivers/tty/n_hdlc.c +++ b/drivers/tty/n_hdlc.c @@ -370,12 +370,12 @@ static void n_hdlc_tty_wakeup(struct tty_struct *tty) * interpreted as one HDLC frame. */ static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data, - const char *flags, int count) + const char *flags, size_t count) { register struct n_hdlc *n_hdlc = tty->disc_data; register struct n_hdlc_buf *buf; - pr_debug("%s() called count=%d\n", __func__, count); + pr_debug("%s() called count=%zu\n", __func__, count); if (count > maxframe) { pr_debug("rx count>maxframesize, data discarded\n"); diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 0043cc84b91a..ee9b20dcbce6 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -1480,7 +1480,7 @@ n_tty_receive_char_lnext(struct tty_struct *tty, unsigned char c, char flag) /* Caller must ensure count > 0 */ static void n_tty_lookahead_flow_ctrl(struct tty_struct *tty, const unsigned char *cp, - const unsigned char *fp, unsigned int count) + const unsigned char *fp, size_t count) { struct n_tty_data *ldata = tty->disc_data; unsigned char flag = TTY_NORMAL; @@ -1662,12 +1662,13 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp, * claims non-exclusive %termios_rwsem * publishes commit_head or canon_head */ -static int +static size_t n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp, const char *fp, int count, int flow) { struct n_tty_data *ldata = tty->disc_data; - int room, n, rcvd = 0, overflow; + size_t rcvd = 0; + int room, n, overflow; down_read(&tty->termios_rwsem); @@ -1744,13 +1745,14 @@ n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp, } static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp, - const char *fp, int count) + const char *fp, size_t count) { n_tty_receive_buf_common(tty, cp, fp, count, 0); } -static int n_tty_receive_buf2(struct tty_struct *tty, const unsigned char *cp, - const char *fp, int count) +static size_t n_tty_receive_buf2(struct tty_struct *tty, + const unsigned char *cp, const char *fp, + size_t count) { return n_tty_receive_buf_common(tty, cp, fp, count, 1); } diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h index 62e089434995..f88529e6a783 100644 --- a/include/linux/tty_ldisc.h +++ b/include/linux/tty_ldisc.h @@ -162,7 +162,7 @@ int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass, * Optional. Can sleep. * * @receive_buf: [DRV] ``void ()(struct tty_struct *tty, - * const unsigned char *cp, const char *fp, int count)`` + * const unsigned char *cp, const char *fp, size_t count)`` * * This function is called by the low-level tty driver to send characters * received by the hardware to the line discpline for processing. @cp is @@ -191,8 +191,8 @@ int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass, * * Optional. * - * @receive_buf2: [DRV] ``int ()(struct tty_struct *tty, - * const unsigned char *cp, const char *fp, int count)`` + * @receive_buf2: [DRV] ``ssize_t ()(struct tty_struct *tty, + * const unsigned char *cp, const char *fp, size_t count)`` * * This function is called by the low-level tty driver to send characters * received by the hardware to the line discpline for processing. @cp is a @@ -205,7 +205,7 @@ int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass, * Optional. * * @lookahead_buf: [DRV] ``void ()(struct tty_struct *tty, - * const unsigned char *cp, const char *fp, int count)`` + * const unsigned char *cp, const char *fp, size_t count)`` * * This function is called by the low-level tty driver for characters * not eaten by ->receive_buf() or ->receive_buf2(). It is useful for @@ -256,13 +256,13 @@ struct tty_ldisc_ops { * The following routines are called from below. */ void (*receive_buf)(struct tty_struct *tty, const unsigned char *cp, - const char *fp, int count); + const char *fp, size_t count); void (*write_wakeup)(struct tty_struct *tty); void (*dcd_change)(struct tty_struct *tty, bool active); - int (*receive_buf2)(struct tty_struct *tty, const unsigned char *cp, - const char *fp, int count); + size_t (*receive_buf2)(struct tty_struct *tty, const unsigned char *cp, + const char *fp, size_t count); void (*lookahead_buf)(struct tty_struct *tty, const unsigned char *cp, - const unsigned char *fp, unsigned int count); + const unsigned char *fp, size_t count); struct module *owner; }; diff --git a/net/nfc/nci/uart.c b/net/nfc/nci/uart.c index c8249d95306d..c957ca6d2f87 100644 --- a/net/nfc/nci/uart.c +++ b/net/nfc/nci/uart.c @@ -296,7 +296,7 @@ static int nci_uart_default_recv_buf(struct nci_uart *nu, const u8 *data, * Return Value: None */ static void nci_uart_tty_receive(struct tty_struct *tty, const u8 *data, - const char *flags, int count) + const char *flags, size_t count) { struct nci_uart *nu = tty->disc_data; diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c index 43c0cac0ec9e..42cc863cbd53 100644 --- a/sound/soc/codecs/cx20442.c +++ b/sound/soc/codecs/cx20442.c @@ -259,7 +259,7 @@ static void v253_hangup(struct tty_struct *tty) /* Line discipline .receive_buf() */ static void v253_receive(struct tty_struct *tty, const unsigned char *cp, - const char *fp, int count) + const char *fp, size_t count) { struct snd_soc_component *component = tty->disc_data; struct cx20442_priv *cx20442; -- cgit v1.2.3 From a8d9cd2318606627d3c0e4747dbd7bbc44c48e27 Mon Sep 17 00:00:00 2001 From: "Jiri Slaby (SUSE)" Date: Thu, 10 Aug 2023 11:14:50 +0200 Subject: tty: use u8 for chars This makes all those 'unsigned char's an explicit 'u8'. This is part of the continuing unification of chars and flags to be consistent u8. This approaches tty_port_default_receive_buf(). Flags to be next. Signed-off-by: "Jiri Slaby (SUSE)" Cc: William Hubbs Cc: Chris Brannon Cc: Kirk Reiser Cc: Samuel Thibault Cc: Dmitry Torokhov Cc: Arnd Bergmann Cc: Max Staudt Cc: Wolfgang Grandegger Cc: Marc Kleine-Budde Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: Dario Binacchi Cc: Andreas Koensgen Cc: Jeremy Kerr Cc: Matt Johnston Cc: Liam Girdwood Cc: Mark Brown Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: Peter Ujfalusi Acked-by: Mark Brown Link: https://lore.kernel.org/r/20230810091510.13006-17-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/accessibility/speakup/spk_ttyio.c | 5 ++--- drivers/input/serio/serport.c | 5 ++--- drivers/misc/ti-st/st_core.c | 2 +- drivers/net/can/can327.c | 2 +- drivers/net/can/slcan/slcan-core.c | 5 ++--- drivers/net/hamradio/6pack.c | 4 ++-- drivers/net/hamradio/mkiss.c | 2 +- drivers/net/mctp/mctp-serial.c | 3 +-- drivers/net/ppp/ppp_async.c | 8 ++++---- drivers/net/ppp/ppp_synctty.c | 11 +++++------ drivers/net/slip/slip.c | 2 +- drivers/tty/n_gsm.c | 2 +- drivers/tty/n_hdlc.c | 2 +- drivers/tty/n_tty.c | 28 ++++++++++++++-------------- drivers/tty/tty.h | 2 +- drivers/tty/tty_buffer.c | 21 ++++++++++----------- include/linux/tty_buffer.h | 4 ++-- include/linux/tty_flip.h | 22 ++++++++++------------ include/linux/tty_ldisc.h | 18 +++++++++--------- sound/soc/codecs/cx20442.c | 4 ++-- sound/soc/ti/ams-delta.c | 2 +- 21 files changed, 73 insertions(+), 81 deletions(-) (limited to 'drivers/misc') diff --git a/drivers/accessibility/speakup/spk_ttyio.c b/drivers/accessibility/speakup/spk_ttyio.c index 736f622068ce..dd683a079c08 100644 --- a/drivers/accessibility/speakup/spk_ttyio.c +++ b/drivers/accessibility/speakup/spk_ttyio.c @@ -71,9 +71,8 @@ static void spk_ttyio_ldisc_close(struct tty_struct *tty) kfree(tty->disc_data); } -static size_t spk_ttyio_receive_buf2(struct tty_struct *tty, - const unsigned char *cp, const char *fp, - size_t count) +static size_t spk_ttyio_receive_buf2(struct tty_struct *tty, const u8 *cp, + const char *fp, size_t count) { struct spk_ldisc_data *ldisc_data = tty->disc_data; struct spk_synth *synth = ldisc_data->synth; diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c index 7fc6155131f8..8bf79d39964d 100644 --- a/drivers/input/serio/serport.c +++ b/drivers/input/serio/serport.c @@ -114,9 +114,8 @@ static void serport_ldisc_close(struct tty_struct *tty) * 'interrupt' routine. */ -static void serport_ldisc_receive(struct tty_struct *tty, - const unsigned char *cp, const char *fp, - size_t count) +static void serport_ldisc_receive(struct tty_struct *tty, const u8 *cp, + const char *fp, size_t count) { struct serport *serport = tty->disc_data; unsigned long flags; diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index c89024ab3d77..0ce4e46ff161 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c @@ -791,7 +791,7 @@ static void st_tty_close(struct tty_struct *tty) pr_debug("%s: done ", __func__); } -static void st_tty_receive(struct tty_struct *tty, const unsigned char *data, +static void st_tty_receive(struct tty_struct *tty, const u8 *data, const char *tty_flags, size_t count) { #ifdef VERBOSE diff --git a/drivers/net/can/can327.c b/drivers/net/can/can327.c index 4bf970df7e84..a054f5fd0d43 100644 --- a/drivers/net/can/can327.c +++ b/drivers/net/can/can327.c @@ -885,7 +885,7 @@ static bool can327_is_valid_rx_char(u8 c) * This will not be re-entered while running, but other ldisc * functions may be called in parallel. */ -static void can327_ldisc_rx(struct tty_struct *tty, const unsigned char *cp, +static void can327_ldisc_rx(struct tty_struct *tty, const u8 *cp, const char *fp, size_t count) { struct can327 *elm = tty->disc_data; diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c index 63371563d8e2..fe5671dbeb77 100644 --- a/drivers/net/can/slcan/slcan-core.c +++ b/drivers/net/can/slcan/slcan-core.c @@ -774,9 +774,8 @@ static const struct net_device_ops slcan_netdev_ops = { * be re-entered while running but other ldisc functions may be called * in parallel */ -static void slcan_receive_buf(struct tty_struct *tty, - const unsigned char *cp, const char *fp, - size_t count) +static void slcan_receive_buf(struct tty_struct *tty, const u8 *cp, + const char *fp, size_t count) { struct slcan *sl = tty->disc_data; diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 2089efb0d360..9a1f2a3f3b4f 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c @@ -427,8 +427,8 @@ out: * a block of 6pack data has been received, which can now be decapsulated * and sent on to some IP layer for further processing. */ -static void sixpack_receive_buf(struct tty_struct *tty, - const unsigned char *cp, const char *fp, size_t count) +static void sixpack_receive_buf(struct tty_struct *tty, const u8 *cp, + const char *fp, size_t count) { struct sixpack *sp; int count1; diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 1efab6037c7e..26dbcf49bfa6 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c @@ -874,7 +874,7 @@ static int mkiss_ioctl(struct tty_struct *tty, unsigned int cmd, * a block of data has been received, which can now be decapsulated * and sent on to the AX.25 layer for further processing. */ -static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp, +static void mkiss_receive_buf(struct tty_struct *tty, const u8 *cp, const char *fp, size_t count) { struct mkiss *ax = mkiss_get(tty); diff --git a/drivers/net/mctp/mctp-serial.c b/drivers/net/mctp/mctp-serial.c index 6761f4ff2e7c..5f809a18d308 100644 --- a/drivers/net/mctp/mctp-serial.c +++ b/drivers/net/mctp/mctp-serial.c @@ -390,8 +390,7 @@ static void mctp_serial_push(struct mctp_serial *dev, unsigned char c) } } -static void mctp_serial_tty_receive_buf(struct tty_struct *tty, - const unsigned char *c, +static void mctp_serial_tty_receive_buf(struct tty_struct *tty, const u8 *c, const char *f, size_t len) { struct mctp_serial *dev = tty->disc_data; diff --git a/drivers/net/ppp/ppp_async.c b/drivers/net/ppp/ppp_async.c index 79b8fca47edb..a661ccdea6ab 100644 --- a/drivers/net/ppp/ppp_async.c +++ b/drivers/net/ppp/ppp_async.c @@ -330,8 +330,8 @@ ppp_asynctty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) /* May sleep, don't call from interrupt level or with interrupts disabled */ static void -ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, - const char *cflags, size_t count) +ppp_asynctty_receive(struct tty_struct *tty, const u8 *buf, const char *cflags, + size_t count) { struct asyncppp *ap = ap_get(tty); unsigned long flags; @@ -819,8 +819,8 @@ process_input_packet(struct asyncppp *ap) other ldisc functions but will not be re-entered */ static void -ppp_async_input(struct asyncppp *ap, const unsigned char *buf, - const char *flags, int count) +ppp_async_input(struct asyncppp *ap, const u8 *buf, const char *flags, + int count) { struct sk_buff *skb; int c, i, j, n, s, f; diff --git a/drivers/net/ppp/ppp_synctty.c b/drivers/net/ppp/ppp_synctty.c index 767aca32b315..2a5cf6be9591 100644 --- a/drivers/net/ppp/ppp_synctty.c +++ b/drivers/net/ppp/ppp_synctty.c @@ -93,8 +93,8 @@ static int ppp_sync_ioctl(struct ppp_channel *chan, unsigned int cmd, static void ppp_sync_process(struct tasklet_struct *t); static int ppp_sync_push(struct syncppp *ap); static void ppp_sync_flush_output(struct syncppp *ap); -static void ppp_sync_input(struct syncppp *ap, const unsigned char *buf, - const char *flags, int count); +static void ppp_sync_input(struct syncppp *ap, const u8 *buf, const char *flags, + int count); static const struct ppp_channel_ops sync_ops = { .start_xmit = ppp_sync_send, @@ -323,8 +323,8 @@ ppp_synctty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) /* May sleep, don't call from interrupt level or with interrupts disabled */ static void -ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf, - const char *cflags, size_t count) +ppp_sync_receive(struct tty_struct *tty, const u8 *buf, const char *cflags, + size_t count) { struct syncppp *ap = sp_get(tty); unsigned long flags; @@ -655,8 +655,7 @@ ppp_sync_flush_output(struct syncppp *ap) * frame is considered to be in error and is tossed. */ static void -ppp_sync_input(struct syncppp *ap, const unsigned char *buf, - const char *flags, int count) +ppp_sync_input(struct syncppp *ap, const u8 *buf, const char *flags, int count) { struct sk_buff *skb; unsigned char *p; diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c index 39450bf748a5..7bfa90724e7b 100644 --- a/drivers/net/slip/slip.c +++ b/drivers/net/slip/slip.c @@ -685,7 +685,7 @@ static void sl_setup(struct net_device *dev) * in parallel */ -static void slip_receive_buf(struct tty_struct *tty, const unsigned char *cp, +static void slip_receive_buf(struct tty_struct *tty, const u8 *cp, const char *fp, size_t count) { struct slip *sl = tty->disc_data; diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 2f85877b8ba1..86d89bbbaa16 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -3489,7 +3489,7 @@ static void gsmld_detach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) gsm->tty = NULL; } -static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp, +static void gsmld_receive_buf(struct tty_struct *tty, const u8 *cp, const char *fp, size_t count) { struct gsm_mux *gsm = tty->disc_data; diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c index ce3c779f5c03..c86be060baed 100644 --- a/drivers/tty/n_hdlc.c +++ b/drivers/tty/n_hdlc.c @@ -369,7 +369,7 @@ static void n_hdlc_tty_wakeup(struct tty_struct *tty) * Called by tty low level driver when receive data is available. Data is * interpreted as one HDLC frame. */ -static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data, +static void n_hdlc_tty_receive(struct tty_struct *tty, const u8 *data, const char *flags, size_t count) { register struct n_hdlc *n_hdlc = tty->disc_data; diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index ee9b20dcbce6..d770007e5215 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -1479,7 +1479,7 @@ n_tty_receive_char_lnext(struct tty_struct *tty, unsigned char c, char flag) } /* Caller must ensure count > 0 */ -static void n_tty_lookahead_flow_ctrl(struct tty_struct *tty, const unsigned char *cp, +static void n_tty_lookahead_flow_ctrl(struct tty_struct *tty, const u8 *cp, const unsigned char *fp, size_t count) { struct n_tty_data *ldata = tty->disc_data; @@ -1500,8 +1500,8 @@ static void n_tty_lookahead_flow_ctrl(struct tty_struct *tty, const unsigned cha } static void -n_tty_receive_buf_real_raw(const struct tty_struct *tty, - const unsigned char *cp, int count) +n_tty_receive_buf_real_raw(const struct tty_struct *tty, const u8 *cp, + int count) { struct n_tty_data *ldata = tty->disc_data; size_t n, head; @@ -1520,7 +1520,7 @@ n_tty_receive_buf_real_raw(const struct tty_struct *tty, } static void -n_tty_receive_buf_raw(struct tty_struct *tty, const unsigned char *cp, +n_tty_receive_buf_raw(struct tty_struct *tty, const u8 *cp, const char *fp, int count) { struct n_tty_data *ldata = tty->disc_data; @@ -1537,7 +1537,7 @@ n_tty_receive_buf_raw(struct tty_struct *tty, const unsigned char *cp, } static void -n_tty_receive_buf_closing(struct tty_struct *tty, const unsigned char *cp, +n_tty_receive_buf_closing(struct tty_struct *tty, const u8 *cp, const char *fp, int count, bool lookahead_done) { char flag = TTY_NORMAL; @@ -1550,14 +1550,15 @@ n_tty_receive_buf_closing(struct tty_struct *tty, const unsigned char *cp, } } -static void n_tty_receive_buf_standard(struct tty_struct *tty, - const unsigned char *cp, const char *fp, int count, bool lookahead_done) +static void n_tty_receive_buf_standard(struct tty_struct *tty, const u8 *cp, + const char *fp, int count, + bool lookahead_done) { struct n_tty_data *ldata = tty->disc_data; char flag = TTY_NORMAL; while (count--) { - unsigned char c = *cp++; + u8 c = *cp++; if (fp) flag = *fp++; @@ -1588,7 +1589,7 @@ static void n_tty_receive_buf_standard(struct tty_struct *tty, } } -static void __receive_buf(struct tty_struct *tty, const unsigned char *cp, +static void __receive_buf(struct tty_struct *tty, const u8 *cp, const char *fp, int count) { struct n_tty_data *ldata = tty->disc_data; @@ -1663,7 +1664,7 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp, * publishes commit_head or canon_head */ static size_t -n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp, +n_tty_receive_buf_common(struct tty_struct *tty, const u8 *cp, const char *fp, int count, int flow) { struct n_tty_data *ldata = tty->disc_data; @@ -1744,15 +1745,14 @@ n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp, return rcvd; } -static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp, +static void n_tty_receive_buf(struct tty_struct *tty, const u8 *cp, const char *fp, size_t count) { n_tty_receive_buf_common(tty, cp, fp, count, 0); } -static size_t n_tty_receive_buf2(struct tty_struct *tty, - const unsigned char *cp, const char *fp, - size_t count) +static size_t n_tty_receive_buf2(struct tty_struct *tty, const u8 *cp, + const char *fp, size_t count) { return n_tty_receive_buf_common(tty, cp, fp, count, 1); } diff --git a/drivers/tty/tty.h b/drivers/tty/tty.h index 2751ac3946e7..e31cd9f281de 100644 --- a/drivers/tty/tty.h +++ b/drivers/tty/tty.h @@ -115,6 +115,6 @@ static inline void tty_audit_tiocsti(const struct tty_struct *tty, char ch) ssize_t redirected_tty_write(struct kiocb *, struct iov_iter *); int tty_insert_flip_string_and_push_buffer(struct tty_port *port, - const unsigned char *chars, size_t cnt); + const u8 *chars, size_t cnt); #endif diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 56f5732ce47f..9db42e6ed45b 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -316,8 +316,8 @@ EXPORT_SYMBOL_GPL(tty_buffer_request_room); * * Returns: the number added. */ -int tty_insert_flip_string_fixed_flag(struct tty_port *port, - const unsigned char *chars, char flag, size_t size) +int tty_insert_flip_string_fixed_flag(struct tty_port *port, const u8 *chars, + char flag, size_t size) { int copied = 0; bool flags = flag != TTY_NORMAL; @@ -355,8 +355,8 @@ EXPORT_SYMBOL(tty_insert_flip_string_fixed_flag); * * Returns: the number added. */ -int tty_insert_flip_string_flags(struct tty_port *port, - const unsigned char *chars, const char *flags, size_t size) +int tty_insert_flip_string_flags(struct tty_port *port, const u8 *chars, + const char *flags, size_t size) { int copied = 0; @@ -390,7 +390,7 @@ EXPORT_SYMBOL(tty_insert_flip_string_flags); * Queue a single byte @ch to the tty buffering, with an optional flag. This is * the slow path of tty_insert_flip_char(). */ -int __tty_insert_flip_char(struct tty_port *port, unsigned char ch, char flag) +int __tty_insert_flip_char(struct tty_port *port, u8 ch, char flag) { struct tty_buffer *tb; bool flags = flag != TTY_NORMAL; @@ -421,8 +421,7 @@ EXPORT_SYMBOL(__tty_insert_flip_char); * Returns: the length available and buffer pointer (@chars) to the space which * is now allocated and accounted for as ready for normal characters. */ -int tty_prepare_flip_string(struct tty_port *port, unsigned char **chars, - size_t size) +int tty_prepare_flip_string(struct tty_port *port, u8 **chars, size_t size) { int space = __tty_buffer_request_room(port, size, false); @@ -450,8 +449,8 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string); * * Returns: the number of bytes processed. */ -size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p, - const char *f, size_t count) +size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const u8 *p, const char *f, + size_t count) { if (ld->ops->receive_buf2) count = ld->ops->receive_buf2(ld->tty, p, f, count); @@ -489,7 +488,7 @@ static void lookahead_bufs(struct tty_port *port, struct tty_buffer *head) } if (port->client_ops->lookahead_buf) { - unsigned char *p, *f = NULL; + u8 *p, *f = NULL; p = char_buf_ptr(head, head->lookahead); if (head->flags) @@ -620,7 +619,7 @@ EXPORT_SYMBOL(tty_flip_buffer_push); * Returns: the number added. */ int tty_insert_flip_string_and_push_buffer(struct tty_port *port, - const unsigned char *chars, size_t size) + const u8 *chars, size_t size) { struct tty_bufhead *buf = &port->buf; unsigned long flags; diff --git a/include/linux/tty_buffer.h b/include/linux/tty_buffer.h index 6ceb2789e6c8..6f2966b15093 100644 --- a/include/linux/tty_buffer.h +++ b/include/linux/tty_buffer.h @@ -22,9 +22,9 @@ struct tty_buffer { unsigned long data[]; }; -static inline unsigned char *char_buf_ptr(struct tty_buffer *b, int ofs) +static inline u8 *char_buf_ptr(struct tty_buffer *b, int ofs) { - return ((unsigned char *)b->data) + ofs; + return ((u8 *)b->data) + ofs; } static inline char *flag_buf_ptr(struct tty_buffer *b, int ofs) diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h index 09c4dbcd0025..a0fcffeaaa25 100644 --- a/include/linux/tty_flip.h +++ b/include/linux/tty_flip.h @@ -10,17 +10,15 @@ struct tty_ldisc; int tty_buffer_set_limit(struct tty_port *port, int limit); unsigned int tty_buffer_space_avail(struct tty_port *port); int tty_buffer_request_room(struct tty_port *port, size_t size); -int tty_insert_flip_string_flags(struct tty_port *port, - const unsigned char *chars, const char *flags, size_t size); -int tty_insert_flip_string_fixed_flag(struct tty_port *port, - const unsigned char *chars, char flag, size_t size); -int tty_prepare_flip_string(struct tty_port *port, unsigned char **chars, - size_t size); +int tty_insert_flip_string_flags(struct tty_port *port, const u8 *chars, + const char *flags, size_t size); +int tty_insert_flip_string_fixed_flag(struct tty_port *port, const u8 *chars, + char flag, size_t size); +int tty_prepare_flip_string(struct tty_port *port, u8 **chars, size_t size); void tty_flip_buffer_push(struct tty_port *port); -int __tty_insert_flip_char(struct tty_port *port, unsigned char ch, char flag); +int __tty_insert_flip_char(struct tty_port *port, u8 ch, char flag); -static inline int tty_insert_flip_char(struct tty_port *port, - unsigned char ch, char flag) +static inline int tty_insert_flip_char(struct tty_port *port, u8 ch, char flag) { struct tty_buffer *tb = port->buf.tail; int change; @@ -36,13 +34,13 @@ static inline int tty_insert_flip_char(struct tty_port *port, } static inline int tty_insert_flip_string(struct tty_port *port, - const unsigned char *chars, size_t size) + const u8 *chars, size_t size) { return tty_insert_flip_string_fixed_flag(port, chars, TTY_NORMAL, size); } -size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p, - const char *f, size_t count); +size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const u8 *p, const char *f, + size_t count); void tty_buffer_lock_exclusive(struct tty_port *port); void tty_buffer_unlock_exclusive(struct tty_port *port); diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h index f88529e6a783..5551c4400e59 100644 --- a/include/linux/tty_ldisc.h +++ b/include/linux/tty_ldisc.h @@ -161,8 +161,8 @@ int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass, * * Optional. Can sleep. * - * @receive_buf: [DRV] ``void ()(struct tty_struct *tty, - * const unsigned char *cp, const char *fp, size_t count)`` + * @receive_buf: [DRV] ``void ()(struct tty_struct *tty, const u8 *cp, + * const char *fp, size_t count)`` * * This function is called by the low-level tty driver to send characters * received by the hardware to the line discpline for processing. @cp is @@ -191,8 +191,8 @@ int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass, * * Optional. * - * @receive_buf2: [DRV] ``ssize_t ()(struct tty_struct *tty, - * const unsigned char *cp, const char *fp, size_t count)`` + * @receive_buf2: [DRV] ``ssize_t ()(struct tty_struct *tty, const u8 *cp, + * const char *fp, size_t count)`` * * This function is called by the low-level tty driver to send characters * received by the hardware to the line discpline for processing. @cp is a @@ -204,8 +204,8 @@ int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass, * * Optional. * - * @lookahead_buf: [DRV] ``void ()(struct tty_struct *tty, - * const unsigned char *cp, const char *fp, size_t count)`` + * @lookahead_buf: [DRV] ``void ()(struct tty_struct *tty, const u8 *cp, + * const char *fp, size_t count)`` * * This function is called by the low-level tty driver for characters * not eaten by ->receive_buf() or ->receive_buf2(). It is useful for @@ -255,13 +255,13 @@ struct tty_ldisc_ops { /* * The following routines are called from below. */ - void (*receive_buf)(struct tty_struct *tty, const unsigned char *cp, + void (*receive_buf)(struct tty_struct *tty, const u8 *cp, const char *fp, size_t count); void (*write_wakeup)(struct tty_struct *tty); void (*dcd_change)(struct tty_struct *tty, bool active); - size_t (*receive_buf2)(struct tty_struct *tty, const unsigned char *cp, + size_t (*receive_buf2)(struct tty_struct *tty, const u8 *cp, const char *fp, size_t count); - void (*lookahead_buf)(struct tty_struct *tty, const unsigned char *cp, + void (*lookahead_buf)(struct tty_struct *tty, const u8 *cp, const unsigned char *fp, size_t count); struct module *owner; diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c index 42cc863cbd53..6d4938e3cbad 100644 --- a/sound/soc/codecs/cx20442.c +++ b/sound/soc/codecs/cx20442.c @@ -258,8 +258,8 @@ static void v253_hangup(struct tty_struct *tty) } /* Line discipline .receive_buf() */ -static void v253_receive(struct tty_struct *tty, const unsigned char *cp, - const char *fp, size_t count) +static void v253_receive(struct tty_struct *tty, const u8 *cp, const char *fp, + size_t count) { struct snd_soc_component *component = tty->disc_data; struct cx20442_priv *cx20442; diff --git a/sound/soc/ti/ams-delta.c b/sound/soc/ti/ams-delta.c index 1028b5efcfff..371943350fdf 100644 --- a/sound/soc/ti/ams-delta.c +++ b/sound/soc/ti/ams-delta.c @@ -336,7 +336,7 @@ static void cx81801_hangup(struct tty_struct *tty) } /* Line discipline .receive_buf() */ -static void cx81801_receive(struct tty_struct *tty, const unsigned char *cp, +static void cx81801_receive(struct tty_struct *tty, const u8 *cp, const char *fp, int count) { struct snd_soc_component *component = tty->disc_data; -- cgit v1.2.3 From 892bc209f250fb49ddca31c74d2c7b1126a7a61a Mon Sep 17 00:00:00 2001 From: "Jiri Slaby (SUSE)" Date: Thu, 10 Aug 2023 11:14:51 +0200 Subject: tty: use u8 for flags This makes all those 'char's an explicit 'u8'. This is part of the continuing unification of chars and flags to be consistent u8. This approaches tty_port_default_receive_buf(). Note that we do not change signedness as we compile with -funsigned-char. Signed-off-by: "Jiri Slaby (SUSE)" Cc: William Hubbs Cc: Chris Brannon Cc: Kirk Reiser Cc: Samuel Thibault Cc: Marcel Holtmann Cc: Johan Hedberg Cc: Luiz Augusto von Dentz Cc: Dmitry Torokhov Cc: Arnd Bergmann Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: Max Staudt Cc: Wolfgang Grandegger Cc: Marc Kleine-Budde Cc: Dario Binacchi Cc: Andreas Koensgen Cc: Jeremy Kerr Cc: Matt Johnston Cc: Krzysztof Kozlowski Cc: Liam Girdwood Cc: Mark Brown Cc: Jaroslav Kysela Cc: Takashi Iwai Acked-by: Mark Brown Link: https://lore.kernel.org/r/20230810091510.13006-18-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/accessibility/speakup/spk_ttyio.c | 2 +- drivers/bluetooth/hci_ldisc.c | 2 +- drivers/input/serio/serport.c | 2 +- drivers/misc/ti-st/st_core.c | 2 +- drivers/net/caif/caif_serial.c | 2 +- drivers/net/can/can327.c | 2 +- drivers/net/can/slcan/slcan-core.c | 2 +- drivers/net/hamradio/6pack.c | 2 +- drivers/net/hamradio/mkiss.c | 2 +- drivers/net/mctp/mctp-serial.c | 2 +- drivers/net/ppp/ppp_async.c | 7 +++---- drivers/net/ppp/ppp_synctty.c | 6 +++--- drivers/net/slip/slip.c | 4 ++-- drivers/tty/n_gsm.c | 2 +- drivers/tty/n_hdlc.c | 2 +- drivers/tty/n_tty.c | 28 ++++++++++++++-------------- drivers/tty/tty_buffer.c | 8 ++++---- drivers/tty/tty_port.c | 2 +- include/linux/tty_buffer.h | 4 ++-- include/linux/tty_flip.h | 10 +++++----- include/linux/tty_ldisc.h | 12 ++++++------ net/nfc/nci/uart.c | 2 +- sound/soc/codecs/cx20442.c | 2 +- 23 files changed, 54 insertions(+), 55 deletions(-) (limited to 'drivers/misc') diff --git a/drivers/accessibility/speakup/spk_ttyio.c b/drivers/accessibility/speakup/spk_ttyio.c index dd683a079c08..4c0a6e1f019d 100644 --- a/drivers/accessibility/speakup/spk_ttyio.c +++ b/drivers/accessibility/speakup/spk_ttyio.c @@ -72,7 +72,7 @@ static void spk_ttyio_ldisc_close(struct tty_struct *tty) } static size_t spk_ttyio_receive_buf2(struct tty_struct *tty, const u8 *cp, - const char *fp, size_t count) + const u8 *fp, size_t count) { struct spk_ldisc_data *ldisc_data = tty->disc_data; struct spk_synth *synth = ldisc_data->synth; diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 32bef61c5901..b41071282ce5 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c @@ -599,7 +599,7 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty) * Return Value: None */ static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data, - const char *flags, size_t count) + const u8 *flags, size_t count) { struct hci_uart *hu = tty->disc_data; diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c index 8bf79d39964d..5ce8d9f10f3e 100644 --- a/drivers/input/serio/serport.c +++ b/drivers/input/serio/serport.c @@ -115,7 +115,7 @@ static void serport_ldisc_close(struct tty_struct *tty) */ static void serport_ldisc_receive(struct tty_struct *tty, const u8 *cp, - const char *fp, size_t count) + const u8 *fp, size_t count) { struct serport *serport = tty->disc_data; unsigned long flags; diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index 0ce4e46ff161..4467c5b94ae8 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c @@ -792,7 +792,7 @@ static void st_tty_close(struct tty_struct *tty) } static void st_tty_receive(struct tty_struct *tty, const u8 *data, - const char *tty_flags, size_t count) + const u8 *tty_flags, size_t count) { #ifdef VERBOSE print_hex_dump(KERN_DEBUG, ">in>", DUMP_PREFIX_NONE, diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c index feda04dbe837..ed3a589def6b 100644 --- a/drivers/net/caif/caif_serial.c +++ b/drivers/net/caif/caif_serial.c @@ -159,7 +159,7 @@ static inline void debugfs_tx(struct ser_device *ser, const u8 *data, int size) #endif static void ldisc_receive(struct tty_struct *tty, const u8 *data, - const char *flags, size_t count) + const u8 *flags, size_t count) { struct sk_buff *skb = NULL; struct ser_device *ser; diff --git a/drivers/net/can/can327.c b/drivers/net/can/can327.c index a054f5fd0d43..24af63961030 100644 --- a/drivers/net/can/can327.c +++ b/drivers/net/can/can327.c @@ -886,7 +886,7 @@ static bool can327_is_valid_rx_char(u8 c) * functions may be called in parallel. */ static void can327_ldisc_rx(struct tty_struct *tty, const u8 *cp, - const char *fp, size_t count) + const u8 *fp, size_t count) { struct can327 *elm = tty->disc_data; size_t first_new_char_idx; diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c index fe5671dbeb77..24c6622d36bd 100644 --- a/drivers/net/can/slcan/slcan-core.c +++ b/drivers/net/can/slcan/slcan-core.c @@ -775,7 +775,7 @@ static const struct net_device_ops slcan_netdev_ops = { * in parallel */ static void slcan_receive_buf(struct tty_struct *tty, const u8 *cp, - const char *fp, size_t count) + const u8 *fp, size_t count) { struct slcan *sl = tty->disc_data; diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 9a1f2a3f3b4f..6ed38a3cdd73 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c @@ -428,7 +428,7 @@ out: * and sent on to some IP layer for further processing. */ static void sixpack_receive_buf(struct tty_struct *tty, const u8 *cp, - const char *fp, size_t count) + const u8 *fp, size_t count) { struct sixpack *sp; int count1; diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 26dbcf49bfa6..5f38a002bd9e 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c @@ -875,7 +875,7 @@ static int mkiss_ioctl(struct tty_struct *tty, unsigned int cmd, * and sent on to the AX.25 layer for further processing. */ static void mkiss_receive_buf(struct tty_struct *tty, const u8 *cp, - const char *fp, size_t count) + const u8 *fp, size_t count) { struct mkiss *ax = mkiss_get(tty); diff --git a/drivers/net/mctp/mctp-serial.c b/drivers/net/mctp/mctp-serial.c index 5f809a18d308..5bf6fdff701c 100644 --- a/drivers/net/mctp/mctp-serial.c +++ b/drivers/net/mctp/mctp-serial.c @@ -391,7 +391,7 @@ static void mctp_serial_push(struct mctp_serial *dev, unsigned char c) } static void mctp_serial_tty_receive_buf(struct tty_struct *tty, const u8 *c, - const char *f, size_t len) + const u8 *f, size_t len) { struct mctp_serial *dev = tty->disc_data; int i; diff --git a/drivers/net/ppp/ppp_async.c b/drivers/net/ppp/ppp_async.c index a661ccdea6ab..cfd5cb609d99 100644 --- a/drivers/net/ppp/ppp_async.c +++ b/drivers/net/ppp/ppp_async.c @@ -98,7 +98,7 @@ static int ppp_async_send(struct ppp_channel *chan, struct sk_buff *skb); static int ppp_async_push(struct asyncppp *ap); static void ppp_async_flush_output(struct asyncppp *ap); static void ppp_async_input(struct asyncppp *ap, const unsigned char *buf, - const char *flags, int count); + const u8 *flags, int count); static int ppp_async_ioctl(struct ppp_channel *chan, unsigned int cmd, unsigned long arg); static void ppp_async_process(struct tasklet_struct *t); @@ -330,7 +330,7 @@ ppp_asynctty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) /* May sleep, don't call from interrupt level or with interrupts disabled */ static void -ppp_asynctty_receive(struct tty_struct *tty, const u8 *buf, const char *cflags, +ppp_asynctty_receive(struct tty_struct *tty, const u8 *buf, const u8 *cflags, size_t count) { struct asyncppp *ap = ap_get(tty); @@ -819,8 +819,7 @@ process_input_packet(struct asyncppp *ap) other ldisc functions but will not be re-entered */ static void -ppp_async_input(struct asyncppp *ap, const u8 *buf, const char *flags, - int count) +ppp_async_input(struct asyncppp *ap, const u8 *buf, const u8 *flags, int count) { struct sk_buff *skb; int c, i, j, n, s, f; diff --git a/drivers/net/ppp/ppp_synctty.c b/drivers/net/ppp/ppp_synctty.c index 2a5cf6be9591..164c9053f73b 100644 --- a/drivers/net/ppp/ppp_synctty.c +++ b/drivers/net/ppp/ppp_synctty.c @@ -93,7 +93,7 @@ static int ppp_sync_ioctl(struct ppp_channel *chan, unsigned int cmd, static void ppp_sync_process(struct tasklet_struct *t); static int ppp_sync_push(struct syncppp *ap); static void ppp_sync_flush_output(struct syncppp *ap); -static void ppp_sync_input(struct syncppp *ap, const u8 *buf, const char *flags, +static void ppp_sync_input(struct syncppp *ap, const u8 *buf, const u8 *flags, int count); static const struct ppp_channel_ops sync_ops = { @@ -323,7 +323,7 @@ ppp_synctty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) /* May sleep, don't call from interrupt level or with interrupts disabled */ static void -ppp_sync_receive(struct tty_struct *tty, const u8 *buf, const char *cflags, +ppp_sync_receive(struct tty_struct *tty, const u8 *buf, const u8 *cflags, size_t count) { struct syncppp *ap = sp_get(tty); @@ -655,7 +655,7 @@ ppp_sync_flush_output(struct syncppp *ap) * frame is considered to be in error and is tossed. */ static void -ppp_sync_input(struct syncppp *ap, const u8 *buf, const char *flags, int count) +ppp_sync_input(struct syncppp *ap, const u8 *buf, const u8 *flags, int count) { struct sk_buff *skb; unsigned char *p; diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c index 7bfa90724e7b..e4280e37fec9 100644 --- a/drivers/net/slip/slip.c +++ b/drivers/net/slip/slip.c @@ -685,8 +685,8 @@ static void sl_setup(struct net_device *dev) * in parallel */ -static void slip_receive_buf(struct tty_struct *tty, const u8 *cp, - const char *fp, size_t count) +static void slip_receive_buf(struct tty_struct *tty, const u8 *cp, const u8 *fp, + size_t count) { struct slip *sl = tty->disc_data; diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 86d89bbbaa16..a3bd1fc52aed 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -3490,7 +3490,7 @@ static void gsmld_detach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) } static void gsmld_receive_buf(struct tty_struct *tty, const u8 *cp, - const char *fp, size_t count) + const u8 *fp, size_t count) { struct gsm_mux *gsm = tty->disc_data; char flags = TTY_NORMAL; diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c index c86be060baed..9be0932d07e0 100644 --- a/drivers/tty/n_hdlc.c +++ b/drivers/tty/n_hdlc.c @@ -370,7 +370,7 @@ static void n_hdlc_tty_wakeup(struct tty_struct *tty) * interpreted as one HDLC frame. */ static void n_hdlc_tty_receive(struct tty_struct *tty, const u8 *data, - const char *flags, size_t count) + const u8 *flags, size_t count) { register struct n_hdlc *n_hdlc = tty->disc_data; register struct n_hdlc_buf *buf; diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index d770007e5215..1053b2adb04c 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -1480,7 +1480,7 @@ n_tty_receive_char_lnext(struct tty_struct *tty, unsigned char c, char flag) /* Caller must ensure count > 0 */ static void n_tty_lookahead_flow_ctrl(struct tty_struct *tty, const u8 *cp, - const unsigned char *fp, size_t count) + const u8 *fp, size_t count) { struct n_tty_data *ldata = tty->disc_data; unsigned char flag = TTY_NORMAL; @@ -1520,11 +1520,11 @@ n_tty_receive_buf_real_raw(const struct tty_struct *tty, const u8 *cp, } static void -n_tty_receive_buf_raw(struct tty_struct *tty, const u8 *cp, - const char *fp, int count) +n_tty_receive_buf_raw(struct tty_struct *tty, const u8 *cp, const u8 *fp, + int count) { struct n_tty_data *ldata = tty->disc_data; - char flag = TTY_NORMAL; + u8 flag = TTY_NORMAL; while (count--) { if (fp) @@ -1537,8 +1537,8 @@ n_tty_receive_buf_raw(struct tty_struct *tty, const u8 *cp, } static void -n_tty_receive_buf_closing(struct tty_struct *tty, const u8 *cp, - const char *fp, int count, bool lookahead_done) +n_tty_receive_buf_closing(struct tty_struct *tty, const u8 *cp, const u8 *fp, + int count, bool lookahead_done) { char flag = TTY_NORMAL; @@ -1551,11 +1551,11 @@ n_tty_receive_buf_closing(struct tty_struct *tty, const u8 *cp, } static void n_tty_receive_buf_standard(struct tty_struct *tty, const u8 *cp, - const char *fp, int count, + const u8 *fp, int count, bool lookahead_done) { struct n_tty_data *ldata = tty->disc_data; - char flag = TTY_NORMAL; + u8 flag = TTY_NORMAL; while (count--) { u8 c = *cp++; @@ -1589,8 +1589,8 @@ static void n_tty_receive_buf_standard(struct tty_struct *tty, const u8 *cp, } } -static void __receive_buf(struct tty_struct *tty, const u8 *cp, - const char *fp, int count) +static void __receive_buf(struct tty_struct *tty, const u8 *cp, const u8 *fp, + int count) { struct n_tty_data *ldata = tty->disc_data; bool preops = I_ISTRIP(tty) || (I_IUCLC(tty) && L_IEXTEN(tty)); @@ -1664,8 +1664,8 @@ static void __receive_buf(struct tty_struct *tty, const u8 *cp, * publishes commit_head or canon_head */ static size_t -n_tty_receive_buf_common(struct tty_struct *tty, const u8 *cp, - const char *fp, int count, int flow) +n_tty_receive_buf_common(struct tty_struct *tty, const u8 *cp, const u8 *fp, + int count, int flow) { struct n_tty_data *ldata = tty->disc_data; size_t rcvd = 0; @@ -1746,13 +1746,13 @@ n_tty_receive_buf_common(struct tty_struct *tty, const u8 *cp, } static void n_tty_receive_buf(struct tty_struct *tty, const u8 *cp, - const char *fp, size_t count) + const u8 *fp, size_t count) { n_tty_receive_buf_common(tty, cp, fp, count, 0); } static size_t n_tty_receive_buf2(struct tty_struct *tty, const u8 *cp, - const char *fp, size_t count) + const u8 *fp, size_t count) { return n_tty_receive_buf_common(tty, cp, fp, count, 1); } diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 9db42e6ed45b..684d099cbe11 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -317,7 +317,7 @@ EXPORT_SYMBOL_GPL(tty_buffer_request_room); * Returns: the number added. */ int tty_insert_flip_string_fixed_flag(struct tty_port *port, const u8 *chars, - char flag, size_t size) + u8 flag, size_t size) { int copied = 0; bool flags = flag != TTY_NORMAL; @@ -356,7 +356,7 @@ EXPORT_SYMBOL(tty_insert_flip_string_fixed_flag); * Returns: the number added. */ int tty_insert_flip_string_flags(struct tty_port *port, const u8 *chars, - const char *flags, size_t size) + const u8 *flags, size_t size) { int copied = 0; @@ -390,7 +390,7 @@ EXPORT_SYMBOL(tty_insert_flip_string_flags); * Queue a single byte @ch to the tty buffering, with an optional flag. This is * the slow path of tty_insert_flip_char(). */ -int __tty_insert_flip_char(struct tty_port *port, u8 ch, char flag) +int __tty_insert_flip_char(struct tty_port *port, u8 ch, u8 flag) { struct tty_buffer *tb; bool flags = flag != TTY_NORMAL; @@ -449,7 +449,7 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string); * * Returns: the number of bytes processed. */ -size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const u8 *p, const char *f, +size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const u8 *p, const u8 *f, size_t count) { if (ld->ops->receive_buf2) diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index 7fd171b7c844..624d104bd145 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c @@ -34,7 +34,7 @@ static size_t tty_port_default_receive_buf(struct tty_port *port, const u8 *p, if (!ld) return 0; - count = tty_ldisc_receive_buf(ld, p, (char *)f, count); + count = tty_ldisc_receive_buf(ld, p, f, count); tty_ldisc_deref(ld); diff --git a/include/linux/tty_buffer.h b/include/linux/tty_buffer.h index 6f2966b15093..b11cc8c749d2 100644 --- a/include/linux/tty_buffer.h +++ b/include/linux/tty_buffer.h @@ -27,9 +27,9 @@ static inline u8 *char_buf_ptr(struct tty_buffer *b, int ofs) return ((u8 *)b->data) + ofs; } -static inline char *flag_buf_ptr(struct tty_buffer *b, int ofs) +static inline u8 *flag_buf_ptr(struct tty_buffer *b, int ofs) { - return (char *)char_buf_ptr(b, ofs) + b->size; + return char_buf_ptr(b, ofs) + b->size; } struct tty_bufhead { diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h index a0fcffeaaa25..d33aed2172c7 100644 --- a/include/linux/tty_flip.h +++ b/include/linux/tty_flip.h @@ -11,14 +11,14 @@ int tty_buffer_set_limit(struct tty_port *port, int limit); unsigned int tty_buffer_space_avail(struct tty_port *port); int tty_buffer_request_room(struct tty_port *port, size_t size); int tty_insert_flip_string_flags(struct tty_port *port, const u8 *chars, - const char *flags, size_t size); + const u8 *flags, size_t size); int tty_insert_flip_string_fixed_flag(struct tty_port *port, const u8 *chars, - char flag, size_t size); + u8 flag, size_t size); int tty_prepare_flip_string(struct tty_port *port, u8 **chars, size_t size); void tty_flip_buffer_push(struct tty_port *port); -int __tty_insert_flip_char(struct tty_port *port, u8 ch, char flag); +int __tty_insert_flip_char(struct tty_port *port, u8 ch, u8 flag); -static inline int tty_insert_flip_char(struct tty_port *port, u8 ch, char flag) +static inline int tty_insert_flip_char(struct tty_port *port, u8 ch, u8 flag) { struct tty_buffer *tb = port->buf.tail; int change; @@ -39,7 +39,7 @@ static inline int tty_insert_flip_string(struct tty_port *port, return tty_insert_flip_string_fixed_flag(port, chars, TTY_NORMAL, size); } -size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const u8 *p, const char *f, +size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const u8 *p, const u8 *f, size_t count); void tty_buffer_lock_exclusive(struct tty_port *port); diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h index 5551c4400e59..a661d7df5497 100644 --- a/include/linux/tty_ldisc.h +++ b/include/linux/tty_ldisc.h @@ -162,7 +162,7 @@ int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass, * Optional. Can sleep. * * @receive_buf: [DRV] ``void ()(struct tty_struct *tty, const u8 *cp, - * const char *fp, size_t count)`` + * const u8 *fp, size_t count)`` * * This function is called by the low-level tty driver to send characters * received by the hardware to the line discpline for processing. @cp is @@ -192,7 +192,7 @@ int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass, * Optional. * * @receive_buf2: [DRV] ``ssize_t ()(struct tty_struct *tty, const u8 *cp, - * const char *fp, size_t count)`` + * const u8 *fp, size_t count)`` * * This function is called by the low-level tty driver to send characters * received by the hardware to the line discpline for processing. @cp is a @@ -205,7 +205,7 @@ int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass, * Optional. * * @lookahead_buf: [DRV] ``void ()(struct tty_struct *tty, const u8 *cp, - * const char *fp, size_t count)`` + * const u8 *fp, size_t count)`` * * This function is called by the low-level tty driver for characters * not eaten by ->receive_buf() or ->receive_buf2(). It is useful for @@ -256,13 +256,13 @@ struct tty_ldisc_ops { * The following routines are called from below. */ void (*receive_buf)(struct tty_struct *tty, const u8 *cp, - const char *fp, size_t count); + const u8 *fp, size_t count); void (*write_wakeup)(struct tty_struct *tty); void (*dcd_change)(struct tty_struct *tty, bool active); size_t (*receive_buf2)(struct tty_struct *tty, const u8 *cp, - const char *fp, size_t count); + const u8 *fp, size_t count); void (*lookahead_buf)(struct tty_struct *tty, const u8 *cp, - const unsigned char *fp, size_t count); + const u8 *fp, size_t count); struct module *owner; }; diff --git a/net/nfc/nci/uart.c b/net/nfc/nci/uart.c index c957ca6d2f87..93775c540287 100644 --- a/net/nfc/nci/uart.c +++ b/net/nfc/nci/uart.c @@ -296,7 +296,7 @@ static int nci_uart_default_recv_buf(struct nci_uart *nu, const u8 *data, * Return Value: None */ static void nci_uart_tty_receive(struct tty_struct *tty, const u8 *data, - const char *flags, size_t count) + const u8 *flags, size_t count) { struct nci_uart *nu = tty->disc_data; diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c index 6d4938e3cbad..9d54141a0cd1 100644 --- a/sound/soc/codecs/cx20442.c +++ b/sound/soc/codecs/cx20442.c @@ -258,7 +258,7 @@ static void v253_hangup(struct tty_struct *tty) } /* Line discipline .receive_buf() */ -static void v253_receive(struct tty_struct *tty, const u8 *cp, const char *fp, +static void v253_receive(struct tty_struct *tty, const u8 *cp, const u8 *fp, size_t count) { struct snd_soc_component *component = tty->disc_data; -- cgit v1.2.3 From ead03e721f410d83825835b5abd8e84fcb4305fa Mon Sep 17 00:00:00 2001 From: "Jiri Slaby (SUSE)" Date: Thu, 10 Aug 2023 11:14:52 +0200 Subject: misc: ti-st: make st_recv() conforming to tty_ldisc_ops::receive_buf() That is change data type to u8 and count to unsigned int. And propagate to both hooks (st_kim_recv() and kim_int_recv()). Signed-off-by: "Jiri Slaby (SUSE)" Cc: Arnd Bergmann Link: https://lore.kernel.org/r/20230810091510.13006-19-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/misc/ti-st/st_core.c | 7 +++---- drivers/misc/ti-st/st_kim.c | 6 +++--- include/linux/ti_wilink_st.h | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'drivers/misc') diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index 4467c5b94ae8..c1a134bd8ba7 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c @@ -21,7 +21,7 @@ * st_kim_recv during registration to receive fw download responses * st_int_recv after registration to receive proto stack responses */ -static void (*st_recv) (void *, const unsigned char *, long); +static void (*st_recv)(void *disc_data, const u8 *ptr, size_t count); /********************************************************************/ static void add_channel_to_table(struct st_data_s *st_gdata, @@ -223,8 +223,7 @@ static inline void st_wakeup_ack(struct st_data_s *st_gdata, * HCI-Events, ACL, SCO, 4 types of HCI-LL PM packets * CH-8 packets from FM, CH-9 packets from GPS cores. */ -static void st_int_recv(void *disc_data, - const unsigned char *ptr, long count) +static void st_int_recv(void *disc_data, const u8 *ptr, size_t count) { struct st_proto_s *proto; unsigned short payload_len = 0; @@ -239,7 +238,7 @@ static void st_int_recv(void *disc_data, return; } - pr_debug("count %ld rx_state %ld" + pr_debug("count %zu rx_state %ld" "rx_count %ld", count, st_gdata->rx_state, st_gdata->rx_count); diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index 5431a89924aa..fe682e0553b2 100644 --- a/drivers/misc/ti-st/st_kim.c +++ b/drivers/misc/ti-st/st_kim.c @@ -127,8 +127,8 @@ static inline int kim_check_data_len(struct kim_data_s *kim_gdata, int len) * have been observed to come in bursts of different * tty_receive and hence the logic */ -static void kim_int_recv(struct kim_data_s *kim_gdata, - const unsigned char *ptr, long count) +static void kim_int_recv(struct kim_data_s *kim_gdata, const u8 *ptr, + size_t count) { int len = 0; unsigned char *plen; @@ -417,7 +417,7 @@ static long download_firmware(struct kim_data_s *kim_gdata) * 1. response to read local version * 2. during send/recv's of firmware download */ -void st_kim_recv(void *disc_data, const unsigned char *data, long count) +void st_kim_recv(void *disc_data, const u8 *data, size_t count) { struct st_data_s *st_gdata = (struct st_data_s *)disc_data; struct kim_data_s *kim_gdata = st_gdata->kim_data; diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h index 44a7f9169ac6..10642d4844f0 100644 --- a/include/linux/ti_wilink_st.h +++ b/include/linux/ti_wilink_st.h @@ -271,7 +271,7 @@ long st_kim_stop(void *); void st_kim_complete(void *); void kim_st_list_protocols(struct st_data_s *, void *); -void st_kim_recv(void *, const unsigned char *, long); +void st_kim_recv(void *disc_data, const u8 *data, size_t count); /* -- cgit v1.2.3 From 69851e4ab8feeb369119a44ddca430c0ee15f0d8 Mon Sep 17 00:00:00 2001 From: "Jiri Slaby (SUSE)" Date: Thu, 10 Aug 2023 11:15:01 +0200 Subject: tty: propagate u8 data to tty_operations::write() Data are now typed as u8. Propagate this change to tty_operations::write(). Signed-off-by: "Jiri Slaby (SUSE)" Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: Matt Turner Cc: Geert Uytterhoeven Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Cc: Chris Zankel Cc: Max Filippov Cc: Arnd Bergmann Cc: Vaibhav Gupta Cc: Jens Taprogge Cc: Karsten Keil Cc: Scott Branden Cc: Ulf Hansson Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Alexander Gordeev Cc: Christian Borntraeger Cc: Sven Schnelle Cc: David Lin Cc: Johan Hovold Cc: Alex Elder Cc: Laurentiu Tudor Cc: Jiri Kosina Cc: David Sterba Cc: Shawn Guo Cc: Sascha Hauer Cc: Pengutronix Kernel Team Cc: Fabio Estevam Cc: NXP Linux Team Cc: Arnaud Pouliquen Cc: Oliver Neukum Cc: Mathias Nyman Cc: Marcel Holtmann Cc: Johan Hedberg Cc: Luiz Augusto von Dentz Link: https://lore.kernel.org/r/20230810091510.13006-28-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman --- arch/alpha/kernel/srmcons.c | 3 +-- arch/m68k/emu/nfcon.c | 3 +-- arch/um/drivers/line.c | 2 +- arch/um/drivers/line.h | 3 +-- arch/xtensa/platforms/iss/console.c | 3 +-- drivers/char/ttyprintk.c | 5 ++--- drivers/ipack/devices/ipoctal.c | 6 ++---- drivers/isdn/capi/capi.c | 3 +-- drivers/misc/bcm-vk/bcm_vk_tty.c | 4 +--- drivers/mmc/core/sdio_uart.c | 3 +-- drivers/net/usb/hso.c | 3 +-- drivers/s390/char/con3215.c | 3 +-- drivers/s390/char/con3270.c | 3 +-- drivers/s390/char/sclp_tty.c | 2 +- drivers/s390/char/sclp_vt220.c | 2 +- drivers/staging/gdm724x/gdm_tty.c | 3 +-- drivers/staging/greybus/uart.c | 3 +-- drivers/tty/amiserial.c | 2 +- drivers/tty/ehv_bytechan.c | 3 +-- drivers/tty/goldfish.c | 6 ++---- drivers/tty/hvc/hvc_console.c | 2 +- drivers/tty/hvc/hvcs.c | 3 +-- drivers/tty/hvc/hvsi.c | 3 +-- drivers/tty/ipwireless/hardware.c | 2 +- drivers/tty/ipwireless/tty.c | 3 +-- drivers/tty/mips_ejtag_fdc.c | 4 ++-- drivers/tty/moxa.c | 8 +++----- drivers/tty/mxser.c | 2 +- drivers/tty/n_gsm.c | 3 +-- drivers/tty/nozomi.c | 5 ++--- drivers/tty/pty.c | 2 +- drivers/tty/serial/kgdb_nmi.c | 2 +- drivers/tty/serial/serial_core.c | 3 +-- drivers/tty/synclink_gt.c | 7 +++---- drivers/tty/ttynull.c | 3 +-- drivers/tty/vcc.c | 3 +-- drivers/tty/vt/vt.c | 4 ++-- drivers/usb/class/cdc-acm.c | 3 +-- drivers/usb/gadget/function/u_serial.c | 2 +- drivers/usb/host/xhci-dbgtty.c | 4 +--- drivers/usb/serial/usb-serial.c | 3 +-- include/linux/tty_driver.h | 3 +-- net/bluetooth/rfcomm/tty.c | 2 +- 43 files changed, 53 insertions(+), 88 deletions(-) (limited to 'drivers/misc') diff --git a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c index 6dc952b0df4a..dea39008d93e 100644 --- a/arch/alpha/kernel/srmcons.c +++ b/arch/alpha/kernel/srmcons.c @@ -130,8 +130,7 @@ srmcons_do_write(struct tty_port *port, const char *buf, int count) } static int -srmcons_write(struct tty_struct *tty, - const unsigned char *buf, int count) +srmcons_write(struct tty_struct *tty, const u8 *buf, int count) { unsigned long flags; diff --git a/arch/m68k/emu/nfcon.c b/arch/m68k/emu/nfcon.c index 6fdc13610565..e7a21234b481 100644 --- a/arch/m68k/emu/nfcon.c +++ b/arch/m68k/emu/nfcon.c @@ -70,8 +70,7 @@ static void nfcon_tty_close(struct tty_struct *tty, struct file *filp) { } -static int nfcon_tty_write(struct tty_struct *tty, const unsigned char *buf, - int count) +static int nfcon_tty_write(struct tty_struct *tty, const u8 *buf, int count) { nfputs(buf, count); return count; diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index 02b0befd6763..e5393b4ba9f8 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c @@ -184,7 +184,7 @@ void line_flush_chars(struct tty_struct *tty) line_flush_buffer(tty); } -int line_write(struct tty_struct *tty, const unsigned char *buf, int len) +int line_write(struct tty_struct *tty, const u8 *buf, int len) { struct line *line = tty->driver_data; unsigned long flags; diff --git a/arch/um/drivers/line.h b/arch/um/drivers/line.h index f15be75a3bf3..8354024b6b35 100644 --- a/arch/um/drivers/line.h +++ b/arch/um/drivers/line.h @@ -64,8 +64,7 @@ extern void line_cleanup(struct tty_struct *tty); extern void line_hangup(struct tty_struct *tty); extern int line_setup(char **conf, unsigned nlines, char **def, char *init, char *name); -extern int line_write(struct tty_struct *tty, const unsigned char *buf, - int len); +extern int line_write(struct tty_struct *tty, const u8 *buf, int len); extern unsigned int line_chars_in_buffer(struct tty_struct *tty); extern void line_flush_buffer(struct tty_struct *tty); extern void line_flush_chars(struct tty_struct *tty); diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c index b40b73809dd8..182ec57e2d5c 100644 --- a/arch/xtensa/platforms/iss/console.c +++ b/arch/xtensa/platforms/iss/console.c @@ -52,8 +52,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp) } -static int rs_write(struct tty_struct * tty, - const unsigned char *buf, int count) +static int rs_write(struct tty_struct * tty, const u8 *buf, int count) { /* see drivers/char/serialX.c to reference original version */ diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c index ed45d04905c2..4f3dd93f1fd8 100644 --- a/drivers/char/ttyprintk.c +++ b/drivers/char/ttyprintk.c @@ -51,7 +51,7 @@ static void tpk_flush(void) } } -static int tpk_printk(const unsigned char *buf, int count) +static int tpk_printk(const u8 *buf, int count) { int i; @@ -103,8 +103,7 @@ static void tpk_close(struct tty_struct *tty, struct file *filp) /* * TTY operations write function. */ -static int tpk_write(struct tty_struct *tty, - const unsigned char *buf, int count) +static int tpk_write(struct tty_struct *tty, const u8 *buf, int count) { struct ttyprintk_port *tpkp = tty->driver_data; unsigned long flags; diff --git a/drivers/ipack/devices/ipoctal.c b/drivers/ipack/devices/ipoctal.c index a01c15812b70..c3cf086e7e36 100644 --- a/drivers/ipack/devices/ipoctal.c +++ b/drivers/ipack/devices/ipoctal.c @@ -437,8 +437,7 @@ err_put_driver: } static inline int ipoctal_copy_write_buffer(struct ipoctal_channel *channel, - const unsigned char *buf, - int count) + const u8 *buf, int count) { unsigned long flags; int i; @@ -459,8 +458,7 @@ static inline int ipoctal_copy_write_buffer(struct ipoctal_channel *channel, return i; } -static int ipoctal_write_tty(struct tty_struct *tty, - const unsigned char *buf, int count) +static int ipoctal_write_tty(struct tty_struct *tty, const u8 *buf, int count) { struct ipoctal_channel *channel = tty->driver_data; unsigned int char_copied; diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 45a4043c5042..cf6daf79c1a2 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -1077,8 +1077,7 @@ static void capinc_tty_close(struct tty_struct *tty, struct file *filp) tty_port_close(&mp->port, tty, filp); } -static int capinc_tty_write(struct tty_struct *tty, - const unsigned char *buf, int count) +static int capinc_tty_write(struct tty_struct *tty, const u8 *buf, int count) { struct capiminor *mp = tty->driver_data; struct sk_buff *skb; diff --git a/drivers/misc/bcm-vk/bcm_vk_tty.c b/drivers/misc/bcm-vk/bcm_vk_tty.c index 6669625ba4c8..44851b607cce 100644 --- a/drivers/misc/bcm-vk/bcm_vk_tty.c +++ b/drivers/misc/bcm-vk/bcm_vk_tty.c @@ -186,9 +186,7 @@ static void bcm_vk_tty_doorbell(struct bcm_vk *vk, u32 db_val) VK_BAR0_REGSEG_DB_BASE + VK_BAR0_REGSEG_TTY_DB_OFFSET); } -static int bcm_vk_tty_write(struct tty_struct *tty, - const unsigned char *buffer, - int count) +static int bcm_vk_tty_write(struct tty_struct *tty, const u8 *buffer, int count) { int index; struct bcm_vk *vk; diff --git a/drivers/mmc/core/sdio_uart.c b/drivers/mmc/core/sdio_uart.c index aa659758563f..90d2fe00c0b9 100644 --- a/drivers/mmc/core/sdio_uart.c +++ b/drivers/mmc/core/sdio_uart.c @@ -760,8 +760,7 @@ static void sdio_uart_hangup(struct tty_struct *tty) tty_port_hangup(&port->port); } -static int sdio_uart_write(struct tty_struct *tty, const unsigned char *buf, - int count) +static int sdio_uart_write(struct tty_struct *tty, const u8 *buf, int count) { struct sdio_uart_port *port = tty->driver_data; int ret; diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index ce1f6081d582..014a9d29bab5 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c @@ -1322,8 +1322,7 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp) } /* close the requested serial port */ -static int hso_serial_write(struct tty_struct *tty, const unsigned char *buf, - int count) +static int hso_serial_write(struct tty_struct *tty, const u8 *buf, int count) { struct hso_serial *serial = tty->driver_data; int space, tx_bytes; diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c index a1fef666c9b0..16b6f430dfd3 100644 --- a/drivers/s390/char/con3215.c +++ b/drivers/s390/char/con3215.c @@ -1021,8 +1021,7 @@ static unsigned int tty3215_write_room(struct tty_struct *tty) /* * String write routine for 3215 ttys */ -static int tty3215_write(struct tty_struct *tty, - const unsigned char *buf, int count) +static int tty3215_write(struct tty_struct *tty, const u8 *buf, int count) { handle_write(tty->driver_data, buf, count); return count; diff --git a/drivers/s390/char/con3270.c b/drivers/s390/char/con3270.c index d9983550062d..123524bff734 100644 --- a/drivers/s390/char/con3270.c +++ b/drivers/s390/char/con3270.c @@ -1803,8 +1803,7 @@ static void tty3270_do_write(struct tty3270 *tp, struct tty_struct *tty, /* * String write routine for 3270 ttys */ -static int tty3270_write(struct tty_struct *tty, - const unsigned char *buf, int count) +static int tty3270_write(struct tty_struct *tty, const u8 *buf, int count) { struct tty3270 *tp; diff --git a/drivers/s390/char/sclp_tty.c b/drivers/s390/char/sclp_tty.c index 971fbb52740b..cc0f6a97124e 100644 --- a/drivers/s390/char/sclp_tty.c +++ b/drivers/s390/char/sclp_tty.c @@ -230,7 +230,7 @@ out: * routine will return the number of characters actually accepted for writing. */ static int -sclp_tty_write(struct tty_struct *tty, const unsigned char *buf, int count) +sclp_tty_write(struct tty_struct *tty, const u8 *buf, int count) { if (sclp_tty_chars_count > 0) { sclp_tty_write_string(sclp_tty_chars, sclp_tty_chars_count, 0); diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c index a32f34a1c6d2..44974d801c1e 100644 --- a/drivers/s390/char/sclp_vt220.c +++ b/drivers/s390/char/sclp_vt220.c @@ -463,7 +463,7 @@ out: * number of characters actually accepted for writing. */ static int -sclp_vt220_write(struct tty_struct *tty, const unsigned char *buf, int count) +sclp_vt220_write(struct tty_struct *tty, const u8 *buf, int count) { return __sclp_vt220_write(buf, count, 1, 0, 1); } diff --git a/drivers/staging/gdm724x/gdm_tty.c b/drivers/staging/gdm724x/gdm_tty.c index e1a84d6020f4..ae9978b73d9b 100644 --- a/drivers/staging/gdm724x/gdm_tty.c +++ b/drivers/staging/gdm724x/gdm_tty.c @@ -149,8 +149,7 @@ static void gdm_tty_send_complete(void *arg) tty_port_tty_wakeup(&gdm->port); } -static int gdm_tty_write(struct tty_struct *tty, const unsigned char *buf, - int len) +static int gdm_tty_write(struct tty_struct *tty, const u8 *buf, int len) { struct gdm *gdm = tty->driver_data; int remain = len; diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c index 20a34599859f..97c7ddd0f53e 100644 --- a/drivers/staging/greybus/uart.c +++ b/drivers/staging/greybus/uart.c @@ -427,8 +427,7 @@ static void gb_tty_hangup(struct tty_struct *tty) tty_port_hangup(&gb_tty->port); } -static int gb_tty_write(struct tty_struct *tty, const unsigned char *buf, - int count) +static int gb_tty_write(struct tty_struct *tty, const u8 *buf, int count) { struct gb_tty *gb_tty = tty->driver_data; diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index c06ad0a0744b..1dd8b86f4a32 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c @@ -741,7 +741,7 @@ static void rs_flush_chars(struct tty_struct *tty) local_irq_restore(flags); } -static int rs_write(struct tty_struct * tty, const unsigned char *buf, int count) +static int rs_write(struct tty_struct * tty, const u8 *buf, int count) { int c, ret = 0; struct serial_state *info = tty->driver_data; diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c index 8595483f4697..de36347e2145 100644 --- a/drivers/tty/ehv_bytechan.c +++ b/drivers/tty/ehv_bytechan.c @@ -466,8 +466,7 @@ static irqreturn_t ehv_bc_tty_tx_isr(int irq, void *data) * ehv_bc_tty_write_room() will never lie, so the tty layer will never send us * too much data. */ -static int ehv_bc_tty_write(struct tty_struct *ttys, const unsigned char *s, - int count) +static int ehv_bc_tty_write(struct tty_struct *ttys, const u8 *s, int count) { struct ehv_bc_data *bc = ttys->driver_data; unsigned long flags; diff --git a/drivers/tty/goldfish.c b/drivers/tty/goldfish.c index d02de3f0326f..faa597ffbaf9 100644 --- a/drivers/tty/goldfish.c +++ b/drivers/tty/goldfish.c @@ -125,8 +125,7 @@ static void goldfish_tty_rw(struct goldfish_tty *qtty, } } -static void goldfish_tty_do_write(int line, const char *buf, - unsigned int count) +static void goldfish_tty_do_write(int line, const u8 *buf, unsigned int count) { struct goldfish_tty *qtty = &goldfish_ttys[line]; unsigned long address = (unsigned long)(void *)buf; @@ -186,8 +185,7 @@ static void goldfish_tty_hangup(struct tty_struct *tty) tty_port_hangup(tty->port); } -static int goldfish_tty_write(struct tty_struct *tty, const unsigned char *buf, - int count) +static int goldfish_tty_write(struct tty_struct *tty, const u8 *buf, int count) { goldfish_tty_do_write(tty->index, buf, count); return count; diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c index 10c10cfdf92a..4c60d15c7a6f 100644 --- a/drivers/tty/hvc/hvc_console.c +++ b/drivers/tty/hvc/hvc_console.c @@ -496,7 +496,7 @@ static int hvc_push(struct hvc_struct *hp) return n; } -static int hvc_write(struct tty_struct *tty, const unsigned char *buf, int count) +static int hvc_write(struct tty_struct *tty, const u8 *buf, int count) { struct hvc_struct *hp = tty->driver_data; unsigned long flags; diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c index 1de1a09bf82d..2465d61b4e76 100644 --- a/drivers/tty/hvc/hvcs.c +++ b/drivers/tty/hvc/hvcs.c @@ -1257,8 +1257,7 @@ static void hvcs_hangup(struct tty_struct * tty) * tty_hangup will allow hvcs_write time to complete execution before it * terminates our device. */ -static int hvcs_write(struct tty_struct *tty, - const unsigned char *buf, int count) +static int hvcs_write(struct tty_struct *tty, const u8 *buf, int count) { struct hvcs_struct *hvcsd = tty->driver_data; unsigned int unit_address; diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c index c1b8a4fd8b1e..46dd62df2442 100644 --- a/drivers/tty/hvc/hvsi.c +++ b/drivers/tty/hvc/hvsi.c @@ -904,8 +904,7 @@ static unsigned int hvsi_chars_in_buffer(struct tty_struct *tty) return hp->n_outbuf; } -static int hvsi_write(struct tty_struct *tty, - const unsigned char *source, int count) +static int hvsi_write(struct tty_struct *tty, const u8 *source, int count) { struct hvsi_struct *hp = tty->driver_data; unsigned long flags; diff --git a/drivers/tty/ipwireless/hardware.c b/drivers/tty/ipwireless/hardware.c index f5d3e68f5750..001ec318a918 100644 --- a/drivers/tty/ipwireless/hardware.c +++ b/drivers/tty/ipwireless/hardware.c @@ -1292,7 +1292,7 @@ static void *alloc_ctrl_packet(int header_size, } int ipwireless_send_packet(struct ipw_hardware *hw, unsigned int channel_idx, - const unsigned char *data, unsigned int length, + const u8 *data, unsigned int length, void (*callback) (void *cb, unsigned int length), void *callback_data) { diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c index 9edd5ae17580..cd43208c523c 100644 --- a/drivers/tty/ipwireless/tty.c +++ b/drivers/tty/ipwireless/tty.c @@ -186,8 +186,7 @@ static void ipw_write_packet_sent_callback(void *callback_data, tty->tx_bytes_queued -= packet_length; } -static int ipw_write(struct tty_struct *linux_tty, - const unsigned char *buf, int count) +static int ipw_write(struct tty_struct *linux_tty, const u8 *buf, int count) { struct ipw_tty *tty = linux_tty->driver_data; int room, ret; diff --git a/drivers/tty/mips_ejtag_fdc.c b/drivers/tty/mips_ejtag_fdc.c index e81701a66429..cf4ef0c38624 100644 --- a/drivers/tty/mips_ejtag_fdc.c +++ b/drivers/tty/mips_ejtag_fdc.c @@ -796,8 +796,8 @@ static void mips_ejtag_fdc_tty_hangup(struct tty_struct *tty) tty_port_hangup(tty->port); } -static int mips_ejtag_fdc_tty_write(struct tty_struct *tty, - const unsigned char *buf, int total) +static int mips_ejtag_fdc_tty_write(struct tty_struct *tty, const u8 *buf, + int total) { int count, block; struct mips_ejtag_fdc_tty_port *dport = tty->driver_data; diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c index 42fa4c878b2e..d94cf1be651b 100644 --- a/drivers/tty/moxa.c +++ b/drivers/tty/moxa.c @@ -487,7 +487,7 @@ module_param(ttymajor, int, 0); */ static int moxa_open(struct tty_struct *, struct file *); static void moxa_close(struct tty_struct *, struct file *); -static int moxa_write(struct tty_struct *, const unsigned char *, int); +static int moxa_write(struct tty_struct *, const u8 *, int); static unsigned int moxa_write_room(struct tty_struct *); static void moxa_flush_buffer(struct tty_struct *); static unsigned int moxa_chars_in_buffer(struct tty_struct *); @@ -1499,8 +1499,7 @@ static void moxa_close(struct tty_struct *tty, struct file *filp) tty_port_close(&ch->port, tty, filp); } -static int moxa_write(struct tty_struct *tty, - const unsigned char *buf, int count) +static int moxa_write(struct tty_struct *tty, const u8 *buf, int count) { struct moxa_port *ch = tty->driver_data; unsigned long flags; @@ -2164,8 +2163,7 @@ static int MoxaPortLineStatus(struct moxa_port *port) return val; } -static int MoxaPortWriteData(struct tty_struct *tty, - const unsigned char *buffer, int len) +static int MoxaPortWriteData(struct tty_struct *tty, const u8 *buffer, int len) { struct moxa_port *port = tty->driver_data; void __iomem *baseAddr, *ofsAddr, *ofs; diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 10855e66fda1..8b4b8493fed5 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -901,7 +901,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) tty_port_close(tty->port, tty, filp); } -static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int count) +static int mxser_write(struct tty_struct *tty, const u8 *buf, int count) { struct mxser_port *info = tty->driver_data; unsigned long flags; diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index a3bd1fc52aed..d167e36873fe 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -4256,8 +4256,7 @@ static void gsmtty_hangup(struct tty_struct *tty) gsm_dlci_begin_close(dlci); } -static int gsmtty_write(struct tty_struct *tty, const unsigned char *buf, - int len) +static int gsmtty_write(struct tty_struct *tty, const u8 *buf, int len) { int sent; struct gsm_dlci *dlci = tty->driver_data; diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c index 0454c78deee6..b3756402f5d9 100644 --- a/drivers/tty/nozomi.c +++ b/drivers/tty/nozomi.c @@ -1599,8 +1599,7 @@ static void ntty_hangup(struct tty_struct *tty) * called when the userspace process writes to the tty (/dev/noz*). * Data is inserted into a fifo, which is then read and transferred to the modem. */ -static int ntty_write(struct tty_struct *tty, const unsigned char *buffer, - int count) +static int ntty_write(struct tty_struct *tty, const u8 *buffer, int count) { int rval = -EINVAL; struct nozomi *dc = get_dc_by_tty(tty); @@ -1610,7 +1609,7 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer, if (!dc || !port) return -ENODEV; - rval = kfifo_in(&port->fifo_ul, (unsigned char *)buffer, count); + rval = kfifo_in(&port->fifo_ul, buffer, count); spin_lock_irqsave(&dc->spin_mutex, flags); /* CTS is only valid on the modem channel */ diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 2b1c8ab99dba..335f5744f320 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -108,7 +108,7 @@ static void pty_unthrottle(struct tty_struct *tty) * the other side of the pty/tty pair. */ -static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c) +static int pty_write(struct tty_struct *tty, const u8 *buf, int c) { struct tty_struct *to = tty->link; diff --git a/drivers/tty/serial/kgdb_nmi.c b/drivers/tty/serial/kgdb_nmi.c index 55c3c9db7462..2a04d19d5ec0 100644 --- a/drivers/tty/serial/kgdb_nmi.c +++ b/drivers/tty/serial/kgdb_nmi.c @@ -304,7 +304,7 @@ static unsigned int kgdb_nmi_tty_write_room(struct tty_struct *tty) return 2048; } -static int kgdb_nmi_tty_write(struct tty_struct *tty, const unchar *buf, int c) +static int kgdb_nmi_tty_write(struct tty_struct *tty, const u8 *buf, int c) { int i; diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index e31c9b6bd8ab..33df5b08d992 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -580,8 +580,7 @@ static void uart_flush_chars(struct tty_struct *tty) uart_start(tty); } -static int uart_write(struct tty_struct *tty, - const unsigned char *buf, int count) +static int uart_write(struct tty_struct *tty, const u8 *buf, int count) { struct uart_state *state = tty->driver_data; struct uart_port *port; diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c index 4c6366fe015c..c7cecea38ca8 100644 --- a/drivers/tty/synclink_gt.c +++ b/drivers/tty/synclink_gt.c @@ -431,7 +431,7 @@ static void tx_set_idle(struct slgt_info *info); static unsigned int tbuf_bytes(struct slgt_info *info); static void reset_tbufs(struct slgt_info *info); static void tdma_reset(struct slgt_info *info); -static bool tx_load(struct slgt_info *info, const char *buf, unsigned int count); +static bool tx_load(struct slgt_info *info, const u8 *buf, unsigned int count); static void get_gtsignals(struct slgt_info *info); static void set_gtsignals(struct slgt_info *info); @@ -745,8 +745,7 @@ static void update_tx_timer(struct slgt_info *info) } } -static int write(struct tty_struct *tty, - const unsigned char *buf, int count) +static int write(struct tty_struct *tty, const u8 *buf, int count) { int ret = 0; struct slgt_info *info = tty->driver_data; @@ -4767,7 +4766,7 @@ static unsigned int tbuf_bytes(struct slgt_info *info) * load data into transmit DMA buffer ring and start transmitter if needed * return true if data accepted, otherwise false (buffers full) */ -static bool tx_load(struct slgt_info *info, const char *buf, unsigned int size) +static bool tx_load(struct slgt_info *info, const u8 *buf, unsigned int size) { unsigned short count; unsigned int i; diff --git a/drivers/tty/ttynull.c b/drivers/tty/ttynull.c index 1d4438472442..6b74ebaa0f2d 100644 --- a/drivers/tty/ttynull.c +++ b/drivers/tty/ttynull.c @@ -29,8 +29,7 @@ static void ttynull_hangup(struct tty_struct *tty) tty_port_hangup(&ttynull_port); } -static int ttynull_write(struct tty_struct *tty, const unsigned char *buf, - int count) +static int ttynull_write(struct tty_struct *tty, const u8 *buf, int count) { return count; } diff --git a/drivers/tty/vcc.c b/drivers/tty/vcc.c index 34ba6e54789a..c223879039b8 100644 --- a/drivers/tty/vcc.c +++ b/drivers/tty/vcc.c @@ -804,8 +804,7 @@ static void vcc_hangup(struct tty_struct *tty) tty_port_hangup(tty->port); } -static int vcc_write(struct tty_struct *tty, const unsigned char *buf, - int count) +static int vcc_write(struct tty_struct *tty, const u8 *buf, int count) { struct vcc_port *port; struct vio_vcc *pkt; diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index cf77011a8f4e..2f28612aee91 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -2845,7 +2845,7 @@ static int vc_con_write_normal(struct vc_data *vc, int tc, int c, } /* acquires console_lock */ -static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int count) +static int do_con_write(struct tty_struct *tty, const u8 *buf, int count) { struct vc_draw_region draw = { .x = -1, @@ -3238,7 +3238,7 @@ int tioclinux(struct tty_struct *tty, unsigned long arg) * /dev/ttyN handling */ -static int con_write(struct tty_struct *tty, const unsigned char *buf, int count) +static int con_write(struct tty_struct *tty, const u8 *buf, int count) { int retval; diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 11da5fb284d0..913b07b30d33 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -789,8 +789,7 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp) tty_port_close(&acm->port, tty, filp); } -static int acm_tty_write(struct tty_struct *tty, - const unsigned char *buf, int count) +static int acm_tty_write(struct tty_struct *tty, const u8 *buf, int count) { struct acm *acm = tty->driver_data; int stat; diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c index 1115396b46a0..1d08a1d8d3cd 100644 --- a/drivers/usb/gadget/function/u_serial.c +++ b/drivers/usb/gadget/function/u_serial.c @@ -734,7 +734,7 @@ exit: spin_unlock_irq(&port->port_lock); } -static int gs_write(struct tty_struct *tty, const unsigned char *buf, int count) +static int gs_write(struct tty_struct *tty, const u8 *buf, int count) { struct gs_port *port = tty->driver_data; unsigned long flags; diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c index d3acc0829ee5..f5f2d0e12e69 100644 --- a/drivers/usb/host/xhci-dbgtty.c +++ b/drivers/usb/host/xhci-dbgtty.c @@ -208,9 +208,7 @@ static void dbc_tty_close(struct tty_struct *tty, struct file *file) tty_port_close(&port->port, tty, file); } -static int dbc_tty_write(struct tty_struct *tty, - const unsigned char *buf, - int count) +static int dbc_tty_write(struct tty_struct *tty, const u8 *buf, int count) { struct dbc_port *port = tty->driver_data; unsigned long flags; diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 7b4805c1004d..51f738ea3f77 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -361,8 +361,7 @@ static void serial_cleanup(struct tty_struct *tty) module_put(owner); } -static int serial_write(struct tty_struct *tty, const unsigned char *buf, - int count) +static int serial_write(struct tty_struct *tty, const u8 *buf, int count) { struct usb_serial_port *port = tty->driver_data; int retval = -ENODEV; diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index e00034118c7b..a7bd8060ac96 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h @@ -356,8 +356,7 @@ struct tty_operations { void (*close)(struct tty_struct * tty, struct file * filp); void (*shutdown)(struct tty_struct *tty); void (*cleanup)(struct tty_struct *tty); - int (*write)(struct tty_struct * tty, - const unsigned char *buf, int count); + int (*write)(struct tty_struct *tty, const u8 *buf, int count); int (*put_char)(struct tty_struct *tty, unsigned char ch); void (*flush_chars)(struct tty_struct *tty); unsigned int (*write_room)(struct tty_struct *tty); diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index d73eec146529..3b5f8404dc84 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c @@ -779,7 +779,7 @@ static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp) tty_port_close(&dev->port, tty, filp); } -static int rfcomm_tty_write(struct tty_struct *tty, const unsigned char *buf, int count) +static int rfcomm_tty_write(struct tty_struct *tty, const u8 *buf, int count) { struct rfcomm_dev *dev = tty->driver_data; struct rfcomm_dlc *dlc = dev->dlc; -- cgit v1.2.3 From 95713967ba52389f7cea75704d0cf048080ec218 Mon Sep 17 00:00:00 2001 From: "Jiri Slaby (SUSE)" Date: Thu, 10 Aug 2023 11:15:03 +0200 Subject: tty: make tty_operations::write()'s count size_t Unify with the rest of the code. Use size_t for counts and ssize_t for retval. Signed-off-by: "Jiri Slaby (SUSE)" Link: https://lore.kernel.org/r/20230810091510.13006-30-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman --- arch/alpha/kernel/srmcons.c | 4 ++-- arch/m68k/emu/nfcon.c | 3 ++- arch/um/drivers/line.c | 2 +- arch/um/drivers/line.h | 2 +- arch/xtensa/platforms/iss/console.c | 2 +- drivers/char/ttyprintk.c | 2 +- drivers/ipack/devices/ipoctal.c | 3 ++- drivers/isdn/capi/capi.c | 5 +++-- drivers/misc/bcm-vk/bcm_vk_tty.c | 3 ++- drivers/mmc/core/sdio_uart.c | 3 ++- drivers/net/usb/hso.c | 3 ++- drivers/s390/char/con3215.c | 3 ++- drivers/s390/char/con3270.c | 3 ++- drivers/s390/char/sclp_tty.c | 4 ++-- drivers/s390/char/sclp_vt220.c | 4 ++-- drivers/staging/gdm724x/gdm_tty.c | 2 +- drivers/staging/greybus/uart.c | 2 +- drivers/tty/amiserial.c | 2 +- drivers/tty/ehv_bytechan.c | 3 ++- drivers/tty/goldfish.c | 3 ++- drivers/tty/hvc/hvc_console.c | 2 +- drivers/tty/hvc/hvcs.c | 5 +++-- drivers/tty/hvc/hvsi.c | 3 ++- drivers/tty/ipwireless/tty.c | 3 ++- drivers/tty/mips_ejtag_fdc.c | 6 +++--- drivers/tty/moxa.c | 4 ++-- drivers/tty/mxser.c | 2 +- drivers/tty/n_gsm.c | 2 +- drivers/tty/nozomi.c | 3 ++- drivers/tty/pty.c | 2 +- drivers/tty/rpmsg_tty.c | 5 +++-- drivers/tty/serial/kgdb_nmi.c | 3 ++- drivers/tty/serial/serial_core.c | 2 +- drivers/tty/synclink_gt.c | 4 ++-- drivers/tty/ttynull.c | 3 ++- drivers/tty/vcc.c | 5 +++-- drivers/tty/vt/vt.c | 2 +- drivers/usb/class/cdc-acm.c | 7 ++++--- drivers/usb/gadget/function/u_serial.c | 4 ++-- drivers/usb/host/xhci-dbgtty.c | 3 ++- drivers/usb/serial/usb-serial.c | 4 ++-- include/linux/tty_driver.h | 6 +++--- net/bluetooth/rfcomm/tty.c | 5 +++-- 43 files changed, 82 insertions(+), 61 deletions(-) (limited to 'drivers/misc') diff --git a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c index dea39008d93e..d6139dbae4ac 100644 --- a/arch/alpha/kernel/srmcons.c +++ b/arch/alpha/kernel/srmcons.c @@ -129,8 +129,8 @@ srmcons_do_write(struct tty_port *port, const char *buf, int count) return count; } -static int -srmcons_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t +srmcons_write(struct tty_struct *tty, const u8 *buf, size_t count) { unsigned long flags; diff --git a/arch/m68k/emu/nfcon.c b/arch/m68k/emu/nfcon.c index 87398f834e36..3a74d493eb3e 100644 --- a/arch/m68k/emu/nfcon.c +++ b/arch/m68k/emu/nfcon.c @@ -70,7 +70,8 @@ static void nfcon_tty_close(struct tty_struct *tty, struct file *filp) { } -static int nfcon_tty_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t nfcon_tty_write(struct tty_struct *tty, const u8 *buf, + size_t count) { nfputs(buf, count); return count; diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index e5393b4ba9f8..b98545f3edb5 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c @@ -184,7 +184,7 @@ void line_flush_chars(struct tty_struct *tty) line_flush_buffer(tty); } -int line_write(struct tty_struct *tty, const u8 *buf, int len) +ssize_t line_write(struct tty_struct *tty, const u8 *buf, size_t len) { struct line *line = tty->driver_data; unsigned long flags; diff --git a/arch/um/drivers/line.h b/arch/um/drivers/line.h index 8354024b6b35..e84fb9b4165e 100644 --- a/arch/um/drivers/line.h +++ b/arch/um/drivers/line.h @@ -64,7 +64,7 @@ extern void line_cleanup(struct tty_struct *tty); extern void line_hangup(struct tty_struct *tty); extern int line_setup(char **conf, unsigned nlines, char **def, char *init, char *name); -extern int line_write(struct tty_struct *tty, const u8 *buf, int len); +extern ssize_t line_write(struct tty_struct *tty, const u8 *buf, size_t len); extern unsigned int line_chars_in_buffer(struct tty_struct *tty); extern void line_flush_buffer(struct tty_struct *tty); extern void line_flush_chars(struct tty_struct *tty); diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c index 182ec57e2d5c..7d1f8b398a46 100644 --- a/arch/xtensa/platforms/iss/console.c +++ b/arch/xtensa/platforms/iss/console.c @@ -52,7 +52,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp) } -static int rs_write(struct tty_struct * tty, const u8 *buf, int count) +static ssize_t rs_write(struct tty_struct * tty, const u8 *buf, size_t count) { /* see drivers/char/serialX.c to reference original version */ diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c index 4f3dd93f1fd8..5af804c17a75 100644 --- a/drivers/char/ttyprintk.c +++ b/drivers/char/ttyprintk.c @@ -103,7 +103,7 @@ static void tpk_close(struct tty_struct *tty, struct file *filp) /* * TTY operations write function. */ -static int tpk_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t tpk_write(struct tty_struct *tty, const u8 *buf, size_t count) { struct ttyprintk_port *tpkp = tty->driver_data; unsigned long flags; diff --git a/drivers/ipack/devices/ipoctal.c b/drivers/ipack/devices/ipoctal.c index c3cf086e7e36..da308be6c487 100644 --- a/drivers/ipack/devices/ipoctal.c +++ b/drivers/ipack/devices/ipoctal.c @@ -458,7 +458,8 @@ static inline int ipoctal_copy_write_buffer(struct ipoctal_channel *channel, return i; } -static int ipoctal_write_tty(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t ipoctal_write_tty(struct tty_struct *tty, const u8 *buf, + size_t count) { struct ipoctal_channel *channel = tty->driver_data; unsigned int char_copied; diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 2f38e1cfe97a..2f3789515445 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -1077,12 +1077,13 @@ static void capinc_tty_close(struct tty_struct *tty, struct file *filp) tty_port_close(&mp->port, tty, filp); } -static int capinc_tty_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t capinc_tty_write(struct tty_struct *tty, const u8 *buf, + size_t count) { struct capiminor *mp = tty->driver_data; struct sk_buff *skb; - pr_debug("capinc_tty_write(count=%d)\n", count); + pr_debug("capinc_tty_write(count=%zu)\n", count); spin_lock_bh(&mp->outlock); skb = mp->outskb; diff --git a/drivers/misc/bcm-vk/bcm_vk_tty.c b/drivers/misc/bcm-vk/bcm_vk_tty.c index 44851b607cce..2bce835ca43e 100644 --- a/drivers/misc/bcm-vk/bcm_vk_tty.c +++ b/drivers/misc/bcm-vk/bcm_vk_tty.c @@ -186,7 +186,8 @@ static void bcm_vk_tty_doorbell(struct bcm_vk *vk, u32 db_val) VK_BAR0_REGSEG_DB_BASE + VK_BAR0_REGSEG_TTY_DB_OFFSET); } -static int bcm_vk_tty_write(struct tty_struct *tty, const u8 *buffer, int count) +static ssize_t bcm_vk_tty_write(struct tty_struct *tty, const u8 *buffer, + size_t count) { int index; struct bcm_vk *vk; diff --git a/drivers/mmc/core/sdio_uart.c b/drivers/mmc/core/sdio_uart.c index 90d2fe00c0b9..ef38dcd3a887 100644 --- a/drivers/mmc/core/sdio_uart.c +++ b/drivers/mmc/core/sdio_uart.c @@ -760,7 +760,8 @@ static void sdio_uart_hangup(struct tty_struct *tty) tty_port_hangup(&port->port); } -static int sdio_uart_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t sdio_uart_write(struct tty_struct *tty, const u8 *buf, + size_t count) { struct sdio_uart_port *port = tty->driver_data; int ret; diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 014a9d29bab5..3f424da87bf4 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c @@ -1322,7 +1322,8 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp) } /* close the requested serial port */ -static int hso_serial_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t hso_serial_write(struct tty_struct *tty, const u8 *buf, + size_t count) { struct hso_serial *serial = tty->driver_data; int space, tx_bytes; diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c index 8bbce6a4d7f5..99361618c31f 100644 --- a/drivers/s390/char/con3215.c +++ b/drivers/s390/char/con3215.c @@ -1021,7 +1021,8 @@ static unsigned int tty3215_write_room(struct tty_struct *tty) /* * String write routine for 3215 ttys */ -static int tty3215_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t tty3215_write(struct tty_struct *tty, const u8 *buf, + size_t count) { handle_write(tty->driver_data, buf, count); return count; diff --git a/drivers/s390/char/con3270.c b/drivers/s390/char/con3270.c index 6374555a0937..363315fa1666 100644 --- a/drivers/s390/char/con3270.c +++ b/drivers/s390/char/con3270.c @@ -1803,7 +1803,8 @@ static void tty3270_do_write(struct tty3270 *tp, struct tty_struct *tty, /* * String write routine for 3270 ttys */ -static int tty3270_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t tty3270_write(struct tty_struct *tty, const u8 *buf, + size_t count) { struct tty3270 *tp; diff --git a/drivers/s390/char/sclp_tty.c b/drivers/s390/char/sclp_tty.c index 831a8c7cacc2..892c18d2f87e 100644 --- a/drivers/s390/char/sclp_tty.c +++ b/drivers/s390/char/sclp_tty.c @@ -229,8 +229,8 @@ out: * tty device. The characters may come from user space or kernel space. This * routine will return the number of characters actually accepted for writing. */ -static int -sclp_tty_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t +sclp_tty_write(struct tty_struct *tty, const u8 *buf, size_t count) { if (sclp_tty_chars_count > 0) { sclp_tty_write_string(sclp_tty_chars, sclp_tty_chars_count, 0); diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c index e148350c1e2c..218ae604f737 100644 --- a/drivers/s390/char/sclp_vt220.c +++ b/drivers/s390/char/sclp_vt220.c @@ -462,8 +462,8 @@ out: * user space or kernel space. This routine will return the * number of characters actually accepted for writing. */ -static int -sclp_vt220_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t +sclp_vt220_write(struct tty_struct *tty, const u8 *buf, size_t count) { return __sclp_vt220_write(buf, count, 1, 0, 1); } diff --git a/drivers/staging/gdm724x/gdm_tty.c b/drivers/staging/gdm724x/gdm_tty.c index ae9978b73d9b..b31f2afb0286 100644 --- a/drivers/staging/gdm724x/gdm_tty.c +++ b/drivers/staging/gdm724x/gdm_tty.c @@ -149,7 +149,7 @@ static void gdm_tty_send_complete(void *arg) tty_port_tty_wakeup(&gdm->port); } -static int gdm_tty_write(struct tty_struct *tty, const u8 *buf, int len) +static ssize_t gdm_tty_write(struct tty_struct *tty, const u8 *buf, size_t len) { struct gdm *gdm = tty->driver_data; int remain = len; diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c index 97c7ddd0f53e..999ce613dca8 100644 --- a/drivers/staging/greybus/uart.c +++ b/drivers/staging/greybus/uart.c @@ -427,7 +427,7 @@ static void gb_tty_hangup(struct tty_struct *tty) tty_port_hangup(&gb_tty->port); } -static int gb_tty_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t gb_tty_write(struct tty_struct *tty, const u8 *buf, size_t count) { struct gb_tty *gb_tty = tty->driver_data; diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index 91cf294ec8c1..785558c65ae8 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c @@ -741,7 +741,7 @@ static void rs_flush_chars(struct tty_struct *tty) local_irq_restore(flags); } -static int rs_write(struct tty_struct * tty, const u8 *buf, int count) +static ssize_t rs_write(struct tty_struct * tty, const u8 *buf, size_t count) { int c, ret = 0; struct serial_state *info = tty->driver_data; diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c index de36347e2145..a067628e01c8 100644 --- a/drivers/tty/ehv_bytechan.c +++ b/drivers/tty/ehv_bytechan.c @@ -466,7 +466,8 @@ static irqreturn_t ehv_bc_tty_tx_isr(int irq, void *data) * ehv_bc_tty_write_room() will never lie, so the tty layer will never send us * too much data. */ -static int ehv_bc_tty_write(struct tty_struct *ttys, const u8 *s, int count) +static ssize_t ehv_bc_tty_write(struct tty_struct *ttys, const u8 *s, + size_t count) { struct ehv_bc_data *bc = ttys->driver_data; unsigned long flags; diff --git a/drivers/tty/goldfish.c b/drivers/tty/goldfish.c index faa597ffbaf9..4591f940b7a1 100644 --- a/drivers/tty/goldfish.c +++ b/drivers/tty/goldfish.c @@ -185,7 +185,8 @@ static void goldfish_tty_hangup(struct tty_struct *tty) tty_port_hangup(tty->port); } -static int goldfish_tty_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t goldfish_tty_write(struct tty_struct *tty, const u8 *buf, + size_t count) { goldfish_tty_do_write(tty->index, buf, count); return count; diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c index 4c60d15c7a6f..e93e8072ec86 100644 --- a/drivers/tty/hvc/hvc_console.c +++ b/drivers/tty/hvc/hvc_console.c @@ -496,7 +496,7 @@ static int hvc_push(struct hvc_struct *hp) return n; } -static int hvc_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t hvc_write(struct tty_struct *tty, const u8 *buf, size_t count) { struct hvc_struct *hp = tty->driver_data; unsigned long flags; diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c index 2465d61b4e76..1de91fa23b04 100644 --- a/drivers/tty/hvc/hvcs.c +++ b/drivers/tty/hvc/hvcs.c @@ -1257,7 +1257,7 @@ static void hvcs_hangup(struct tty_struct * tty) * tty_hangup will allow hvcs_write time to complete execution before it * terminates our device. */ -static int hvcs_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t hvcs_write(struct tty_struct *tty, const u8 *buf, size_t count) { struct hvcs_struct *hvcsd = tty->driver_data; unsigned int unit_address; @@ -1299,7 +1299,8 @@ static int hvcs_write(struct tty_struct *tty, const u8 *buf, int count) unit_address = hvcsd->vdev->unit_address; while (count > 0) { - tosend = min(count, (HVCS_BUFF_LEN - hvcsd->chars_in_buffer)); + tosend = min_t(unsigned, count, + (HVCS_BUFF_LEN - hvcsd->chars_in_buffer)); /* * No more space, this probably means that the last call to * hvcs_write() didn't succeed and the buffer was filled up. diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c index 46dd62df2442..c57bd85aa488 100644 --- a/drivers/tty/hvc/hvsi.c +++ b/drivers/tty/hvc/hvsi.c @@ -904,7 +904,8 @@ static unsigned int hvsi_chars_in_buffer(struct tty_struct *tty) return hp->n_outbuf; } -static int hvsi_write(struct tty_struct *tty, const u8 *source, int count) +static ssize_t hvsi_write(struct tty_struct *tty, const u8 *source, + size_t count) { struct hvsi_struct *hp = tty->driver_data; unsigned long flags; diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c index cd43208c523c..b6de40815fb9 100644 --- a/drivers/tty/ipwireless/tty.c +++ b/drivers/tty/ipwireless/tty.c @@ -186,7 +186,8 @@ static void ipw_write_packet_sent_callback(void *callback_data, tty->tx_bytes_queued -= packet_length; } -static int ipw_write(struct tty_struct *linux_tty, const u8 *buf, int count) +static ssize_t ipw_write(struct tty_struct *linux_tty, const u8 *buf, + size_t count) { struct ipw_tty *tty = linux_tty->driver_data; int room, ret; diff --git a/drivers/tty/mips_ejtag_fdc.c b/drivers/tty/mips_ejtag_fdc.c index cf4ef0c38624..369ec71c24ef 100644 --- a/drivers/tty/mips_ejtag_fdc.c +++ b/drivers/tty/mips_ejtag_fdc.c @@ -796,8 +796,8 @@ static void mips_ejtag_fdc_tty_hangup(struct tty_struct *tty) tty_port_hangup(tty->port); } -static int mips_ejtag_fdc_tty_write(struct tty_struct *tty, const u8 *buf, - int total) +static ssize_t mips_ejtag_fdc_tty_write(struct tty_struct *tty, const u8 *buf, + size_t total) { int count, block; struct mips_ejtag_fdc_tty_port *dport = tty->driver_data; @@ -816,7 +816,7 @@ static int mips_ejtag_fdc_tty_write(struct tty_struct *tty, const u8 *buf, */ spin_lock(&dport->xmit_lock); /* Work out how many bytes we can write to the xmit buffer */ - total = min(total, (int)(priv->xmit_size - dport->xmit_cnt)); + total = min_t(size_t, total, priv->xmit_size - dport->xmit_cnt); atomic_add(total, &priv->xmit_total); dport->xmit_cnt += total; /* Write the actual bytes (may need splitting if it wraps) */ diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c index d94cf1be651b..bf3f87ba3a92 100644 --- a/drivers/tty/moxa.c +++ b/drivers/tty/moxa.c @@ -487,7 +487,7 @@ module_param(ttymajor, int, 0); */ static int moxa_open(struct tty_struct *, struct file *); static void moxa_close(struct tty_struct *, struct file *); -static int moxa_write(struct tty_struct *, const u8 *, int); +static ssize_t moxa_write(struct tty_struct *, const u8 *, size_t); static unsigned int moxa_write_room(struct tty_struct *); static void moxa_flush_buffer(struct tty_struct *); static unsigned int moxa_chars_in_buffer(struct tty_struct *); @@ -1499,7 +1499,7 @@ static void moxa_close(struct tty_struct *tty, struct file *filp) tty_port_close(&ch->port, tty, filp); } -static int moxa_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t moxa_write(struct tty_struct *tty, const u8 *buf, size_t count) { struct moxa_port *ch = tty->driver_data; unsigned long flags; diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index a5dfd08d4ea2..10aa4ed38793 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -901,7 +901,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) tty_port_close(tty->port, tty, filp); } -static int mxser_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t mxser_write(struct tty_struct *tty, const u8 *buf, size_t count) { struct mxser_port *info = tty->driver_data; unsigned long flags; diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index d167e36873fe..3e5cc30941a7 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -4256,7 +4256,7 @@ static void gsmtty_hangup(struct tty_struct *tty) gsm_dlci_begin_close(dlci); } -static int gsmtty_write(struct tty_struct *tty, const u8 *buf, int len) +static ssize_t gsmtty_write(struct tty_struct *tty, const u8 *buf, size_t len) { int sent; struct gsm_dlci *dlci = tty->driver_data; diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c index b3756402f5d9..02cd40147b3a 100644 --- a/drivers/tty/nozomi.c +++ b/drivers/tty/nozomi.c @@ -1599,7 +1599,8 @@ static void ntty_hangup(struct tty_struct *tty) * called when the userspace process writes to the tty (/dev/noz*). * Data is inserted into a fifo, which is then read and transferred to the modem. */ -static int ntty_write(struct tty_struct *tty, const u8 *buffer, int count) +static ssize_t ntty_write(struct tty_struct *tty, const u8 *buffer, + size_t count) { int rval = -EINVAL; struct nozomi *dc = get_dc_by_tty(tty); diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 335f5744f320..df08f13052ff 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -108,7 +108,7 @@ static void pty_unthrottle(struct tty_struct *tty) * the other side of the pty/tty pair. */ -static int pty_write(struct tty_struct *tty, const u8 *buf, int c) +static ssize_t pty_write(struct tty_struct *tty, const u8 *buf, size_t c) { struct tty_struct *to = tty->link; diff --git a/drivers/tty/rpmsg_tty.c b/drivers/tty/rpmsg_tty.c index 29db413bbc03..60a2915f5cfe 100644 --- a/drivers/tty/rpmsg_tty.c +++ b/drivers/tty/rpmsg_tty.c @@ -73,7 +73,8 @@ static void rpmsg_tty_close(struct tty_struct *tty, struct file *filp) return tty_port_close(tty->port, tty, filp); } -static int rpmsg_tty_write(struct tty_struct *tty, const u8 *buf, int len) +static ssize_t rpmsg_tty_write(struct tty_struct *tty, const u8 *buf, + size_t len) { struct rpmsg_tty_port *cport = tty->driver_data; struct rpmsg_device *rpdev; @@ -86,7 +87,7 @@ static int rpmsg_tty_write(struct tty_struct *tty, const u8 *buf, int len) if (msg_max_size < 0) return msg_max_size; - msg_size = min(len, msg_max_size); + msg_size = min_t(unsigned int, len, msg_max_size); /* * Use rpmsg_trysend instead of rpmsg_send to send the message so the caller is not diff --git a/drivers/tty/serial/kgdb_nmi.c b/drivers/tty/serial/kgdb_nmi.c index 2a04d19d5ec0..e93850f6447a 100644 --- a/drivers/tty/serial/kgdb_nmi.c +++ b/drivers/tty/serial/kgdb_nmi.c @@ -304,7 +304,8 @@ static unsigned int kgdb_nmi_tty_write_room(struct tty_struct *tty) return 2048; } -static int kgdb_nmi_tty_write(struct tty_struct *tty, const u8 *buf, int c) +static ssize_t kgdb_nmi_tty_write(struct tty_struct *tty, const u8 *buf, + size_t c) { int i; diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index d5b682ff20b3..7bdc21d5e13b 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -580,7 +580,7 @@ static void uart_flush_chars(struct tty_struct *tty) uart_start(tty); } -static int uart_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t uart_write(struct tty_struct *tty, const u8 *buf, size_t count) { struct uart_state *state = tty->driver_data; struct uart_port *port; diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c index 0264e9f7699c..8112d9d5a0d8 100644 --- a/drivers/tty/synclink_gt.c +++ b/drivers/tty/synclink_gt.c @@ -745,7 +745,7 @@ static void update_tx_timer(struct slgt_info *info) } } -static int write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t write(struct tty_struct *tty, const u8 *buf, size_t count) { int ret = 0; struct slgt_info *info = tty->driver_data; @@ -754,7 +754,7 @@ static int write(struct tty_struct *tty, const u8 *buf, int count) if (sanity_check(info, tty->name, "write")) return -EIO; - DBGINFO(("%s write count=%d\n", info->device_name, count)); + DBGINFO(("%s write count=%zu\n", info->device_name, count)); if (!info->tx_buf || (count > info->max_frame_size)) return -EIO; diff --git a/drivers/tty/ttynull.c b/drivers/tty/ttynull.c index 6b74ebaa0f2d..e4c4273993bc 100644 --- a/drivers/tty/ttynull.c +++ b/drivers/tty/ttynull.c @@ -29,7 +29,8 @@ static void ttynull_hangup(struct tty_struct *tty) tty_port_hangup(&ttynull_port); } -static int ttynull_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t ttynull_write(struct tty_struct *tty, const u8 *buf, + size_t count) { return count; } diff --git a/drivers/tty/vcc.c b/drivers/tty/vcc.c index c223879039b8..9cc569174c83 100644 --- a/drivers/tty/vcc.c +++ b/drivers/tty/vcc.c @@ -804,7 +804,7 @@ static void vcc_hangup(struct tty_struct *tty) tty_port_hangup(tty->port); } -static int vcc_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t vcc_write(struct tty_struct *tty, const u8 *buf, size_t count) { struct vcc_port *port; struct vio_vcc *pkt; @@ -826,7 +826,8 @@ static int vcc_write(struct tty_struct *tty, const u8 *buf, int count) while (count > 0) { /* Minimum of data to write and space available */ - tosend = min(count, (VCC_BUFF_LEN - port->chars_in_buffer)); + tosend = min_t(size_t, count, + (VCC_BUFF_LEN - port->chars_in_buffer)); if (!tosend) break; diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index ea7c20d66acb..5c47f77804f0 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -3238,7 +3238,7 @@ int tioclinux(struct tty_struct *tty, unsigned long arg) * /dev/ttyN handling */ -static int con_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t con_write(struct tty_struct *tty, const u8 *buf, size_t count) { int retval; diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 913b07b30d33..3591880d96bd 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -789,7 +789,8 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp) tty_port_close(&acm->port, tty, filp); } -static int acm_tty_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t acm_tty_write(struct tty_struct *tty, const u8 *buf, + size_t count) { struct acm *acm = tty->driver_data; int stat; @@ -800,7 +801,7 @@ static int acm_tty_write(struct tty_struct *tty, const u8 *buf, int count) if (!count) return 0; - dev_vdbg(&acm->data->dev, "%d bytes from tty layer\n", count); + dev_vdbg(&acm->data->dev, "%zu bytes from tty layer\n", count); spin_lock_irqsave(&acm->write_lock, flags); wbn = acm_wb_alloc(acm); @@ -817,7 +818,7 @@ static int acm_tty_write(struct tty_struct *tty, const u8 *buf, int count) } count = (count > acm->writesize) ? acm->writesize : count; - dev_vdbg(&acm->data->dev, "writing %d bytes\n", count); + dev_vdbg(&acm->data->dev, "writing %zu bytes\n", count); memcpy(wb->buf, buf, count); wb->len = count; diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c index 3e6b750aa4fc..a92eb6d90976 100644 --- a/drivers/usb/gadget/function/u_serial.c +++ b/drivers/usb/gadget/function/u_serial.c @@ -734,12 +734,12 @@ exit: spin_unlock_irq(&port->port_lock); } -static int gs_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t gs_write(struct tty_struct *tty, const u8 *buf, size_t count) { struct gs_port *port = tty->driver_data; unsigned long flags; - pr_vdebug("gs_write: ttyGS%d (%p) writing %d bytes\n", + pr_vdebug("gs_write: ttyGS%d (%p) writing %zu bytes\n", port->port_num, tty, count); spin_lock_irqsave(&port->port_lock, flags); diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c index 5b82bdd82ba9..b74e98e94393 100644 --- a/drivers/usb/host/xhci-dbgtty.c +++ b/drivers/usb/host/xhci-dbgtty.c @@ -208,7 +208,8 @@ static void dbc_tty_close(struct tty_struct *tty, struct file *file) tty_port_close(&port->port, tty, file); } -static int dbc_tty_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t dbc_tty_write(struct tty_struct *tty, const u8 *buf, + size_t count) { struct dbc_port *port = tty->driver_data; unsigned long flags; diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 51f738ea3f77..17b09f03ef84 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -361,7 +361,7 @@ static void serial_cleanup(struct tty_struct *tty) module_put(owner); } -static int serial_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t serial_write(struct tty_struct *tty, const u8 *buf, size_t count) { struct usb_serial_port *port = tty->driver_data; int retval = -ENODEV; @@ -369,7 +369,7 @@ static int serial_write(struct tty_struct *tty, const u8 *buf, int count) if (port->serial->dev->state == USB_STATE_NOTATTACHED) goto exit; - dev_dbg(&port->dev, "%s - %d byte(s)\n", __func__, count); + dev_dbg(&port->dev, "%s - %zu byte(s)\n", __func__, count); retval = port->serial->type->write(tty, port, buf, count); if (retval < 0) diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index c5299d952e59..18beff0cec1a 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h @@ -72,8 +72,8 @@ struct serial_struct; * is closed for the last time freeing up the resources. This is * actually the second part of shutdown for routines that might sleep. * - * @write: ``int ()(struct tty_struct *tty, const unsigned char *buf, - * int count)`` + * @write: ``ssize_t ()(struct tty_struct *tty, const unsigned char *buf, + * size_t count)`` * * This routine is called by the kernel to write a series (@count) of * characters (@buf) to the @tty device. The characters may come from @@ -356,7 +356,7 @@ struct tty_operations { void (*close)(struct tty_struct * tty, struct file * filp); void (*shutdown)(struct tty_struct *tty); void (*cleanup)(struct tty_struct *tty); - int (*write)(struct tty_struct *tty, const u8 *buf, int count); + ssize_t (*write)(struct tty_struct *tty, const u8 *buf, size_t count); int (*put_char)(struct tty_struct *tty, u8 ch); void (*flush_chars)(struct tty_struct *tty); unsigned int (*write_room)(struct tty_struct *tty); diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 3b5f8404dc84..33b135ed59c4 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c @@ -779,14 +779,15 @@ static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp) tty_port_close(&dev->port, tty, filp); } -static int rfcomm_tty_write(struct tty_struct *tty, const u8 *buf, int count) +static ssize_t rfcomm_tty_write(struct tty_struct *tty, const u8 *buf, + size_t count) { struct rfcomm_dev *dev = tty->driver_data; struct rfcomm_dlc *dlc = dev->dlc; struct sk_buff *skb; int sent = 0, size; - BT_DBG("tty %p count %d", tty, count); + BT_DBG("tty %p count %zu", tty, count); while (count) { size = min_t(uint, count, dlc->mtu); -- cgit v1.2.3