aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2009-01-02 08:41:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-02 13:19:35 -0500
commit300a6204b4d45dc70359b24384ad04ae899179c3 (patch)
tree2e4114fe82ded5357921b9c1d889086d840e465b /drivers
parenta88a69c91256418c5907c2f1f8a0ec0a36f9e6cc (diff)
n_tty: clean up coding style
Now the main work is done its polishing time Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/n_tty.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index a9bc5764fe75..a223823544bf 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -47,8 +47,8 @@
47#include <linux/bitops.h> 47#include <linux/bitops.h>
48#include <linux/audit.h> 48#include <linux/audit.h>
49#include <linux/file.h> 49#include <linux/file.h>
50#include <linux/uaccess.h>
50 51
51#include <asm/uaccess.h>
52#include <asm/system.h> 52#include <asm/system.h>
53 53
54/* number of characters left in xmit buffer before select has we have room */ 54/* number of characters left in xmit buffer before select has we have room */
@@ -309,7 +309,7 @@ static int do_output_char(unsigned char c, struct tty_struct *tty, int space)
309 309
310 if (!space) 310 if (!space)
311 return -1; 311 return -1;
312 312
313 switch (c) { 313 switch (c) {
314 case '\n': 314 case '\n':
315 if (O_ONLRET(tty)) 315 if (O_ONLRET(tty))
@@ -417,8 +417,7 @@ static ssize_t process_output_block(struct tty_struct *tty,
417 mutex_lock(&tty->output_lock); 417 mutex_lock(&tty->output_lock);
418 418
419 space = tty_write_room(tty); 419 space = tty_write_room(tty);
420 if (!space) 420 if (!space) {
421 {
422 mutex_unlock(&tty->output_lock); 421 mutex_unlock(&tty->output_lock);
423 return 0; 422 return 0;
424 } 423 }
@@ -521,7 +520,7 @@ static void process_echoes(struct tty_struct *tty)
521 if (opp == buf_end) 520 if (opp == buf_end)
522 opp -= N_TTY_BUF_SIZE; 521 opp -= N_TTY_BUF_SIZE;
523 op = *opp; 522 op = *opp;
524 523
525 switch (op) { 524 switch (op) {
526 unsigned int num_chars, num_bs; 525 unsigned int num_chars, num_bs;
527 526
@@ -621,7 +620,8 @@ static void process_echoes(struct tty_struct *tty)
621 } else { 620 } else {
622 int retval; 621 int retval;
623 622
624 if ((retval = do_output_char(c, tty, space)) < 0) 623 retval = do_output_char(c, tty, space);
624 if (retval < 0)
625 break; 625 break;
626 space -= retval; 626 space -= retval;
627 cp += 1; 627 cp += 1;
@@ -675,8 +675,7 @@ static void add_echo_byte(unsigned char c, struct tty_struct *tty)
675 * Since the buffer start position needs to be advanced, 675 * Since the buffer start position needs to be advanced,
676 * be sure to step by a whole operation byte group. 676 * be sure to step by a whole operation byte group.
677 */ 677 */
678 if (tty->echo_buf[tty->echo_pos] == ECHO_OP_START) 678 if (tty->echo_buf[tty->echo_pos] == ECHO_OP_START) {
679 {
680 if (tty->echo_buf[(tty->echo_pos + 1) & 679 if (tty->echo_buf[(tty->echo_pos + 1) &
681 (N_TTY_BUF_SIZE - 1)] == 680 (N_TTY_BUF_SIZE - 1)] ==
682 ECHO_OP_ERASE_TAB) { 681 ECHO_OP_ERASE_TAB) {
@@ -771,7 +770,7 @@ static void echo_erase_tab(unsigned int num_chars, int after_tab,
771 /* Set the high bit as a flag if num_chars is after a previous tab */ 770 /* Set the high bit as a flag if num_chars is after a previous tab */
772 if (after_tab) 771 if (after_tab)
773 num_chars |= 0x80; 772 num_chars |= 0x80;
774 773
775 add_echo_byte(num_chars, tty); 774 add_echo_byte(num_chars, tty);
776 775
777 mutex_unlock(&tty->echo_lock); 776 mutex_unlock(&tty->echo_lock);
@@ -959,8 +958,7 @@ static void eraser(unsigned char c, struct tty_struct *tty)
959 if (c == '\t') { 958 if (c == '\t') {
960 after_tab = 1; 959 after_tab = 1;
961 break; 960 break;
962 } 961 } else if (iscntrl(c)) {
963 else if (iscntrl(c)) {
964 if (L_ECHOCTL(tty)) 962 if (L_ECHOCTL(tty))
965 num_chars += 2; 963 num_chars += 2;
966 } else if (!is_continuation(c, tty)) { 964 } else if (!is_continuation(c, tty)) {
@@ -1112,7 +1110,7 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
1112 if (I_ISTRIP(tty)) 1110 if (I_ISTRIP(tty))
1113 c &= 0x7f; 1111 c &= 0x7f;
1114 if (I_IUCLC(tty) && L_IEXTEN(tty)) 1112 if (I_IUCLC(tty) && L_IEXTEN(tty))
1115 c=tolower(c); 1113 c = tolower(c);
1116 1114
1117 if (tty->stopped && !tty->flow_stopped && I_IXON(tty) && 1115 if (tty->stopped && !tty->flow_stopped && I_IXON(tty) &&
1118 I_IXANY(tty) && c != START_CHAR(tty) && c != STOP_CHAR(tty) && 1116 I_IXANY(tty) && c != START_CHAR(tty) && c != STOP_CHAR(tty) &&
@@ -1126,8 +1124,7 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
1126 if (c == START_CHAR(tty)) { 1124 if (c == START_CHAR(tty)) {
1127 start_tty(tty); 1125 start_tty(tty);
1128 process_echoes(tty); 1126 process_echoes(tty);
1129 } 1127 } else if (c == STOP_CHAR(tty))
1130 else if (c == STOP_CHAR(tty))
1131 stop_tty(tty); 1128 stop_tty(tty);
1132 } 1129 }
1133 return; 1130 return;
@@ -1335,7 +1332,7 @@ static void n_tty_write_wakeup(struct tty_struct *tty)
1335{ 1332{
1336 /* Write out any echoed characters that are still pending */ 1333 /* Write out any echoed characters that are still pending */
1337 process_echoes(tty); 1334 process_echoes(tty);
1338 1335
1339 if (tty->fasync) { 1336 if (tty->fasync) {
1340 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); 1337 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
1341 kill_fasync(&tty->fasync, SIGIO, POLL_OUT); 1338 kill_fasync(&tty->fasync, SIGIO, POLL_OUT);
@@ -1942,7 +1939,7 @@ static ssize_t n_tty_write(struct tty_struct *tty, struct file *file,
1942 1939
1943 /* Write out any echoed characters that are still pending */ 1940 /* Write out any echoed characters that are still pending */
1944 process_echoes(tty); 1941 process_echoes(tty);
1945 1942
1946 add_wait_queue(&tty->write_wait, &wait); 1943 add_wait_queue(&tty->write_wait, &wait);
1947 while (1) { 1944 while (1) {
1948 set_current_state(TASK_INTERRUPTIBLE); 1945 set_current_state(TASK_INTERRUPTIBLE);