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)
* this is not guaranteed.
*/
static void check_unthrottle(struct tty_struct * tty)
static void check_unthrottle(struct tty_struct *tty)
{
if (tty->count &&
test_and_clear_bit(TTY_THROTTLED, &tty->flags) &&
......@@ -187,7 +187,7 @@ static void reset_buffer_flags(struct tty_struct *tty)
* 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 */
reset_buffer_flags(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.
*/
static ssize_t opost_block(struct tty_struct * tty,
const unsigned char * buf, unsigned int nr)
static ssize_t opost_block(struct tty_struct *tty,
const unsigned char *buf, unsigned int nr)
{
int space;
int i;
......@@ -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,
unsigned char c)
{
if (I_IGNPAR(tty)) {
if (I_IGNPAR(tty))
return;
}
if (I_PARMRK(tty)) {
put_tty_queue('\377', tty);
put_tty_queue('\0', tty);
......@@ -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')
put_tty_queue(c, tty);
handle_newline:
handle_newline:
spin_lock_irqsave(&tty->read_lock, flags);
set_bit(tty->read_head, tty->read_flags);
put_tty_queue_nolock(c, tty);
......@@ -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)
{
if (tty->fasync)
{
if (tty->fasync) {
set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
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,
tty->read_cnt += i;
spin_unlock_irqrestore(&tty->read_lock, cpuflags);
} else {
for (i=count, p = cp, f = fp; i; i--, p++) {
for (i = count, p = cp, f = fp; i; i--, p++) {
if (f)
flags = *f++;
switch (flags) {
......@@ -968,7 +965,7 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
n_tty_receive_overrun(tty);
break;
default:
printk("%s: unknown flag %d\n",
printk(KERN_ERR "%s: unknown flag %d\n",
tty_name(tty, buf), flags);
break;
}
......@@ -1016,7 +1013,7 @@ int is_ignored(int sig)
* 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)
return;
......@@ -1186,7 +1183,8 @@ static int copy_from_read_buf(struct tty_struct *tty,
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
......@@ -1208,7 +1206,7 @@ static int job_control(struct tty_struct *tty, struct file *file)
if (file->f_op->write != redirected_tty_write &&
current->signal->tty == tty) {
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) {
if (is_ignored(SIGTTIN) ||
is_current_pgrp_orphaned())
......@@ -1252,12 +1250,12 @@ static ssize_t read_chan(struct tty_struct *tty, struct file *file,
do_it_again:
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;
}
c = job_control(tty, file);
if(c < 0)
if (c < 0)
return c;
minimum = time = 0;
......@@ -1287,8 +1285,7 @@ static ssize_t read_chan(struct tty_struct *tty, struct file *file,
if (file->f_flags & O_NONBLOCK) {
if (!mutex_trylock(&tty->atomic_read_lock))
return -EAGAIN;
}
else {
} else {
if (mutex_lock_interruptible(&tty->atomic_read_lock))
return -ERESTARTSYS;
}
......@@ -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.
*/
static ssize_t write_chan(struct tty_struct * tty, struct file * file,
const unsigned char * buf, size_t nr)
static ssize_t write_chan(struct tty_struct *tty, struct file *file,
const unsigned char *buf, size_t nr)
{
const unsigned char *b = buf;
DECLARE_WAITQUEUE(wait, current);
......@@ -1543,7 +1540,8 @@ static ssize_t write_chan(struct tty_struct * tty, struct file * file,
* 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;
......
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