TTY: open/release, cleanup printks

* use __func__ instead of hardcoded names (tty_release_dev is a
  non-existant function)
* add missing \n's
* unwrap for better grepping

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Jiri Slaby 2011-11-09 21:33:24 +01:00 committed by Greg Kroah-Hartman
parent 955787ca94
commit 9de44bd604
1 changed files with 26 additions and 30 deletions

View File

@ -1570,8 +1570,8 @@ static int tty_release_checks(struct tty_struct *tty, struct tty_struct *o_tty,
{
#ifdef TTY_PARANOIA_CHECK
if (idx < 0 || idx >= tty->driver->num) {
printk(KERN_DEBUG "tty_release_dev: bad idx when trying to "
"free (%s)\n", tty->name);
printk(KERN_DEBUG "%s: bad idx when trying to free (%s)\n",
__func__, tty->name);
return -1;
}
@ -1580,31 +1580,28 @@ static int tty_release_checks(struct tty_struct *tty, struct tty_struct *o_tty,
return 0;
if (tty != tty->driver->ttys[idx]) {
printk(KERN_DEBUG "tty_release_dev: driver.table[%d] not tty "
"for (%s)\n", idx, tty->name);
printk(KERN_DEBUG "%s: driver.table[%d] not tty for (%s)\n",
__func__, idx, tty->name);
return -1;
}
if (tty->termios != tty->driver->termios[idx]) {
printk(KERN_DEBUG "tty_release_dev: driver.termios[%d] not termios "
"for (%s)\n",
idx, tty->name);
printk(KERN_DEBUG "%s: driver.termios[%d] not termios for (%s)\n",
__func__, idx, tty->name);
return -1;
}
if (tty->driver->other) {
if (o_tty != tty->driver->other->ttys[idx]) {
printk(KERN_DEBUG "tty_release_dev: other->table[%d] "
"not o_tty for (%s)\n",
idx, tty->name);
printk(KERN_DEBUG "%s: other->table[%d] not o_tty for (%s)\n",
__func__, idx, tty->name);
return -1;
}
if (o_tty->termios != tty->driver->other->termios[idx]) {
printk(KERN_DEBUG "tty_release_dev: other->termios[%d] "
"not o_termios for (%s)\n",
idx, tty->name);
printk(KERN_DEBUG "%s: other->termios[%d] not o_termios for (%s)\n",
__func__, idx, tty->name);
return -1;
}
if (o_tty->link != tty) {
printk(KERN_DEBUG "tty_release_dev: bad pty pointers\n");
printk(KERN_DEBUG "%s: bad pty pointers\n", __func__);
return -1;
}
}
@ -1640,11 +1637,11 @@ int tty_release(struct inode *inode, struct file *filp)
int idx;
char buf[64];
if (tty_paranoia_check(tty, inode, "tty_release_dev"))
if (tty_paranoia_check(tty, inode, __func__))
return 0;
tty_lock();
check_tty_count(tty, "tty_release_dev");
check_tty_count(tty, __func__);
__tty_fasync(-1, filp, 0);
@ -1660,8 +1657,8 @@ int tty_release(struct inode *inode, struct file *filp)
}
#ifdef TTY_DEBUG_HANGUP
printk(KERN_DEBUG "tty_release_dev of %s (tty count=%d)...",
tty_name(tty, buf), tty->count);
printk(KERN_DEBUG "%s: %s (tty count=%d)...\n", __func__,
tty_name(tty, buf), tty->count);
#endif
if (tty->ops->close)
@ -1719,8 +1716,8 @@ int tty_release(struct inode *inode, struct file *filp)
if (!do_sleep)
break;
printk(KERN_WARNING "tty_release_dev: %s: read/write wait queue "
"active!\n", tty_name(tty, buf));
printk(KERN_WARNING "%s: %s: read/write wait queue active!\n",
__func__, tty_name(tty, buf));
tty_unlock();
mutex_unlock(&tty_mutex);
schedule();
@ -1733,15 +1730,14 @@ int tty_release(struct inode *inode, struct file *filp)
*/
if (pty_master) {
if (--o_tty->count < 0) {
printk(KERN_WARNING "tty_release_dev: bad pty slave count "
"(%d) for %s\n",
o_tty->count, tty_name(o_tty, buf));
printk(KERN_WARNING "%s: bad pty slave count (%d) for %s\n",
__func__, o_tty->count, tty_name(o_tty, buf));
o_tty->count = 0;
}
}
if (--tty->count < 0) {
printk(KERN_WARNING "tty_release_dev: bad tty->count (%d) for %s\n",
tty->count, tty_name(tty, buf));
printk(KERN_WARNING "%s: bad tty->count (%d) for %s\n",
__func__, tty->count, tty_name(tty, buf));
tty->count = 0;
}
@ -1790,7 +1786,7 @@ int tty_release(struct inode *inode, struct file *filp)
}
#ifdef TTY_DEBUG_HANGUP
printk(KERN_DEBUG "freeing tty structure...");
printk(KERN_DEBUG "%s: freeing tty structure...\n", __func__);
#endif
/*
* Ask the line discipline code to release its structures
@ -1967,12 +1963,12 @@ retry_open:
tty_add_file(tty, filp);
check_tty_count(tty, "tty_open");
check_tty_count(tty, __func__);
if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
tty->driver->subtype == PTY_TYPE_MASTER)
noctty = 1;
#ifdef TTY_DEBUG_HANGUP
printk(KERN_DEBUG "opening %s...", tty->name);
printk(KERN_DEBUG "%s: opening %s...\n", __func__, tty->name);
#endif
if (tty->ops->open)
retval = tty->ops->open(tty, filp);
@ -1986,8 +1982,8 @@ retry_open:
if (retval) {
#ifdef TTY_DEBUG_HANGUP
printk(KERN_DEBUG "error %d in opening %s...", retval,
tty->name);
printk(KERN_DEBUG "%s: error %d in opening %s...\n", __func__,
retval, tty->name);
#endif
tty_unlock(); /* need to call tty_release without BTM */
tty_release(inode, filp);