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: 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)" <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: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Max Staudt <max@enpas.org>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.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: 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: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230810091510.13006-17-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

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

+73 -81
+2 -3
drivers/accessibility/speakup/spk_ttyio.c
··· 71 71 kfree(tty->disc_data); 72 72 } 73 73 74 - static size_t spk_ttyio_receive_buf2(struct tty_struct *tty, 75 - const unsigned char *cp, const char *fp, 76 - size_t count) 74 + static size_t spk_ttyio_receive_buf2(struct tty_struct *tty, const u8 *cp, 75 + const char *fp, size_t count) 77 76 { 78 77 struct spk_ldisc_data *ldisc_data = tty->disc_data; 79 78 struct spk_synth *synth = ldisc_data->synth;
+2 -3
drivers/input/serio/serport.c
··· 114 114 * 'interrupt' routine. 115 115 */ 116 116 117 - static void serport_ldisc_receive(struct tty_struct *tty, 118 - const unsigned char *cp, const char *fp, 119 - size_t count) 117 + static void serport_ldisc_receive(struct tty_struct *tty, const u8 *cp, 118 + const char *fp, size_t count) 120 119 { 121 120 struct serport *serport = tty->disc_data; 122 121 unsigned long flags;
+1 -1
drivers/misc/ti-st/st_core.c
··· 791 791 pr_debug("%s: done ", __func__); 792 792 } 793 793 794 - static void st_tty_receive(struct tty_struct *tty, const unsigned char *data, 794 + static void st_tty_receive(struct tty_struct *tty, const u8 *data, 795 795 const char *tty_flags, size_t count) 796 796 { 797 797 #ifdef VERBOSE
+1 -1
drivers/net/can/can327.c
··· 885 885 * This will not be re-entered while running, but other ldisc 886 886 * functions may be called in parallel. 887 887 */ 888 - static void can327_ldisc_rx(struct tty_struct *tty, const unsigned char *cp, 888 + static void can327_ldisc_rx(struct tty_struct *tty, const u8 *cp, 889 889 const char *fp, size_t count) 890 890 { 891 891 struct can327 *elm = tty->disc_data;
+2 -3
drivers/net/can/slcan/slcan-core.c
··· 774 774 * be re-entered while running but other ldisc functions may be called 775 775 * in parallel 776 776 */ 777 - static void slcan_receive_buf(struct tty_struct *tty, 778 - const unsigned char *cp, const char *fp, 779 - size_t count) 777 + static void slcan_receive_buf(struct tty_struct *tty, const u8 *cp, 778 + const char *fp, size_t count) 780 779 { 781 780 struct slcan *sl = tty->disc_data; 782 781
+2 -2
drivers/net/hamradio/6pack.c
··· 427 427 * a block of 6pack data has been received, which can now be decapsulated 428 428 * and sent on to some IP layer for further processing. 429 429 */ 430 - static void sixpack_receive_buf(struct tty_struct *tty, 431 - const unsigned char *cp, const char *fp, size_t count) 430 + static void sixpack_receive_buf(struct tty_struct *tty, const u8 *cp, 431 + const char *fp, size_t count) 432 432 { 433 433 struct sixpack *sp; 434 434 int count1;
+1 -1
drivers/net/hamradio/mkiss.c
··· 874 874 * a block of data has been received, which can now be decapsulated 875 875 * and sent on to the AX.25 layer for further processing. 876 876 */ 877 - static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp, 877 + static void mkiss_receive_buf(struct tty_struct *tty, const u8 *cp, 878 878 const char *fp, size_t count) 879 879 { 880 880 struct mkiss *ax = mkiss_get(tty);
+1 -2
drivers/net/mctp/mctp-serial.c
··· 390 390 } 391 391 } 392 392 393 - static void mctp_serial_tty_receive_buf(struct tty_struct *tty, 394 - const unsigned char *c, 393 + static void mctp_serial_tty_receive_buf(struct tty_struct *tty, const u8 *c, 395 394 const char *f, size_t len) 396 395 { 397 396 struct mctp_serial *dev = tty->disc_data;
+4 -4
drivers/net/ppp/ppp_async.c
··· 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 unsigned char *buf, 334 - const char *cflags, size_t count) 333 + ppp_asynctty_receive(struct tty_struct *tty, const u8 *buf, const char *cflags, 334 + size_t count) 335 335 { 336 336 struct asyncppp *ap = ap_get(tty); 337 337 unsigned long flags; ··· 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 unsigned char *buf, 823 - const char *flags, int count) 822 + ppp_async_input(struct asyncppp *ap, const u8 *buf, const char *flags, 823 + int count) 824 824 { 825 825 struct sk_buff *skb; 826 826 int c, i, j, n, s, f;
+5 -6
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 unsigned char *buf, 97 - const char *flags, int count); 96 + static void ppp_sync_input(struct syncppp *ap, const u8 *buf, const char *flags, 97 + int count); 98 98 99 99 static const struct ppp_channel_ops sync_ops = { 100 100 .start_xmit = ppp_sync_send, ··· 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 unsigned char *buf, 327 - const char *cflags, size_t count) 326 + ppp_sync_receive(struct tty_struct *tty, const u8 *buf, const char *cflags, 327 + size_t count) 328 328 { 329 329 struct syncppp *ap = sp_get(tty); 330 330 unsigned long flags; ··· 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 unsigned char *buf, 659 - const char *flags, int count) 658 + ppp_sync_input(struct syncppp *ap, const u8 *buf, const char *flags, int count) 660 659 { 661 660 struct sk_buff *skb; 662 661 unsigned char *p;
+1 -1
drivers/net/slip/slip.c
··· 685 685 * in parallel 686 686 */ 687 687 688 - static void slip_receive_buf(struct tty_struct *tty, const unsigned char *cp, 688 + static void slip_receive_buf(struct tty_struct *tty, const u8 *cp, 689 689 const char *fp, size_t count) 690 690 { 691 691 struct slip *sl = tty->disc_data;
+1 -1
drivers/tty/n_gsm.c
··· 3489 3489 gsm->tty = NULL; 3490 3490 } 3491 3491 3492 - static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp, 3492 + static void gsmld_receive_buf(struct tty_struct *tty, const u8 *cp, 3493 3493 const char *fp, size_t count) 3494 3494 { 3495 3495 struct gsm_mux *gsm = tty->disc_data;
+1 -1
drivers/tty/n_hdlc.c
··· 369 369 * Called by tty low level driver when receive data is available. Data is 370 370 * interpreted as one HDLC frame. 371 371 */ 372 - static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data, 372 + static void n_hdlc_tty_receive(struct tty_struct *tty, const u8 *data, 373 373 const char *flags, size_t count) 374 374 { 375 375 register struct n_hdlc *n_hdlc = tty->disc_data;
+14 -14
drivers/tty/n_tty.c
··· 1479 1479 } 1480 1480 1481 1481 /* Caller must ensure count > 0 */ 1482 - static void n_tty_lookahead_flow_ctrl(struct tty_struct *tty, const unsigned char *cp, 1482 + static void n_tty_lookahead_flow_ctrl(struct tty_struct *tty, const u8 *cp, 1483 1483 const unsigned char *fp, size_t count) 1484 1484 { 1485 1485 struct n_tty_data *ldata = tty->disc_data; ··· 1500 1500 } 1501 1501 1502 1502 static void 1503 - n_tty_receive_buf_real_raw(const struct tty_struct *tty, 1504 - const unsigned char *cp, int count) 1503 + n_tty_receive_buf_real_raw(const struct tty_struct *tty, const u8 *cp, 1504 + int count) 1505 1505 { 1506 1506 struct n_tty_data *ldata = tty->disc_data; 1507 1507 size_t n, head; ··· 1520 1520 } 1521 1521 1522 1522 static void 1523 - n_tty_receive_buf_raw(struct tty_struct *tty, const unsigned char *cp, 1523 + n_tty_receive_buf_raw(struct tty_struct *tty, const u8 *cp, 1524 1524 const char *fp, int count) 1525 1525 { 1526 1526 struct n_tty_data *ldata = tty->disc_data; ··· 1537 1537 } 1538 1538 1539 1539 static void 1540 - n_tty_receive_buf_closing(struct tty_struct *tty, const unsigned char *cp, 1540 + n_tty_receive_buf_closing(struct tty_struct *tty, const u8 *cp, 1541 1541 const char *fp, int count, bool lookahead_done) 1542 1542 { 1543 1543 char flag = TTY_NORMAL; ··· 1550 1550 } 1551 1551 } 1552 1552 1553 - static void n_tty_receive_buf_standard(struct tty_struct *tty, 1554 - const unsigned char *cp, const char *fp, int count, bool lookahead_done) 1553 + static void n_tty_receive_buf_standard(struct tty_struct *tty, const u8 *cp, 1554 + const char *fp, int count, 1555 + bool lookahead_done) 1555 1556 { 1556 1557 struct n_tty_data *ldata = tty->disc_data; 1557 1558 char flag = TTY_NORMAL; 1558 1559 1559 1560 while (count--) { 1560 - unsigned char c = *cp++; 1561 + u8 c = *cp++; 1561 1562 1562 1563 if (fp) 1563 1564 flag = *fp++; ··· 1589 1588 } 1590 1589 } 1591 1590 1592 - static void __receive_buf(struct tty_struct *tty, const unsigned char *cp, 1591 + static void __receive_buf(struct tty_struct *tty, const u8 *cp, 1593 1592 const char *fp, int count) 1594 1593 { 1595 1594 struct n_tty_data *ldata = tty->disc_data; ··· 1664 1663 * publishes commit_head or canon_head 1665 1664 */ 1666 1665 static size_t 1667 - n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp, 1666 + n_tty_receive_buf_common(struct tty_struct *tty, const u8 *cp, 1668 1667 const char *fp, int count, int flow) 1669 1668 { 1670 1669 struct n_tty_data *ldata = tty->disc_data; ··· 1745 1744 return rcvd; 1746 1745 } 1747 1746 1748 - static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp, 1747 + static void n_tty_receive_buf(struct tty_struct *tty, const u8 *cp, 1749 1748 const char *fp, size_t count) 1750 1749 { 1751 1750 n_tty_receive_buf_common(tty, cp, fp, count, 0); 1752 1751 } 1753 1752 1754 - static size_t n_tty_receive_buf2(struct tty_struct *tty, 1755 - const unsigned char *cp, const char *fp, 1756 - size_t count) 1753 + static size_t n_tty_receive_buf2(struct tty_struct *tty, const u8 *cp, 1754 + const char *fp, size_t count) 1757 1755 { 1758 1756 return n_tty_receive_buf_common(tty, cp, fp, count, 1); 1759 1757 }
+1 -1
drivers/tty/tty.h
··· 115 115 ssize_t redirected_tty_write(struct kiocb *, struct iov_iter *); 116 116 117 117 int tty_insert_flip_string_and_push_buffer(struct tty_port *port, 118 - const unsigned char *chars, size_t cnt); 118 + const u8 *chars, size_t cnt); 119 119 120 120 #endif
+10 -11
drivers/tty/tty_buffer.c
··· 316 316 * 317 317 * Returns: the number added. 318 318 */ 319 - int tty_insert_flip_string_fixed_flag(struct tty_port *port, 320 - const unsigned char *chars, char flag, size_t size) 319 + int tty_insert_flip_string_fixed_flag(struct tty_port *port, const u8 *chars, 320 + char flag, size_t size) 321 321 { 322 322 int copied = 0; 323 323 bool flags = flag != TTY_NORMAL; ··· 355 355 * 356 356 * Returns: the number added. 357 357 */ 358 - int tty_insert_flip_string_flags(struct tty_port *port, 359 - const unsigned char *chars, const char *flags, size_t size) 358 + int tty_insert_flip_string_flags(struct tty_port *port, const u8 *chars, 359 + const char *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, unsigned char ch, char flag) 393 + int __tty_insert_flip_char(struct tty_port *port, u8 ch, char flag) 394 394 { 395 395 struct tty_buffer *tb; 396 396 bool flags = flag != TTY_NORMAL; ··· 421 421 * Returns: the length available and buffer pointer (@chars) to the space which 422 422 * is now allocated and accounted for as ready for normal characters. 423 423 */ 424 - int tty_prepare_flip_string(struct tty_port *port, unsigned char **chars, 425 - size_t size) 424 + int tty_prepare_flip_string(struct tty_port *port, u8 **chars, size_t size) 426 425 { 427 426 int space = __tty_buffer_request_room(port, size, false); 428 427 ··· 449 450 * 450 451 * Returns: the number of bytes processed. 451 452 */ 452 - size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p, 453 - const char *f, size_t count) 453 + size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const u8 *p, const char *f, 454 + size_t count) 454 455 { 455 456 if (ld->ops->receive_buf2) 456 457 count = ld->ops->receive_buf2(ld->tty, p, f, count); ··· 488 489 } 489 490 490 491 if (port->client_ops->lookahead_buf) { 491 - unsigned char *p, *f = NULL; 492 + u8 *p, *f = NULL; 492 493 493 494 p = char_buf_ptr(head, head->lookahead); 494 495 if (head->flags) ··· 619 620 * Returns: the number added. 620 621 */ 621 622 int tty_insert_flip_string_and_push_buffer(struct tty_port *port, 622 - const unsigned char *chars, size_t size) 623 + const u8 *chars, size_t size) 623 624 { 624 625 struct tty_bufhead *buf = &port->buf; 625 626 unsigned long flags;
+2 -2
include/linux/tty_buffer.h
··· 22 22 unsigned long data[]; 23 23 }; 24 24 25 - static inline unsigned char *char_buf_ptr(struct tty_buffer *b, int ofs) 25 + static inline u8 *char_buf_ptr(struct tty_buffer *b, int ofs) 26 26 { 27 - return ((unsigned char *)b->data) + ofs; 27 + return ((u8 *)b->data) + ofs; 28 28 } 29 29 30 30 static inline char *flag_buf_ptr(struct tty_buffer *b, int ofs)
+10 -12
include/linux/tty_flip.h
··· 10 10 int tty_buffer_set_limit(struct tty_port *port, int limit); 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 - int tty_insert_flip_string_flags(struct tty_port *port, 14 - const unsigned char *chars, const char *flags, size_t size); 15 - int tty_insert_flip_string_fixed_flag(struct tty_port *port, 16 - const unsigned char *chars, char flag, size_t size); 17 - int tty_prepare_flip_string(struct tty_port *port, unsigned char **chars, 18 - size_t size); 13 + int tty_insert_flip_string_flags(struct tty_port *port, const u8 *chars, 14 + const char *flags, size_t size); 15 + int tty_insert_flip_string_fixed_flag(struct tty_port *port, const u8 *chars, 16 + char flag, size_t size); 17 + int tty_prepare_flip_string(struct tty_port *port, u8 **chars, size_t size); 19 18 void tty_flip_buffer_push(struct tty_port *port); 20 - int __tty_insert_flip_char(struct tty_port *port, unsigned char ch, char flag); 19 + int __tty_insert_flip_char(struct tty_port *port, u8 ch, char flag); 21 20 22 - static inline int tty_insert_flip_char(struct tty_port *port, 23 - unsigned char ch, char flag) 21 + static inline int tty_insert_flip_char(struct tty_port *port, u8 ch, char flag) 24 22 { 25 23 struct tty_buffer *tb = port->buf.tail; 26 24 int change; ··· 34 36 } 35 37 36 38 static inline int tty_insert_flip_string(struct tty_port *port, 37 - const unsigned char *chars, size_t size) 39 + const u8 *chars, size_t size) 38 40 { 39 41 return tty_insert_flip_string_fixed_flag(port, chars, TTY_NORMAL, size); 40 42 } 41 43 42 - size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p, 43 - const char *f, size_t count); 44 + size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const u8 *p, const char *f, 45 + size_t count); 44 46 45 47 void tty_buffer_lock_exclusive(struct tty_port *port); 46 48 void tty_buffer_unlock_exclusive(struct tty_port *port);
+9 -9
include/linux/tty_ldisc.h
··· 161 161 * 162 162 * Optional. Can sleep. 163 163 * 164 - * @receive_buf: [DRV] ``void ()(struct tty_struct *tty, 165 - * const unsigned char *cp, const char *fp, size_t count)`` 164 + * @receive_buf: [DRV] ``void ()(struct tty_struct *tty, const u8 *cp, 165 + * 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] ``ssize_t ()(struct tty_struct *tty, 195 - * const unsigned char *cp, const char *fp, size_t count)`` 194 + * @receive_buf2: [DRV] ``ssize_t ()(struct tty_struct *tty, const u8 *cp, 195 + * 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 ··· 204 204 * 205 205 * Optional. 206 206 * 207 - * @lookahead_buf: [DRV] ``void ()(struct tty_struct *tty, 208 - * const unsigned char *cp, const char *fp, size_t count)`` 207 + * @lookahead_buf: [DRV] ``void ()(struct tty_struct *tty, const u8 *cp, 208 + * 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 ··· 255 255 /* 256 256 * The following routines are called from below. 257 257 */ 258 - void (*receive_buf)(struct tty_struct *tty, const unsigned char *cp, 258 + void (*receive_buf)(struct tty_struct *tty, const u8 *cp, 259 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 - size_t (*receive_buf2)(struct tty_struct *tty, const unsigned char *cp, 262 + size_t (*receive_buf2)(struct tty_struct *tty, const u8 *cp, 263 263 const char *fp, size_t count); 264 - void (*lookahead_buf)(struct tty_struct *tty, const unsigned char *cp, 264 + void (*lookahead_buf)(struct tty_struct *tty, const u8 *cp, 265 265 const unsigned char *fp, size_t count); 266 266 267 267 struct module *owner;
+2 -2
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 unsigned char *cp, 262 - const char *fp, size_t count) 261 + static void v253_receive(struct tty_struct *tty, const u8 *cp, const char *fp, 262 + size_t count) 263 263 { 264 264 struct snd_soc_component *component = tty->disc_data; 265 265 struct cx20442_priv *cx20442;
+1 -1
sound/soc/ti/ams-delta.c
··· 336 336 } 337 337 338 338 /* Line discipline .receive_buf() */ 339 - static void cx81801_receive(struct tty_struct *tty, const unsigned char *cp, 339 + static void cx81801_receive(struct tty_struct *tty, const u8 *cp, 340 340 const char *fp, int count) 341 341 { 342 342 struct snd_soc_component *component = tty->disc_data;