Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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)" <jirislaby@kernel.org>
Cc: William Hubbs <w.d.hubbs@gmail.com>
Cc: Chris Brannon <chris@the-brannons.com>
Cc: Kirk Reiser <kirk@reisers.ca>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Max Staudt <max@enpas.org>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Cc: Andreas Koensgen <ajk@comnets.uni-bremen.de>
Cc: Jeremy Kerr <jk@codeconstruct.com.au>
Cc: Matt Johnston <matt@codeconstruct.com.au>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230810091510.13006-16-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
e8161447 73048bd5

+38 -35
+3 -3
drivers/accessibility/speakup/spk_ttyio.c
··· 71 71 kfree(tty->disc_data); 72 72 } 73 73 74 - static int spk_ttyio_receive_buf2(struct tty_struct *tty, 75 - const unsigned char *cp, 76 - const char *fp, int count) 74 + static size_t spk_ttyio_receive_buf2(struct tty_struct *tty, 75 + const unsigned char *cp, const char *fp, 76 + size_t count) 77 77 { 78 78 struct spk_ldisc_data *ldisc_data = tty->disc_data; 79 79 struct spk_synth *synth = ldisc_data->synth;
+1 -1
drivers/bluetooth/hci_ldisc.c
··· 599 599 * Return Value: None 600 600 */ 601 601 static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data, 602 - const char *flags, int count) 602 + const char *flags, size_t count) 603 603 { 604 604 struct hci_uart *hu = tty->disc_data; 605 605
+2 -1
drivers/input/serio/serport.c
··· 115 115 */ 116 116 117 117 static void serport_ldisc_receive(struct tty_struct *tty, 118 - const unsigned char *cp, const char *fp, int count) 118 + const unsigned char *cp, const char *fp, 119 + size_t count) 119 120 { 120 121 struct serport *serport = tty->disc_data; 121 122 unsigned long flags;
+1 -1
drivers/misc/ti-st/st_core.c
··· 792 792 } 793 793 794 794 static void st_tty_receive(struct tty_struct *tty, const unsigned char *data, 795 - const char *tty_flags, int count) 795 + const char *tty_flags, size_t count) 796 796 { 797 797 #ifdef VERBOSE 798 798 print_hex_dump(KERN_DEBUG, ">in>", DUMP_PREFIX_NONE,
+1 -1
drivers/net/caif/caif_serial.c
··· 159 159 #endif 160 160 161 161 static void ldisc_receive(struct tty_struct *tty, const u8 *data, 162 - const char *flags, int count) 162 + const char *flags, size_t count) 163 163 { 164 164 struct sk_buff *skb = NULL; 165 165 struct ser_device *ser;
+2 -2
drivers/net/can/can327.c
··· 886 886 * functions may be called in parallel. 887 887 */ 888 888 static void can327_ldisc_rx(struct tty_struct *tty, const unsigned char *cp, 889 - const char *fp, int count) 889 + const char *fp, size_t count) 890 890 { 891 891 struct can327 *elm = tty->disc_data; 892 892 size_t first_new_char_idx; ··· 904 904 while (count--) { 905 905 if (elm->rxfill >= CAN327_SIZE_RXBUF) { 906 906 netdev_err(elm->dev, 907 - "Receive buffer overflowed. Bad chip or wiring? count = %i", 907 + "Receive buffer overflowed. Bad chip or wiring? count = %zu", 908 908 count); 909 909 goto uart_failure; 910 910 }
+1 -1
drivers/net/can/slcan/slcan-core.c
··· 776 776 */ 777 777 static void slcan_receive_buf(struct tty_struct *tty, 778 778 const unsigned char *cp, const char *fp, 779 - int count) 779 + size_t count) 780 780 { 781 781 struct slcan *sl = tty->disc_data; 782 782
+1 -1
drivers/net/hamradio/6pack.c
··· 428 428 * and sent on to some IP layer for further processing. 429 429 */ 430 430 static void sixpack_receive_buf(struct tty_struct *tty, 431 - const unsigned char *cp, const char *fp, int count) 431 + const unsigned char *cp, const char *fp, size_t count) 432 432 { 433 433 struct sixpack *sp; 434 434 int count1;
+1 -1
drivers/net/hamradio/mkiss.c
··· 875 875 * and sent on to the AX.25 layer for further processing. 876 876 */ 877 877 static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp, 878 - const char *fp, int count) 878 + const char *fp, size_t count) 879 879 { 880 880 struct mkiss *ax = mkiss_get(tty); 881 881
+1 -1
drivers/net/mctp/mctp-serial.c
··· 392 392 393 393 static void mctp_serial_tty_receive_buf(struct tty_struct *tty, 394 394 const unsigned char *c, 395 - const char *f, int len) 395 + const char *f, size_t len) 396 396 { 397 397 struct mctp_serial *dev = tty->disc_data; 398 398 int i;
+1 -1
drivers/net/ppp/ppp_async.c
··· 331 331 /* May sleep, don't call from interrupt level or with interrupts disabled */ 332 332 static void 333 333 ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, 334 - const char *cflags, int count) 334 + const char *cflags, size_t count) 335 335 { 336 336 struct asyncppp *ap = ap_get(tty); 337 337 unsigned long flags;
+1 -1
drivers/net/ppp/ppp_synctty.c
··· 324 324 /* May sleep, don't call from interrupt level or with interrupts disabled */ 325 325 static void 326 326 ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf, 327 - const char *cflags, int count) 327 + const char *cflags, size_t count) 328 328 { 329 329 struct syncppp *ap = sp_get(tty); 330 330 unsigned long flags;
+1 -1
drivers/net/slip/slip.c
··· 686 686 */ 687 687 688 688 static void slip_receive_buf(struct tty_struct *tty, const unsigned char *cp, 689 - const char *fp, int count) 689 + const char *fp, size_t count) 690 690 { 691 691 struct slip *sl = tty->disc_data; 692 692
+1 -1
drivers/tty/n_gsm.c
··· 3490 3490 } 3491 3491 3492 3492 static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp, 3493 - const char *fp, int count) 3493 + const char *fp, size_t count) 3494 3494 { 3495 3495 struct gsm_mux *gsm = tty->disc_data; 3496 3496 char flags = TTY_NORMAL;
+2 -2
drivers/tty/n_hdlc.c
··· 370 370 * interpreted as one HDLC frame. 371 371 */ 372 372 static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data, 373 - const char *flags, int count) 373 + const char *flags, size_t count) 374 374 { 375 375 register struct n_hdlc *n_hdlc = tty->disc_data; 376 376 register struct n_hdlc_buf *buf; 377 377 378 - pr_debug("%s() called count=%d\n", __func__, count); 378 + pr_debug("%s() called count=%zu\n", __func__, count); 379 379 380 380 if (count > maxframe) { 381 381 pr_debug("rx count>maxframesize, data discarded\n");
+8 -6
drivers/tty/n_tty.c
··· 1480 1480 1481 1481 /* Caller must ensure count > 0 */ 1482 1482 static void n_tty_lookahead_flow_ctrl(struct tty_struct *tty, const unsigned char *cp, 1483 - const unsigned char *fp, unsigned int count) 1483 + const unsigned char *fp, size_t count) 1484 1484 { 1485 1485 struct n_tty_data *ldata = tty->disc_data; 1486 1486 unsigned char flag = TTY_NORMAL; ··· 1662 1662 * claims non-exclusive %termios_rwsem 1663 1663 * publishes commit_head or canon_head 1664 1664 */ 1665 - static int 1665 + static size_t 1666 1666 n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp, 1667 1667 const char *fp, int count, int flow) 1668 1668 { 1669 1669 struct n_tty_data *ldata = tty->disc_data; 1670 - int room, n, rcvd = 0, overflow; 1670 + size_t rcvd = 0; 1671 + int room, n, overflow; 1671 1672 1672 1673 down_read(&tty->termios_rwsem); 1673 1674 ··· 1745 1744 } 1746 1745 1747 1746 static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp, 1748 - const char *fp, int count) 1747 + const char *fp, size_t count) 1749 1748 { 1750 1749 n_tty_receive_buf_common(tty, cp, fp, count, 0); 1751 1750 } 1752 1751 1753 - static int n_tty_receive_buf2(struct tty_struct *tty, const unsigned char *cp, 1754 - const char *fp, int count) 1752 + static size_t n_tty_receive_buf2(struct tty_struct *tty, 1753 + const unsigned char *cp, const char *fp, 1754 + size_t count) 1755 1755 { 1756 1756 return n_tty_receive_buf_common(tty, cp, fp, count, 1); 1757 1757 }
+8 -8
include/linux/tty_ldisc.h
··· 162 162 * Optional. Can sleep. 163 163 * 164 164 * @receive_buf: [DRV] ``void ()(struct tty_struct *tty, 165 - * const unsigned char *cp, const char *fp, int count)`` 165 + * const unsigned char *cp, const char *fp, size_t count)`` 166 166 * 167 167 * This function is called by the low-level tty driver to send characters 168 168 * received by the hardware to the line discpline for processing. @cp is ··· 191 191 * 192 192 * Optional. 193 193 * 194 - * @receive_buf2: [DRV] ``int ()(struct tty_struct *tty, 195 - * const unsigned char *cp, const char *fp, int count)`` 194 + * @receive_buf2: [DRV] ``ssize_t ()(struct tty_struct *tty, 195 + * const unsigned char *cp, const char *fp, size_t count)`` 196 196 * 197 197 * This function is called by the low-level tty driver to send characters 198 198 * received by the hardware to the line discpline for processing. @cp is a ··· 205 205 * Optional. 206 206 * 207 207 * @lookahead_buf: [DRV] ``void ()(struct tty_struct *tty, 208 - * const unsigned char *cp, const char *fp, int count)`` 208 + * const unsigned char *cp, const char *fp, size_t count)`` 209 209 * 210 210 * This function is called by the low-level tty driver for characters 211 211 * not eaten by ->receive_buf() or ->receive_buf2(). It is useful for ··· 256 256 * The following routines are called from below. 257 257 */ 258 258 void (*receive_buf)(struct tty_struct *tty, const unsigned char *cp, 259 - const char *fp, int count); 259 + const char *fp, size_t count); 260 260 void (*write_wakeup)(struct tty_struct *tty); 261 261 void (*dcd_change)(struct tty_struct *tty, bool active); 262 - int (*receive_buf2)(struct tty_struct *tty, const unsigned char *cp, 263 - const char *fp, int count); 262 + size_t (*receive_buf2)(struct tty_struct *tty, const unsigned char *cp, 263 + const char *fp, size_t count); 264 264 void (*lookahead_buf)(struct tty_struct *tty, const unsigned char *cp, 265 - const unsigned char *fp, unsigned int count); 265 + const unsigned char *fp, size_t count); 266 266 267 267 struct module *owner; 268 268 };
+1 -1
net/nfc/nci/uart.c
··· 296 296 * Return Value: None 297 297 */ 298 298 static void nci_uart_tty_receive(struct tty_struct *tty, const u8 *data, 299 - const char *flags, int count) 299 + const char *flags, size_t count) 300 300 { 301 301 struct nci_uart *nu = tty->disc_data; 302 302
+1 -1
sound/soc/codecs/cx20442.c
··· 259 259 260 260 /* Line discipline .receive_buf() */ 261 261 static void v253_receive(struct tty_struct *tty, const unsigned char *cp, 262 - const char *fp, int count) 262 + const char *fp, size_t count) 263 263 { 264 264 struct snd_soc_component *component = tty->disc_data; 265 265 struct cx20442_priv *cx20442;