Skip to content

Commit a8d9cd2

Browse files
Jiri Slaby (SUSE)gregkh
authored andcommitted
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)" <[email protected]> Cc: William Hubbs <[email protected]> Cc: Chris Brannon <[email protected]> Cc: Kirk Reiser <[email protected]> Cc: Samuel Thibault <[email protected]> Cc: Dmitry Torokhov <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Max Staudt <[email protected]> Cc: Wolfgang Grandegger <[email protected]> Cc: Marc Kleine-Budde <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Paolo Abeni <[email protected]> Cc: Dario Binacchi <[email protected]> Cc: Andreas Koensgen <[email protected]> Cc: Jeremy Kerr <[email protected]> Cc: Matt Johnston <[email protected]> Cc: Liam Girdwood <[email protected]> Cc: Mark Brown <[email protected]> Cc: Jaroslav Kysela <[email protected]> Cc: Takashi Iwai <[email protected]> Cc: Peter Ujfalusi <[email protected]> Acked-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e816144 commit a8d9cd2

File tree

21 files changed

+73
-81
lines changed

21 files changed

+73
-81
lines changed

drivers/accessibility/speakup/spk_ttyio.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,8 @@ static void spk_ttyio_ldisc_close(struct tty_struct *tty)
7171
kfree(tty->disc_data);
7272
}
7373

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)
7776
{
7877
struct spk_ldisc_data *ldisc_data = tty->disc_data;
7978
struct spk_synth *synth = ldisc_data->synth;

drivers/input/serio/serport.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,8 @@ static void serport_ldisc_close(struct tty_struct *tty)
114114
* 'interrupt' routine.
115115
*/
116116

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)
120119
{
121120
struct serport *serport = tty->disc_data;
122121
unsigned long flags;

drivers/misc/ti-st/st_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ static void st_tty_close(struct tty_struct *tty)
791791
pr_debug("%s: done ", __func__);
792792
}
793793

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,
795795
const char *tty_flags, size_t count)
796796
{
797797
#ifdef VERBOSE

drivers/net/can/can327.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ static bool can327_is_valid_rx_char(u8 c)
885885
* This will not be re-entered while running, but other ldisc
886886
* functions may be called in parallel.
887887
*/
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,
889889
const char *fp, size_t count)
890890
{
891891
struct can327 *elm = tty->disc_data;

drivers/net/can/slcan/slcan-core.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,9 +774,8 @@ static const struct net_device_ops slcan_netdev_ops = {
774774
* be re-entered while running but other ldisc functions may be called
775775
* in parallel
776776
*/
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)
780779
{
781780
struct slcan *sl = tty->disc_data;
782781

drivers/net/hamradio/6pack.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,8 @@ static void sixpack_write_wakeup(struct tty_struct *tty)
427427
* a block of 6pack data has been received, which can now be decapsulated
428428
* and sent on to some IP layer for further processing.
429429
*/
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)
432432
{
433433
struct sixpack *sp;
434434
int count1;

drivers/net/hamradio/mkiss.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ static int mkiss_ioctl(struct tty_struct *tty, unsigned int cmd,
874874
* a block of data has been received, which can now be decapsulated
875875
* and sent on to the AX.25 layer for further processing.
876876
*/
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,
878878
const char *fp, size_t count)
879879
{
880880
struct mkiss *ax = mkiss_get(tty);

drivers/net/mctp/mctp-serial.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,7 @@ static void mctp_serial_push(struct mctp_serial *dev, unsigned char c)
390390
}
391391
}
392392

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,
395394
const char *f, size_t len)
396395
{
397396
struct mctp_serial *dev = tty->disc_data;

drivers/net/ppp/ppp_async.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ ppp_asynctty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
330330

331331
/* May sleep, don't call from interrupt level or with interrupts disabled */
332332
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)
335335
{
336336
struct asyncppp *ap = ap_get(tty);
337337
unsigned long flags;
@@ -819,8 +819,8 @@ process_input_packet(struct asyncppp *ap)
819819
other ldisc functions but will not be re-entered */
820820

821821
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)
824824
{
825825
struct sk_buff *skb;
826826
int c, i, j, n, s, f;

drivers/net/ppp/ppp_synctty.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ static int ppp_sync_ioctl(struct ppp_channel *chan, unsigned int cmd,
9393
static void ppp_sync_process(struct tasklet_struct *t);
9494
static int ppp_sync_push(struct syncppp *ap);
9595
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);
9898

9999
static const struct ppp_channel_ops sync_ops = {
100100
.start_xmit = ppp_sync_send,
@@ -323,8 +323,8 @@ ppp_synctty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
323323

324324
/* May sleep, don't call from interrupt level or with interrupts disabled */
325325
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)
328328
{
329329
struct syncppp *ap = sp_get(tty);
330330
unsigned long flags;
@@ -655,8 +655,7 @@ ppp_sync_flush_output(struct syncppp *ap)
655655
* frame is considered to be in error and is tossed.
656656
*/
657657
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)
660659
{
661660
struct sk_buff *skb;
662661
unsigned char *p;

drivers/net/slip/slip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ static void sl_setup(struct net_device *dev)
685685
* in parallel
686686
*/
687687

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,
689689
const char *fp, size_t count)
690690
{
691691
struct slip *sl = tty->disc_data;

drivers/tty/n_gsm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3489,7 +3489,7 @@ static void gsmld_detach_gsm(struct tty_struct *tty, struct gsm_mux *gsm)
34893489
gsm->tty = NULL;
34903490
}
34913491

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,
34933493
const char *fp, size_t count)
34943494
{
34953495
struct gsm_mux *gsm = tty->disc_data;

drivers/tty/n_hdlc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ static void n_hdlc_tty_wakeup(struct tty_struct *tty)
369369
* Called by tty low level driver when receive data is available. Data is
370370
* interpreted as one HDLC frame.
371371
*/
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,
373373
const char *flags, size_t count)
374374
{
375375
register struct n_hdlc *n_hdlc = tty->disc_data;

drivers/tty/n_tty.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,7 @@ n_tty_receive_char_lnext(struct tty_struct *tty, unsigned char c, char flag)
14791479
}
14801480

14811481
/* 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,
14831483
const unsigned char *fp, size_t count)
14841484
{
14851485
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
15001500
}
15011501

15021502
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)
15051505
{
15061506
struct n_tty_data *ldata = tty->disc_data;
15071507
size_t n, head;
@@ -1520,7 +1520,7 @@ n_tty_receive_buf_real_raw(const struct tty_struct *tty,
15201520
}
15211521

15221522
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,
15241524
const char *fp, int count)
15251525
{
15261526
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,
15371537
}
15381538

15391539
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,
15411541
const char *fp, int count, bool lookahead_done)
15421542
{
15431543
char flag = TTY_NORMAL;
@@ -1550,14 +1550,15 @@ n_tty_receive_buf_closing(struct tty_struct *tty, const unsigned char *cp,
15501550
}
15511551
}
15521552

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)
15551556
{
15561557
struct n_tty_data *ldata = tty->disc_data;
15571558
char flag = TTY_NORMAL;
15581559

15591560
while (count--) {
1560-
unsigned char c = *cp++;
1561+
u8 c = *cp++;
15611562

15621563
if (fp)
15631564
flag = *fp++;
@@ -1588,7 +1589,7 @@ static void n_tty_receive_buf_standard(struct tty_struct *tty,
15881589
}
15891590
}
15901591

1591-
static void __receive_buf(struct tty_struct *tty, const unsigned char *cp,
1592+
static void __receive_buf(struct tty_struct *tty, const u8 *cp,
15921593
const char *fp, int count)
15931594
{
15941595
struct n_tty_data *ldata = tty->disc_data;
@@ -1663,7 +1664,7 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp,
16631664
* publishes commit_head or canon_head
16641665
*/
16651666
static size_t
1666-
n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp,
1667+
n_tty_receive_buf_common(struct tty_struct *tty, const u8 *cp,
16671668
const char *fp, int count, int flow)
16681669
{
16691670
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,
17441745
return rcvd;
17451746
}
17461747

1747-
static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
1748+
static void n_tty_receive_buf(struct tty_struct *tty, const u8 *cp,
17481749
const char *fp, size_t count)
17491750
{
17501751
n_tty_receive_buf_common(tty, cp, fp, count, 0);
17511752
}
17521753

1753-
static size_t n_tty_receive_buf2(struct tty_struct *tty,
1754-
const unsigned char *cp, const char *fp,
1755-
size_t count)
1754+
static size_t n_tty_receive_buf2(struct tty_struct *tty, const u8 *cp,
1755+
const char *fp, size_t count)
17561756
{
17571757
return n_tty_receive_buf_common(tty, cp, fp, count, 1);
17581758
}

drivers/tty/tty.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,6 @@ static inline void tty_audit_tiocsti(const struct tty_struct *tty, char ch)
115115
ssize_t redirected_tty_write(struct kiocb *, struct iov_iter *);
116116

117117
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);
119119

120120
#endif

drivers/tty/tty_buffer.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ EXPORT_SYMBOL_GPL(tty_buffer_request_room);
316316
*
317317
* Returns: the number added.
318318
*/
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)
321321
{
322322
int copied = 0;
323323
bool flags = flag != TTY_NORMAL;
@@ -355,8 +355,8 @@ EXPORT_SYMBOL(tty_insert_flip_string_fixed_flag);
355355
*
356356
* Returns: the number added.
357357
*/
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)
360360
{
361361
int copied = 0;
362362

@@ -390,7 +390,7 @@ EXPORT_SYMBOL(tty_insert_flip_string_flags);
390390
* Queue a single byte @ch to the tty buffering, with an optional flag. This is
391391
* the slow path of tty_insert_flip_char().
392392
*/
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)
394394
{
395395
struct tty_buffer *tb;
396396
bool flags = flag != TTY_NORMAL;
@@ -421,8 +421,7 @@ EXPORT_SYMBOL(__tty_insert_flip_char);
421421
* Returns: the length available and buffer pointer (@chars) to the space which
422422
* is now allocated and accounted for as ready for normal characters.
423423
*/
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)
426425
{
427426
int space = __tty_buffer_request_room(port, size, false);
428427

@@ -450,8 +449,8 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string);
450449
*
451450
* Returns: the number of bytes processed.
452451
*/
453-
size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p,
454-
const char *f, size_t count)
452+
size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const u8 *p, const char *f,
453+
size_t count)
455454
{
456455
if (ld->ops->receive_buf2)
457456
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)
489488
}
490489

491490
if (port->client_ops->lookahead_buf) {
492-
unsigned char *p, *f = NULL;
491+
u8 *p, *f = NULL;
493492

494493
p = char_buf_ptr(head, head->lookahead);
495494
if (head->flags)
@@ -620,7 +619,7 @@ EXPORT_SYMBOL(tty_flip_buffer_push);
620619
* Returns: the number added.
621620
*/
622621
int tty_insert_flip_string_and_push_buffer(struct tty_port *port,
623-
const unsigned char *chars, size_t size)
622+
const u8 *chars, size_t size)
624623
{
625624
struct tty_bufhead *buf = &port->buf;
626625
unsigned long flags;

include/linux/tty_buffer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ struct tty_buffer {
2222
unsigned long data[];
2323
};
2424

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)
2626
{
27-
return ((unsigned char *)b->data) + ofs;
27+
return ((u8 *)b->data) + ofs;
2828
}
2929

3030
static inline char *flag_buf_ptr(struct tty_buffer *b, int ofs)

include/linux/tty_flip.h

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,15 @@ struct tty_ldisc;
1010
int tty_buffer_set_limit(struct tty_port *port, int limit);
1111
unsigned int tty_buffer_space_avail(struct tty_port *port);
1212
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);
1918
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);
2120

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)
2422
{
2523
struct tty_buffer *tb = port->buf.tail;
2624
int change;
@@ -36,13 +34,13 @@ static inline int tty_insert_flip_char(struct tty_port *port,
3634
}
3735

3836
static inline int tty_insert_flip_string(struct tty_port *port,
39-
const unsigned char *chars, size_t size)
37+
const u8 *chars, size_t size)
4038
{
4139
return tty_insert_flip_string_fixed_flag(port, chars, TTY_NORMAL, size);
4240
}
4341

44-
size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p,
45-
const char *f, size_t count);
42+
size_t tty_ldisc_receive_buf(struct tty_ldisc *ld, const u8 *p, const char *f,
43+
size_t count);
4644

4745
void tty_buffer_lock_exclusive(struct tty_port *port);
4846
void tty_buffer_unlock_exclusive(struct tty_port *port);

0 commit comments

Comments
 (0)