Skip to content

Commit 892bc20

Browse files
Jiri Slaby (SUSE)gregkh
authored andcommitted
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)" <[email protected]> Cc: William Hubbs <[email protected]> Cc: Chris Brannon <[email protected]> Cc: Kirk Reiser <[email protected]> Cc: Samuel Thibault <[email protected]> Cc: Marcel Holtmann <[email protected]> Cc: Johan Hedberg <[email protected]> Cc: Luiz Augusto von Dentz <[email protected]> Cc: Dmitry Torokhov <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Paolo Abeni <[email protected]> Cc: Max Staudt <[email protected]> Cc: Wolfgang Grandegger <[email protected]> Cc: Marc Kleine-Budde <[email protected]> Cc: Dario Binacchi <[email protected]> Cc: Andreas Koensgen <[email protected]> Cc: Jeremy Kerr <[email protected]> Cc: Matt Johnston <[email protected]> Cc: Krzysztof Kozlowski <[email protected]> Cc: Liam Girdwood <[email protected]> Cc: Mark Brown <[email protected]> Cc: Jaroslav Kysela <[email protected]> Cc: Takashi Iwai <[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 a8d9cd2 commit 892bc20

File tree

23 files changed

+54
-55
lines changed

23 files changed

+54
-55
lines changed

drivers/accessibility/speakup/spk_ttyio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static void spk_ttyio_ldisc_close(struct tty_struct *tty)
7272
}
7373

7474
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)
7676
{
7777
struct spk_ldisc_data *ldisc_data = tty->disc_data;
7878
struct spk_synth *synth = ldisc_data->synth;

drivers/bluetooth/hci_ldisc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty)
599599
* Return Value: None
600600
*/
601601
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)
603603
{
604604
struct hci_uart *hu = tty->disc_data;
605605

drivers/input/serio/serport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static void serport_ldisc_close(struct tty_struct *tty)
115115
*/
116116

117117
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)
119119
{
120120
struct serport *serport = tty->disc_data;
121121
unsigned long flags;

drivers/misc/ti-st/st_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ static void st_tty_close(struct tty_struct *tty)
792792
}
793793

794794
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)
796796
{
797797
#ifdef VERBOSE
798798
print_hex_dump(KERN_DEBUG, ">in>", DUMP_PREFIX_NONE,

drivers/net/caif/caif_serial.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static inline void debugfs_tx(struct ser_device *ser, const u8 *data, int size)
159159
#endif
160160

161161
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)
163163
{
164164
struct sk_buff *skb = NULL;
165165
struct ser_device *ser;

drivers/net/can/can327.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ static bool can327_is_valid_rx_char(u8 c)
886886
* functions may be called in parallel.
887887
*/
888888
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)
890890
{
891891
struct can327 *elm = tty->disc_data;
892892
size_t first_new_char_idx;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ static const struct net_device_ops slcan_netdev_ops = {
775775
* in parallel
776776
*/
777777
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)
779779
{
780780
struct slcan *sl = tty->disc_data;
781781

drivers/net/hamradio/6pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ static void sixpack_write_wakeup(struct tty_struct *tty)
428428
* and sent on to some IP layer for further processing.
429429
*/
430430
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)
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
@@ -875,7 +875,7 @@ static int mkiss_ioctl(struct tty_struct *tty, unsigned int cmd,
875875
* and sent on to the AX.25 layer for further processing.
876876
*/
877877
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)
879879
{
880880
struct mkiss *ax = mkiss_get(tty);
881881

drivers/net/mctp/mctp-serial.c

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

393393
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)
395395
{
396396
struct mctp_serial *dev = tty->disc_data;
397397
int i;

drivers/net/ppp/ppp_async.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static int ppp_async_send(struct ppp_channel *chan, struct sk_buff *skb);
9898
static int ppp_async_push(struct asyncppp *ap);
9999
static void ppp_async_flush_output(struct asyncppp *ap);
100100
static void ppp_async_input(struct asyncppp *ap, const unsigned char *buf,
101-
const char *flags, int count);
101+
const u8 *flags, int count);
102102
static int ppp_async_ioctl(struct ppp_channel *chan, unsigned int cmd,
103103
unsigned long arg);
104104
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)
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 u8 *buf, const char *cflags,
333+
ppp_asynctty_receive(struct tty_struct *tty, const u8 *buf, const u8 *cflags,
334334
size_t count)
335335
{
336336
struct asyncppp *ap = ap_get(tty);
@@ -819,8 +819,7 @@ 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 u8 *buf, const char *flags,
823-
int count)
822+
ppp_async_input(struct asyncppp *ap, const u8 *buf, const u8 *flags, int count)
824823
{
825824
struct sk_buff *skb;
826825
int c, i, j, n, s, f;

drivers/net/ppp/ppp_synctty.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ 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 u8 *buf, const char *flags,
96+
static void ppp_sync_input(struct syncppp *ap, const u8 *buf, const u8 *flags,
9797
int count);
9898

9999
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)
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 u8 *buf, const char *cflags,
326+
ppp_sync_receive(struct tty_struct *tty, const u8 *buf, const u8 *cflags,
327327
size_t count)
328328
{
329329
struct syncppp *ap = sp_get(tty);
@@ -655,7 +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 u8 *buf, const char *flags, int count)
658+
ppp_sync_input(struct syncppp *ap, const u8 *buf, const u8 *flags, int count)
659659
{
660660
struct sk_buff *skb;
661661
unsigned char *p;

drivers/net/slip/slip.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,8 @@ static void sl_setup(struct net_device *dev)
685685
* in parallel
686686
*/
687687

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)
690690
{
691691
struct slip *sl = tty->disc_data;
692692

drivers/tty/n_gsm.c

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

34923492
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)
34943494
{
34953495
struct gsm_mux *gsm = tty->disc_data;
34963496
char flags = TTY_NORMAL;

drivers/tty/n_hdlc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ static void n_hdlc_tty_wakeup(struct tty_struct *tty)
370370
* interpreted as one HDLC frame.
371371
*/
372372
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)
374374
{
375375
register struct n_hdlc *n_hdlc = tty->disc_data;
376376
register struct n_hdlc_buf *buf;

drivers/tty/n_tty.c

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

14811481
/* Caller must ensure count > 0 */
14821482
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)
14841484
{
14851485
struct n_tty_data *ldata = tty->disc_data;
14861486
unsigned char flag = TTY_NORMAL;
@@ -1520,11 +1520,11 @@ n_tty_receive_buf_real_raw(const struct tty_struct *tty, const u8 *cp,
15201520
}
15211521

15221522
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)
15251525
{
15261526
struct n_tty_data *ldata = tty->disc_data;
1527-
char flag = TTY_NORMAL;
1527+
u8 flag = TTY_NORMAL;
15281528

15291529
while (count--) {
15301530
if (fp)
@@ -1537,8 +1537,8 @@ n_tty_receive_buf_raw(struct tty_struct *tty, const u8 *cp,
15371537
}
15381538

15391539
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)
15421542
{
15431543
char flag = TTY_NORMAL;
15441544

@@ -1551,11 +1551,11 @@ n_tty_receive_buf_closing(struct tty_struct *tty, const u8 *cp,
15511551
}
15521552

15531553
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,
15551555
bool lookahead_done)
15561556
{
15571557
struct n_tty_data *ldata = tty->disc_data;
1558-
char flag = TTY_NORMAL;
1558+
u8 flag = TTY_NORMAL;
15591559

15601560
while (count--) {
15611561
u8 c = *cp++;
@@ -1589,8 +1589,8 @@ static void n_tty_receive_buf_standard(struct tty_struct *tty, const u8 *cp,
15891589
}
15901590
}
15911591

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)
15941594
{
15951595
struct n_tty_data *ldata = tty->disc_data;
15961596
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,
16641664
* publishes commit_head or canon_head
16651665
*/
16661666
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)
16691669
{
16701670
struct n_tty_data *ldata = tty->disc_data;
16711671
size_t rcvd = 0;
@@ -1746,13 +1746,13 @@ n_tty_receive_buf_common(struct tty_struct *tty, const u8 *cp,
17461746
}
17471747

17481748
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)
17501750
{
17511751
n_tty_receive_buf_common(tty, cp, fp, count, 0);
17521752
}
17531753

17541754
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)
17561756
{
17571757
return n_tty_receive_buf_common(tty, cp, fp, count, 1);
17581758
}

drivers/tty/tty_buffer.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ EXPORT_SYMBOL_GPL(tty_buffer_request_room);
317317
* Returns: the number added.
318318
*/
319319
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)
321321
{
322322
int copied = 0;
323323
bool flags = flag != TTY_NORMAL;
@@ -356,7 +356,7 @@ EXPORT_SYMBOL(tty_insert_flip_string_fixed_flag);
356356
* Returns: the number added.
357357
*/
358358
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)
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, u8 ch, char flag)
393+
int __tty_insert_flip_char(struct tty_port *port, u8 ch, u8 flag)
394394
{
395395
struct tty_buffer *tb;
396396
bool flags = flag != TTY_NORMAL;
@@ -449,7 +449,7 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string);
449449
*
450450
* Returns: the number of bytes processed.
451451
*/
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,
453453
size_t count)
454454
{
455455
if (ld->ops->receive_buf2)

drivers/tty/tty_port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static size_t tty_port_default_receive_buf(struct tty_port *port, const u8 *p,
3434
if (!ld)
3535
return 0;
3636

37-
count = tty_ldisc_receive_buf(ld, p, (char *)f, count);
37+
count = tty_ldisc_receive_buf(ld, p, f, count);
3838

3939
tty_ldisc_deref(ld);
4040

include/linux/tty_buffer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ static inline u8 *char_buf_ptr(struct tty_buffer *b, int ofs)
2727
return ((u8 *)b->data) + ofs;
2828
}
2929

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)
3131
{
32-
return (char *)char_buf_ptr(b, ofs) + b->size;
32+
return char_buf_ptr(b, ofs) + b->size;
3333
}
3434

3535
struct tty_bufhead {

include/linux/tty_flip.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ 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);
1313
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);
1515
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);
1717
int tty_prepare_flip_string(struct tty_port *port, u8 **chars, size_t size);
1818
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);
2020

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)
2222
{
2323
struct tty_buffer *tb = port->buf.tail;
2424
int change;
@@ -39,7 +39,7 @@ static inline int tty_insert_flip_string(struct tty_port *port,
3939
return tty_insert_flip_string_fixed_flag(port, chars, TTY_NORMAL, size);
4040
}
4141

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,
4343
size_t count);
4444

4545
void tty_buffer_lock_exclusive(struct tty_port *port);

include/linux/tty_ldisc.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass,
162162
* Optional. Can sleep.
163163
*
164164
* @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)``
166166
*
167167
* This function is called by the low-level tty driver to send characters
168168
* 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,
192192
* Optional.
193193
*
194194
* @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)``
196196
*
197197
* This function is called by the low-level tty driver to send characters
198198
* 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,
205205
* Optional.
206206
*
207207
* @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)``
209209
*
210210
* This function is called by the low-level tty driver for characters
211211
* not eaten by ->receive_buf() or ->receive_buf2(). It is useful for
@@ -256,13 +256,13 @@ struct tty_ldisc_ops {
256256
* The following routines are called from below.
257257
*/
258258
void (*receive_buf)(struct tty_struct *tty, const u8 *cp,
259-
const char *fp, size_t count);
259+
const u8 *fp, size_t count);
260260
void (*write_wakeup)(struct tty_struct *tty);
261261
void (*dcd_change)(struct tty_struct *tty, bool active);
262262
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);
264264
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);
266266

267267
struct module *owner;
268268
};

net/nfc/nci/uart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ static int nci_uart_default_recv_buf(struct nci_uart *nu, const u8 *data,
296296
* Return Value: None
297297
*/
298298
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)
300300
{
301301
struct nci_uart *nu = tty->disc_data;
302302

0 commit comments

Comments
 (0)