Commit 9de44bd6 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

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: default avatarJiri Slaby <jslaby@suse.cz>
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 955787ca
...@@ -1570,8 +1570,8 @@ static int tty_release_checks(struct tty_struct *tty, struct tty_struct *o_tty, ...@@ -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, ...@@ -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) ...@@ -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,8 +1657,8 @@ int tty_release(struct inode *inode, struct file *filp) ...@@ -1660,8 +1657,8 @@ 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
if (tty->ops->close) if (tty->ops->close)
...@@ -1719,8 +1716,8 @@ int tty_release(struct inode *inode, struct file *filp) ...@@ -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) ...@@ -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) ...@@ -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 @@ static int tty_open(struct inode *inode, struct file *filp) ...@@ -1967,12 +1963,12 @@ static int tty_open(struct inode *inode, struct file *filp)
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 @@ static int tty_open(struct inode *inode, struct file *filp) ...@@ -1986,8 +1982,8 @@ static int tty_open(struct inode *inode, struct file *filp)
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);
......
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