@@ -109,9 +109,9 @@ struct n_tty_data {
109109 unsigned char push :1 ;
110110
111111 /* shared by producer and consumer */
112- char read_buf [N_TTY_BUF_SIZE ];
112+ u8 read_buf [N_TTY_BUF_SIZE ];
113113 DECLARE_BITMAP (read_flags , N_TTY_BUF_SIZE );
114- unsigned char echo_buf [N_TTY_BUF_SIZE ];
114+ u8 echo_buf [N_TTY_BUF_SIZE ];
115115
116116 /* consumer-published */
117117 size_t read_tail ;
@@ -136,23 +136,23 @@ static inline size_t read_cnt(struct n_tty_data *ldata)
136136 return ldata -> read_head - ldata -> read_tail ;
137137}
138138
139- static inline unsigned char read_buf (struct n_tty_data * ldata , size_t i )
139+ static inline u8 read_buf (struct n_tty_data * ldata , size_t i )
140140{
141141 return ldata -> read_buf [MASK (i )];
142142}
143143
144- static inline unsigned char * read_buf_addr (struct n_tty_data * ldata , size_t i )
144+ static inline u8 * read_buf_addr (struct n_tty_data * ldata , size_t i )
145145{
146146 return & ldata -> read_buf [MASK (i )];
147147}
148148
149- static inline unsigned char echo_buf (struct n_tty_data * ldata , size_t i )
149+ static inline u8 echo_buf (struct n_tty_data * ldata , size_t i )
150150{
151151 smp_rmb (); /* Matches smp_wmb() in add_echo_byte(). */
152152 return ldata -> echo_buf [MASK (i )];
153153}
154154
155- static inline unsigned char * echo_buf_addr (struct n_tty_data * ldata , size_t i )
155+ static inline u8 * echo_buf_addr (struct n_tty_data * ldata , size_t i )
156156{
157157 return & ldata -> echo_buf [MASK (i )];
158158}
@@ -303,7 +303,7 @@ static void n_tty_check_unthrottle(struct tty_struct *tty)
303303 * * n_tty_receive_buf()/producer path:
304304 * caller holds non-exclusive %termios_rwsem
305305 */
306- static inline void put_tty_queue (unsigned char c , struct n_tty_data * ldata )
306+ static inline void put_tty_queue (u8 c , struct n_tty_data * ldata )
307307{
308308 * read_buf_addr (ldata , ldata -> read_head ) = c ;
309309 ldata -> read_head ++ ;
@@ -377,7 +377,7 @@ static void n_tty_flush_buffer(struct tty_struct *tty)
377377 * character. We use this to correctly compute the on-screen size of the
378378 * character when printing.
379379 */
380- static inline int is_utf8_continuation (unsigned char c )
380+ static inline int is_utf8_continuation (u8 c )
381381{
382382 return (c & 0xc0 ) == 0x80 ;
383383}
@@ -390,7 +390,7 @@ static inline int is_utf8_continuation(unsigned char c)
390390 * Returns: true if the utf8 character @c is a multibyte continuation character
391391 * and the terminal is in unicode mode.
392392 */
393- static inline int is_continuation (unsigned char c , const struct tty_struct * tty )
393+ static inline int is_continuation (u8 c , const struct tty_struct * tty )
394394{
395395 return I_IUTF8 (tty ) && is_utf8_continuation (c );
396396}
@@ -414,7 +414,7 @@ static inline int is_continuation(unsigned char c, const struct tty_struct *tty)
414414 * Locking: should be called under the %output_lock to protect the column state
415415 * and space left in the buffer.
416416 */
417- static int do_output_char (unsigned char c , struct tty_struct * tty , int space )
417+ static int do_output_char (u8 c , struct tty_struct * tty , int space )
418418{
419419 struct n_tty_data * ldata = tty -> disc_data ;
420420 int spaces ;
@@ -488,7 +488,7 @@ static int do_output_char(unsigned char c, struct tty_struct *tty, int space)
488488 * Locking: %output_lock to protect column state and space left (also, this is
489489 *called from n_tty_write() under the tty layer write lock).
490490 */
491- static int process_output (unsigned char c , struct tty_struct * tty )
491+ static int process_output (u8 c , struct tty_struct * tty )
492492{
493493 struct n_tty_data * ldata = tty -> disc_data ;
494494 int space , retval ;
@@ -524,12 +524,12 @@ static int process_output(unsigned char c, struct tty_struct *tty)
524524 * called from n_tty_write() under the tty layer write lock).
525525 */
526526static ssize_t process_output_block (struct tty_struct * tty ,
527- const unsigned char * buf , unsigned int nr )
527+ const u8 * buf , unsigned int nr )
528528{
529529 struct n_tty_data * ldata = tty -> disc_data ;
530530 int space ;
531531 int i ;
532- const unsigned char * cp ;
532+ const u8 * cp ;
533533
534534 mutex_lock (& ldata -> output_lock );
535535
@@ -542,7 +542,7 @@ static ssize_t process_output_block(struct tty_struct *tty,
542542 nr = space ;
543543
544544 for (i = 0 , cp = buf ; i < nr ; i ++ , cp ++ ) {
545- unsigned char c = * cp ;
545+ u8 c = * cp ;
546546
547547 switch (c ) {
548548 case '\n' :
@@ -609,15 +609,15 @@ static size_t __process_echoes(struct tty_struct *tty)
609609 struct n_tty_data * ldata = tty -> disc_data ;
610610 int space , old_space ;
611611 size_t tail ;
612- unsigned char c ;
612+ u8 c ;
613613
614614 old_space = space = tty_write_room (tty );
615615
616616 tail = ldata -> echo_tail ;
617617 while (MASK (ldata -> echo_commit ) != MASK (tail )) {
618618 c = echo_buf (ldata , tail );
619619 if (c == ECHO_OP_START ) {
620- unsigned char op ;
620+ u8 op ;
621621 bool space_left = true;
622622
623623 /*
@@ -818,7 +818,7 @@ static void flush_echoes(struct tty_struct *tty)
818818 *
819819 * Add a character or operation byte to the echo buffer.
820820 */
821- static inline void add_echo_byte (unsigned char c , struct n_tty_data * ldata )
821+ static inline void add_echo_byte (u8 c , struct n_tty_data * ldata )
822822{
823823 * echo_buf_addr (ldata , ldata -> echo_head ) = c ;
824824 smp_wmb (); /* Matches smp_rmb() in echo_buf(). */
@@ -889,7 +889,7 @@ static void echo_erase_tab(unsigned int num_chars, int after_tab,
889889 *
890890 * This variant does not treat control characters specially.
891891 */
892- static void echo_char_raw (unsigned char c , struct n_tty_data * ldata )
892+ static void echo_char_raw (u8 c , struct n_tty_data * ldata )
893893{
894894 if (c == ECHO_OP_START ) {
895895 add_echo_byte (ECHO_OP_START , ldata );
@@ -910,7 +910,7 @@ static void echo_char_raw(unsigned char c, struct n_tty_data *ldata)
910910 * This variant tags control characters to be echoed as "^X" (where X is the
911911 * letter representing the control char).
912912 */
913- static void echo_char (unsigned char c , const struct tty_struct * tty )
913+ static void echo_char (u8 c , const struct tty_struct * tty )
914914{
915915 struct n_tty_data * ldata = tty -> disc_data ;
916916
@@ -948,7 +948,7 @@ static inline void finish_erasing(struct n_tty_data *ldata)
948948 * Locking: n_tty_receive_buf()/producer path:
949949 * caller holds non-exclusive %termios_rwsem
950950 */
951- static void eraser (unsigned char c , const struct tty_struct * tty )
951+ static void eraser (u8 c , const struct tty_struct * tty )
952952{
953953 struct n_tty_data * ldata = tty -> disc_data ;
954954 enum { ERASE , WERASE , KILL } kill_type ;
@@ -1188,7 +1188,7 @@ static void n_tty_receive_overrun(const struct tty_struct *tty)
11881188 * caller holds non-exclusive %termios_rwsem
11891189 */
11901190static void n_tty_receive_parity_error (const struct tty_struct * tty ,
1191- unsigned char c )
1191+ u8 c )
11921192{
11931193 struct n_tty_data * ldata = tty -> disc_data ;
11941194
@@ -1206,7 +1206,7 @@ static void n_tty_receive_parity_error(const struct tty_struct *tty,
12061206}
12071207
12081208static void
1209- n_tty_receive_signal_char (struct tty_struct * tty , int signal , unsigned char c )
1209+ n_tty_receive_signal_char (struct tty_struct * tty , int signal , u8 c )
12101210{
12111211 isig (signal , tty );
12121212 if (I_IXON (tty ))
@@ -1218,7 +1218,7 @@ n_tty_receive_signal_char(struct tty_struct *tty, int signal, unsigned char c)
12181218 process_echoes (tty );
12191219}
12201220
1221- static bool n_tty_is_char_flow_ctrl (struct tty_struct * tty , unsigned char c )
1221+ static bool n_tty_is_char_flow_ctrl (struct tty_struct * tty , u8 c )
12221222{
12231223 return c == START_CHAR (tty ) || c == STOP_CHAR (tty );
12241224}
@@ -1238,7 +1238,7 @@ static bool n_tty_is_char_flow_ctrl(struct tty_struct *tty, unsigned char c)
12381238 * Returns true if @c is consumed as flow-control character, the character
12391239 * must not be treated as normal character.
12401240 */
1241- static bool n_tty_receive_char_flow_ctrl (struct tty_struct * tty , unsigned char c ,
1241+ static bool n_tty_receive_char_flow_ctrl (struct tty_struct * tty , u8 c ,
12421242 bool lookahead_done )
12431243{
12441244 if (!n_tty_is_char_flow_ctrl (tty , c ))
@@ -1354,7 +1354,7 @@ static bool n_tty_receive_char_canon(struct tty_struct *tty, u8 c)
13541354 return false;
13551355}
13561356
1357- static void n_tty_receive_char_special (struct tty_struct * tty , unsigned char c ,
1357+ static void n_tty_receive_char_special (struct tty_struct * tty , u8 c ,
13581358 bool lookahead_done )
13591359{
13601360 struct n_tty_data * ldata = tty -> disc_data ;
@@ -1423,7 +1423,7 @@ static void n_tty_receive_char_special(struct tty_struct *tty, unsigned char c,
14231423 * caller holds non-exclusive %termios_rwsem
14241424 * publishes canon_head if canonical mode is active
14251425 */
1426- static void n_tty_receive_char (struct tty_struct * tty , unsigned char c )
1426+ static void n_tty_receive_char (struct tty_struct * tty , u8 c )
14271427{
14281428 struct n_tty_data * ldata = tty -> disc_data ;
14291429
@@ -1445,7 +1445,7 @@ static void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
14451445 put_tty_queue (c , ldata );
14461446}
14471447
1448- static void n_tty_receive_char_closing (struct tty_struct * tty , unsigned char c ,
1448+ static void n_tty_receive_char_closing (struct tty_struct * tty , u8 c ,
14491449 bool lookahead_done )
14501450{
14511451 if (I_ISTRIP (tty ))
@@ -1465,7 +1465,7 @@ static void n_tty_receive_char_closing(struct tty_struct *tty, unsigned char c,
14651465}
14661466
14671467static void
1468- n_tty_receive_char_flagged (struct tty_struct * tty , unsigned char c , char flag )
1468+ n_tty_receive_char_flagged (struct tty_struct * tty , u8 c , u8 flag )
14691469{
14701470 switch (flag ) {
14711471 case TTY_BREAK :
@@ -1479,13 +1479,13 @@ n_tty_receive_char_flagged(struct tty_struct *tty, unsigned char c, char flag)
14791479 n_tty_receive_overrun (tty );
14801480 break ;
14811481 default :
1482- tty_err (tty , "unknown flag %d \n" , flag );
1482+ tty_err (tty , "unknown flag %u \n" , flag );
14831483 break ;
14841484 }
14851485}
14861486
14871487static void
1488- n_tty_receive_char_lnext (struct tty_struct * tty , unsigned char c , char flag )
1488+ n_tty_receive_char_lnext (struct tty_struct * tty , u8 c , u8 flag )
14891489{
14901490 struct n_tty_data * ldata = tty -> disc_data ;
14911491
@@ -1505,7 +1505,7 @@ static void n_tty_lookahead_flow_ctrl(struct tty_struct *tty, const u8 *cp,
15051505 const u8 * fp , size_t count )
15061506{
15071507 struct n_tty_data * ldata = tty -> disc_data ;
1508- unsigned char flag = TTY_NORMAL ;
1508+ u8 flag = TTY_NORMAL ;
15091509
15101510 ldata -> lookahead_count += count ;
15111511
@@ -1562,7 +1562,7 @@ static void
15621562n_tty_receive_buf_closing (struct tty_struct * tty , const u8 * cp , const u8 * fp ,
15631563 int count , bool lookahead_done )
15641564{
1565- char flag = TTY_NORMAL ;
1565+ u8 flag = TTY_NORMAL ;
15661566
15671567 while (count -- ) {
15681568 if (fp )
@@ -1955,7 +1955,7 @@ static inline int input_available_p(const struct tty_struct *tty, int poll)
19551955 * read_tail published
19561956 */
19571957static bool copy_from_read_buf (const struct tty_struct * tty ,
1958- unsigned char * * kbp ,
1958+ u8 * * kbp ,
19591959 size_t * nr )
19601960
19611961{
@@ -1968,7 +1968,7 @@ static bool copy_from_read_buf(const struct tty_struct *tty,
19681968 n = min (head - ldata -> read_tail , N_TTY_BUF_SIZE - tail );
19691969 n = min (* nr , n );
19701970 if (n ) {
1971- unsigned char * from = read_buf_addr (ldata , tail );
1971+ u8 * from = read_buf_addr (ldata , tail );
19721972 memcpy (* kbp , from , n );
19731973 is_eof = n == 1 && * from == EOF_CHAR (tty );
19741974 tty_audit_add_data (tty , from , n );
@@ -2010,7 +2010,7 @@ static bool copy_from_read_buf(const struct tty_struct *tty,
20102010 * read_tail published
20112011 */
20122012static bool canon_copy_from_read_buf (const struct tty_struct * tty ,
2013- unsigned char * * kbp ,
2013+ u8 * * kbp ,
20142014 size_t * nr )
20152015{
20162016 struct n_tty_data * ldata = tty -> disc_data ;
@@ -2229,7 +2229,7 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file, u8 *kbuf,
22292229 while (nr ) {
22302230 /* First test for status change. */
22312231 if (packet && tty -> link -> ctrl .pktstatus ) {
2232- unsigned char cs ;
2232+ u8 cs ;
22332233 if (kb != kbuf )
22342234 break ;
22352235 spin_lock_irq (& tty -> link -> ctrl .lock );
0 commit comments