Commit 4edf1827 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

n_tty: clean up old code to follow coding style and (mostly) checkpatch

Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent db1acaa6
...@@ -145,7 +145,7 @@ static void put_tty_queue(unsigned char c, struct tty_struct *tty) ...@@ -145,7 +145,7 @@ static void put_tty_queue(unsigned char c, struct tty_struct *tty)
* this is not guaranteed. * this is not guaranteed.
*/ */
static void check_unthrottle(struct tty_struct * tty) static void check_unthrottle(struct tty_struct *tty)
{ {
if (tty->count && if (tty->count &&
test_and_clear_bit(TTY_THROTTLED, &tty->flags) && test_and_clear_bit(TTY_THROTTLED, &tty->flags) &&
...@@ -187,7 +187,7 @@ static void reset_buffer_flags(struct tty_struct *tty) ...@@ -187,7 +187,7 @@ static void reset_buffer_flags(struct tty_struct *tty)
* lock_kernel() still. * lock_kernel() still.
*/ */
static void n_tty_flush_buffer(struct tty_struct * tty) static void n_tty_flush_buffer(struct tty_struct *tty)
{ {
/* clear everything and unthrottle the driver */ /* clear everything and unthrottle the driver */
reset_buffer_flags(tty); reset_buffer_flags(tty);
...@@ -340,8 +340,8 @@ static int opost(unsigned char c, struct tty_struct *tty) ...@@ -340,8 +340,8 @@ static int opost(unsigned char c, struct tty_struct *tty)
* Called from write_chan under the tty layer write lock. * Called from write_chan under the tty layer write lock.
*/ */
static ssize_t opost_block(struct tty_struct * tty, static ssize_t opost_block(struct tty_struct *tty,
const unsigned char * buf, unsigned int nr) const unsigned char *buf, unsigned int nr)
{ {
int space; int space;
int i; int i;
...@@ -662,9 +662,8 @@ static inline void n_tty_receive_overrun(struct tty_struct *tty) ...@@ -662,9 +662,8 @@ static inline void n_tty_receive_overrun(struct tty_struct *tty)
static inline void n_tty_receive_parity_error(struct tty_struct *tty, static inline void n_tty_receive_parity_error(struct tty_struct *tty,
unsigned char c) unsigned char c)
{ {
if (I_IGNPAR(tty)) { if (I_IGNPAR(tty))
return; return;
}
if (I_PARMRK(tty)) { if (I_PARMRK(tty)) {
put_tty_queue('\377', tty); put_tty_queue('\377', tty);
put_tty_queue('\0', tty); put_tty_queue('\0', tty);
...@@ -850,7 +849,7 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c) ...@@ -850,7 +849,7 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
if (I_PARMRK(tty) && c == (unsigned char) '\377') if (I_PARMRK(tty) && c == (unsigned char) '\377')
put_tty_queue(c, tty); put_tty_queue(c, tty);
handle_newline: handle_newline:
spin_lock_irqsave(&tty->read_lock, flags); spin_lock_irqsave(&tty->read_lock, flags);
set_bit(tty->read_head, tty->read_flags); set_bit(tty->read_head, tty->read_flags);
put_tty_queue_nolock(c, tty); put_tty_queue_nolock(c, tty);
...@@ -898,12 +897,10 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c) ...@@ -898,12 +897,10 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
static void n_tty_write_wakeup(struct tty_struct *tty) static void n_tty_write_wakeup(struct tty_struct *tty)
{ {
if (tty->fasync) if (tty->fasync) {
{
set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
kill_fasync(&tty->fasync, SIGIO, POLL_OUT); kill_fasync(&tty->fasync, SIGIO, POLL_OUT);
} }
return;
} }
/** /**
...@@ -950,7 +947,7 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp, ...@@ -950,7 +947,7 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
tty->read_cnt += i; tty->read_cnt += i;
spin_unlock_irqrestore(&tty->read_lock, cpuflags); spin_unlock_irqrestore(&tty->read_lock, cpuflags);
} else { } else {
for (i=count, p = cp, f = fp; i; i--, p++) { for (i = count, p = cp, f = fp; i; i--, p++) {
if (f) if (f)
flags = *f++; flags = *f++;
switch (flags) { switch (flags) {
...@@ -968,7 +965,7 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp, ...@@ -968,7 +965,7 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
n_tty_receive_overrun(tty); n_tty_receive_overrun(tty);
break; break;
default: default:
printk("%s: unknown flag %d\n", printk(KERN_ERR "%s: unknown flag %d\n",
tty_name(tty, buf), flags); tty_name(tty, buf), flags);
break; break;
} }
...@@ -1016,7 +1013,7 @@ int is_ignored(int sig) ...@@ -1016,7 +1013,7 @@ int is_ignored(int sig)
* when the ldisc is closed. * when the ldisc is closed.
*/ */
static void n_tty_set_termios(struct tty_struct *tty, struct ktermios * old) static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
{ {
if (!tty) if (!tty)
return; return;
...@@ -1186,7 +1183,8 @@ static int copy_from_read_buf(struct tty_struct *tty, ...@@ -1186,7 +1183,8 @@ static int copy_from_read_buf(struct tty_struct *tty,
return retval; return retval;
} }
extern ssize_t redirected_tty_write(struct file *,const char *,size_t,loff_t *); extern ssize_t redirected_tty_write(struct file *, const char *,
size_t, loff_t *);
/** /**
* job_control - check job control * job_control - check job control
...@@ -1208,7 +1206,7 @@ static int job_control(struct tty_struct *tty, struct file *file) ...@@ -1208,7 +1206,7 @@ static int job_control(struct tty_struct *tty, struct file *file)
if (file->f_op->write != redirected_tty_write && if (file->f_op->write != redirected_tty_write &&
current->signal->tty == tty) { current->signal->tty == tty) {
if (!tty->pgrp) if (!tty->pgrp)
printk("read_chan: no tty->pgrp!\n"); printk(KERN_ERR "read_chan: no tty->pgrp!\n");
else if (task_pgrp(current) != tty->pgrp) { else if (task_pgrp(current) != tty->pgrp) {
if (is_ignored(SIGTTIN) || if (is_ignored(SIGTTIN) ||
is_current_pgrp_orphaned()) is_current_pgrp_orphaned())
...@@ -1252,12 +1250,12 @@ static ssize_t read_chan(struct tty_struct *tty, struct file *file, ...@@ -1252,12 +1250,12 @@ static ssize_t read_chan(struct tty_struct *tty, struct file *file,
do_it_again: do_it_again:
if (!tty->read_buf) { if (!tty->read_buf) {
printk("n_tty_read_chan: called with read_buf == NULL?!?\n"); printk(KERN_ERR "n_tty_read_chan: read_buf == NULL?!?\n");
return -EIO; return -EIO;
} }
c = job_control(tty, file); c = job_control(tty, file);
if(c < 0) if (c < 0)
return c; return c;
minimum = time = 0; minimum = time = 0;
...@@ -1287,8 +1285,7 @@ static ssize_t read_chan(struct tty_struct *tty, struct file *file, ...@@ -1287,8 +1285,7 @@ static ssize_t read_chan(struct tty_struct *tty, struct file *file,
if (file->f_flags & O_NONBLOCK) { if (file->f_flags & O_NONBLOCK) {
if (!mutex_trylock(&tty->atomic_read_lock)) if (!mutex_trylock(&tty->atomic_read_lock))
return -EAGAIN; return -EAGAIN;
} } else {
else {
if (mutex_lock_interruptible(&tty->atomic_read_lock)) if (mutex_lock_interruptible(&tty->atomic_read_lock))
return -ERESTARTSYS; return -ERESTARTSYS;
} }
...@@ -1451,8 +1448,8 @@ static ssize_t read_chan(struct tty_struct *tty, struct file *file, ...@@ -1451,8 +1448,8 @@ static ssize_t read_chan(struct tty_struct *tty, struct file *file,
* This code must be sure never to sleep through a hangup. * This code must be sure never to sleep through a hangup.
*/ */
static ssize_t write_chan(struct tty_struct * tty, struct file * file, static ssize_t write_chan(struct tty_struct *tty, struct file *file,
const unsigned char * buf, size_t nr) const unsigned char *buf, size_t nr)
{ {
const unsigned char *b = buf; const unsigned char *b = buf;
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
...@@ -1543,7 +1540,8 @@ static ssize_t write_chan(struct tty_struct * tty, struct file * file, ...@@ -1543,7 +1540,8 @@ static ssize_t write_chan(struct tty_struct * tty, struct file * file,
* a read wakeup to fix this bug. * a read wakeup to fix this bug.
*/ */
static unsigned int normal_poll(struct tty_struct * tty, struct file * file, poll_table *wait) static unsigned int normal_poll(struct tty_struct *tty, struct file *file,
poll_table *wait)
{ {
unsigned int mask = 0; unsigned int mask = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment