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

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)" <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-18-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
892bc209 a8d9cd23

+54 -55
+1 -1
drivers/accessibility/speakup/spk_ttyio.c
··· 72 72 } 73 73 74 74 static size_t spk_ttyio_receive_buf2(struct tty_struct *tty, const u8 *cp, 75 - const char *fp, size_t count) 75 + const u8 *fp, size_t count) 76 76 { 77 77 struct spk_ldisc_data *ldisc_data = tty->disc_data; 78 78 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, size_t count) 602 + const u8 *flags, size_t count) 603 603 { 604 604 struct hci_uart *hu = tty->disc_data; 605 605
+1 -1
drivers/input/serio/serport.c
··· 115 115 */ 116 116 117 117 static void serport_ldisc_receive(struct tty_struct *tty, const u8 *cp, 118 - const char *fp, size_t count) 118 + const u8 *fp, size_t count) 119 119 { 120 120 struct serport *serport = tty->disc_data; 121 121 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 u8 *data, 795 - const char *tty_flags, size_t count) 795 + const u8 *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, size_t count) 162 + const u8 *flags, size_t count) 163 163 { 164 164 struct sk_buff *skb = NULL; 165 165 struct ser_device *ser;
+1 -1
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 u8 *cp, 889 - const char *fp, size_t count) 889 + const u8 *fp, size_t count) 890 890 { 891 891 struct can327 *elm = tty->disc_data; 892 892 size_t first_new_char_idx;
+1 -1
drivers/net/can/slcan/slcan-core.c
··· 775 775 * in parallel 776 776 */ 777 777 static void slcan_receive_buf(struct tty_struct *tty, const u8 *cp, 778 - const char *fp, size_t count) 778 + const u8 *fp, size_t count) 779 779 { 780 780 struct slcan *sl = tty->disc_data; 781 781
+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, const u8 *cp, 431 - const char *fp, size_t count) 431 + const u8 *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 u8 *cp, 878 - const char *fp, size_t count) 878 + const u8 *fp, size_t count) 879 879 { 880 880 struct mkiss *ax = mkiss_get(tty); 881 881
+1 -1
drivers/net/mctp/mctp-serial.c
··· 391 391 } 392 392 393 393 static void mctp_serial_tty_receive_buf(struct tty_struct *tty, const u8 *c, 394 - const char *f, size_t len) 394 + const u8 *f, size_t len) 395 395 { 396 396 struct mctp_serial *dev = tty->disc_data; 397 397 int i;
+3 -4
drivers/net/ppp/ppp_async.c
··· 98 98 static int ppp_async_push(struct asyncppp *ap); 99 99 static void ppp_async_flush_output(struct asyncppp *ap); 100 100 static void ppp_async_input(struct asyncppp *ap, const unsigned char *buf, 101 - const char *flags, int count); 101 + const u8 *flags, int count); 102 102 static int ppp_async_ioctl(struct ppp_channel *chan, unsigned int cmd, 103 103 unsigned long arg); 104 104 static void ppp_async_process(struct tasklet_struct *t); ··· 330 330 331 331 /* May sleep, don't call from interrupt level or with interrupts disabled */ 332 332 static void 333 - ppp_asynctty_receive(struct tty_struct *tty, const u8 *buf, const char *cflags, 333 + ppp_asynctty_receive(struct tty_struct *tty, const u8 *buf, const u8 *cflags, 334 334 size_t count) 335 335 { 336 336 struct asyncppp *ap = ap_get(tty); ··· 819 819 other ldisc functions but will not be re-entered */ 820 820 821 821 static void 822 - ppp_async_input(struct asyncppp *ap, const u8 *buf, const char *flags, 823 - int count) 822 + ppp_async_input(struct asyncppp *ap, const u8 *buf, const u8 *flags, int count) 824 823 { 825 824 struct sk_buff *skb; 826 825 int c, i, j, n, s, f;
+3 -3
drivers/net/ppp/ppp_synctty.c
··· 93 93 static void ppp_sync_process(struct tasklet_struct *t); 94 94 static int ppp_sync_push(struct syncppp *ap); 95 95 static void ppp_sync_flush_output(struct syncppp *ap); 96 - static void ppp_sync_input(struct syncppp *ap, const u8 *buf, const char *flags, 96 + static void ppp_sync_input(struct syncppp *ap, const u8 *buf, const u8 *flags, 97 97 int count); 98 98 99 99 static const struct ppp_channel_ops sync_ops = { ··· 323 323 324 324 /* May sleep, don't call from interrupt level or with interrupts disabled */ 325 325 static void 326 - ppp_sync_receive(struct tty_struct *tty, const u8 *buf, const char *cflags, 326 + ppp_sync_receive(struct tty_struct *tty, const u8 *buf, const u8 *cflags, 327 327 size_t count) 328 328 { 329 329 struct syncppp *ap = sp_get(tty); ··· 655 655 * frame is considered to be in error and is tossed. 656 656 */ 657 657 static void 658 - ppp_sync_input(struct syncppp *ap, const u8 *buf, const char *flags, int count) 658 + ppp_sync_input(struct syncppp *ap, const u8 *buf, const u8 *flags, int count) 659 659 { 660 660 struct sk_buff *skb; 661 661 unsigned char *p;
+2 -2
drivers/net/slip/slip.c
··· 685 685 * in parallel 686 686 */ 687 687 688 - static void slip_receive_buf(struct tty_struct *tty, const u8 *cp, 689 - const char *fp, size_t count) 688 + static void slip_receive_buf(struct tty_struct *tty, const u8 *cp, const u8 *fp, 689 + 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 u8 *cp, 3493 - const char *fp, size_t count) 3493 + const u8 *fp, size_t count) 3494 3494 { 3495 3495 struct gsm_mux *gsm = tty->disc_data; 3496 3496 char flags = TTY_NORMAL;
+1 -1
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, size_t count) 373 + const u8 *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;
+14 -14
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 u8 *cp, 1483 - const unsigned char *fp, size_t count) 1483 + const u8 *fp, size_t count) 1484 1484 { 1485 1485 struct n_tty_data *ldata = tty->disc_data; 1486 1486 unsigned char flag = TTY_NORMAL; ··· 1520 1520 } 1521 1521 1522 1522 static void 1523 - n_tty_receive_buf_raw(struct tty_struct *tty, const u8 *cp, 1524 - const char *fp, int count) 1523 + n_tty_receive_buf_raw(struct tty_struct *tty, const u8 *cp, const u8 *fp, 1524 + int count) 1525 1525 { 1526 1526 struct n_tty_data *ldata = tty->disc_data; 1527 - char flag = TTY_NORMAL; 1527 + u8 flag = TTY_NORMAL; 1528 1528 1529 1529 while (count--) { 1530 1530 if (fp) ··· 1537 1537 } 1538 1538 1539 1539 static void 1540 - n_tty_receive_buf_closing(struct tty_struct *tty, const u8 *cp, 1541 - const char *fp, int count, bool lookahead_done) 1540 + n_tty_receive_buf_closing(struct tty_struct *tty, const u8 *cp, const u8 *fp, 1541 + int count, bool lookahead_done) 1542 1542 { 1543 1543 char flag = TTY_NORMAL; 1544 1544 ··· 1551 1551 } 1552 1552 1553 1553 static void n_tty_receive_buf_standard(struct tty_struct *tty, const u8 *cp, 1554 - const char *fp, int count, 1554 + const u8 *fp, int count, 1555 1555 bool lookahead_done) 1556 1556 { 1557 1557 struct n_tty_data *ldata = tty->disc_data; 1558 - char flag = TTY_NORMAL; 1558 + u8 flag = TTY_NORMAL; 1559 1559 1560 1560 while (count--) { 1561 1561 u8 c = *cp++; ··· 1589 1589 } 1590 1590 } 1591 1591 1592 - static void __receive_buf(struct tty_struct *tty, const u8 *cp, 1593 - const char *fp, int count) 1592 + static void __receive_buf(struct tty_struct *tty, const u8 *cp, const u8 *fp, 1593 + int count) 1594 1594 { 1595 1595 struct n_tty_data *ldata = tty->disc_data; 1596 1596 bool preops = I_ISTRIP(tty) || (I_IUCLC(tty) && L_IEXTEN(tty)); ··· 1664 1664 * publishes commit_head or canon_head 1665 1665 */ 1666 1666 static size_t 1667 - n_tty_receive_buf_common(struct tty_struct *tty, const u8 *cp, 1668 - const char *fp, int count, int flow) 1667 + n_tty_receive_buf_common(struct tty_struct *tty, const u8 *cp, const u8 *fp, 1668 + int count, int flow) 1669 1669 { 1670 1670 struct n_tty_data *ldata = tty->disc_data; 1671 1671 size_t rcvd = 0; ··· 1746 1746 } 1747 1747 1748 1748 static void n_tty_receive_buf(struct tty_struct *tty, const u8 *cp, 1749 - const char *fp, size_t count) 1749 + const u8 *fp, size_t count) 1750 1750 { 1751 1751 n_tty_receive_buf_common(tty, cp, fp, count, 0); 1752 1752 } 1753 1753 1754 1754 static size_t n_tty_receive_buf2(struct tty_struct *tty, const u8 *cp, 1755 - const char *fp, size_t count) 1755 + const u8 *fp, size_t count) 1756 1756 { 1757 1757 return n_tty_receive_buf_common(tty, cp, fp, count, 1); 1758 1758 }
+4 -4
drivers/tty/tty_buffer.c
··· 317 317 * Returns: the number added. 318 318 */ 319 319 int tty_insert_flip_string_fixed_flag(struct tty_port *port, const u8 *chars, 320 - char flag, size_t size) 320 + u8 flag, size_t size) 321 321 { 322 322 int copied = 0; 323 323 bool flags = flag != TTY_NORMAL; ··· 356 356 * Returns: the number added. 357 357 */ 358 358 int tty_insert_flip_string_flags(struct tty_port *port, const u8 *chars, 359 - const char *flags, size_t size) 359 + const u8 *flags, size_t size) 360 360 { 361 361 int copied = 0; 362 362 ··· 390 390 * Queue a single byte @ch to the tty buffering, with an optional flag. This is 391 391 * the slow path of tty_insert_flip_char(). 392 392 */ 393 - int __tty_insert_flip_char(struct tty_port *port, u8 ch, char flag) 393 + int __tty_insert_flip_char(struct tty_port *port, u8 ch, u8 flag) 394 394 { 395 395 struct tty_buffer *tb; 396 396 bool flags = flag != TTY_NORMAL; ··· 449 449 * 450 450 * Returns: the number of bytes processed. 451 451 */ 452 - size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const u8 *p, const char *f, 452 + size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const u8 *p, const u8 *f, 453 453 size_t count) 454 454 { 455 455 if (ld->ops->receive_buf2)
+1 -1
drivers/tty/tty_port.c
··· 34 34 if (!ld) 35 35 return 0; 36 36 37 - count = tty_ldisc_receive_buf(ld, p, (char *)f, count); 37 + count = tty_ldisc_receive_buf(ld, p, f, count); 38 38 39 39 tty_ldisc_deref(ld); 40 40
+2 -2
include/linux/tty_buffer.h
··· 27 27 return ((u8 *)b->data) + ofs; 28 28 } 29 29 30 - static inline char *flag_buf_ptr(struct tty_buffer *b, int ofs) 30 + static inline u8 *flag_buf_ptr(struct tty_buffer *b, int ofs) 31 31 { 32 - return (char *)char_buf_ptr(b, ofs) + b->size; 32 + return char_buf_ptr(b, ofs) + b->size; 33 33 } 34 34 35 35 struct tty_bufhead {
+5 -5
include/linux/tty_flip.h
··· 11 11 unsigned int tty_buffer_space_avail(struct tty_port *port); 12 12 int tty_buffer_request_room(struct tty_port *port, size_t size); 13 13 int tty_insert_flip_string_flags(struct tty_port *port, const u8 *chars, 14 - const char *flags, size_t size); 14 + const u8 *flags, size_t size); 15 15 int tty_insert_flip_string_fixed_flag(struct tty_port *port, const u8 *chars, 16 - char flag, size_t size); 16 + u8 flag, size_t size); 17 17 int tty_prepare_flip_string(struct tty_port *port, u8 **chars, size_t size); 18 18 void tty_flip_buffer_push(struct tty_port *port); 19 - int __tty_insert_flip_char(struct tty_port *port, u8 ch, char flag); 19 + int __tty_insert_flip_char(struct tty_port *port, u8 ch, u8 flag); 20 20 21 - static inline int tty_insert_flip_char(struct tty_port *port, u8 ch, char flag) 21 + static inline int tty_insert_flip_char(struct tty_port *port, u8 ch, u8 flag) 22 22 { 23 23 struct tty_buffer *tb = port->buf.tail; 24 24 int change; ··· 39 39 return tty_insert_flip_string_fixed_flag(port, chars, TTY_NORMAL, size); 40 40 } 41 41 42 - size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const u8 *p, const char *f, 42 + size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const u8 *p, const u8 *f, 43 43 size_t count); 44 44 45 45 void tty_buffer_lock_exclusive(struct tty_port *port);
+6 -6
include/linux/tty_ldisc.h
··· 162 162 * Optional. Can sleep. 163 163 * 164 164 * @receive_buf: [DRV] ``void ()(struct tty_struct *tty, const u8 *cp, 165 - * const char *fp, size_t count)`` 165 + * const u8 *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 ··· 192 192 * Optional. 193 193 * 194 194 * @receive_buf2: [DRV] ``ssize_t ()(struct tty_struct *tty, const u8 *cp, 195 - * const char *fp, size_t count)`` 195 + * const u8 *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, const u8 *cp, 208 - * const char *fp, size_t count)`` 208 + * const u8 *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 u8 *cp, 259 - const char *fp, size_t count); 259 + const u8 *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 262 size_t (*receive_buf2)(struct tty_struct *tty, const u8 *cp, 263 - const char *fp, size_t count); 263 + const u8 *fp, size_t count); 264 264 void (*lookahead_buf)(struct tty_struct *tty, const u8 *cp, 265 - const unsigned char *fp, size_t count); 265 + const u8 *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, size_t count) 299 + const u8 *flags, size_t count) 300 300 { 301 301 struct nci_uart *nu = tty->disc_data; 302 302
+1 -1
sound/soc/codecs/cx20442.c
··· 258 258 } 259 259 260 260 /* Line discipline .receive_buf() */ 261 - static void v253_receive(struct tty_struct *tty, const u8 *cp, const char *fp, 261 + static void v253_receive(struct tty_struct *tty, const u8 *cp, const u8 *fp, 262 262 size_t count) 263 263 { 264 264 struct snd_soc_component *component = tty->disc_data;