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