[PATCH 05/13] tty: remove tty_warn()

Greg Kroah-Hartman
2021-04-08T12:52:21Z

Remove users of tty_warn() and replace them with calls to dev_warn()
which provides more information about the tty that has the error and
uses the standard formatting logic.

Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/tty/n_tty.c | 2 +-
drivers/tty/tty.h | 1 -
drivers/tty/tty_io.c | 8 ++++----
drivers/tty/tty_jobctrl.c | 2 +-
drivers/tty/tty_port.c | 4 ++--
5 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index dbe208342258..39a448ef0aed 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -1200,7 +1200,7 @@ static void n_tty_receive_overrun(struct tty_struct *tty)
ldata->num_overrun++;
if (time_after(jiffies, ldata->overrun_time + HZ) ||
time_after(ldata->overrun_time, jiffies)) {
- tty_warn(tty, "%d input overrun(s)\n", ldata->num_overrun);
+ dev_warn(tty->dev, "%d input overrun(s)\n", ldata->num_overrun);
ldata->overrun_time = jiffies;
ldata->num_overrun = 0;
}
diff --git a/drivers/tty/tty.h b/drivers/tty/tty.h
index 0323bc2cd6ba..45b15cc250e8 100644
--- a/drivers/tty/tty.h
+++ b/drivers/tty/tty.h
@@ -10,7 +10,6 @@
fn("%s %s: " f, tty_driver_name(tty), tty_name(tty), ##__VA_ARGS__)

#define tty_debug(tty, f, ...) tty_msg(pr_debug, tty, f, ##__VA_ARGS__)
-#define tty_warn(tty, f, ...) tty_msg(pr_warn, tty, f, ##__VA_ARGS__)

#define tty_info_ratelimited(tty, f, ...) \
tty_msg(pr_info_ratelimited, tty, f, ##__VA_ARGS__)
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 0079ffd0cb9c..2c3efa854ba5 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -295,7 +295,7 @@ static int check_tty_count(struct tty_struct *tty, const char *routine)
if (tty_port_kopened(tty->port))
kopen_count++;
if (tty->count != (count + kopen_count)) {
- tty_warn(tty, "%s: tty->count(%d) != (#fd's(%d) + #kopen's(%d))\n",
+ dev_warn(tty->dev, "%s: tty->count(%d) != (#fd's(%d) + #kopen's(%d))\n",
routine, tty->count, count, kopen_count);
return (count + kopen_count);
}
@@ -1823,7 +1823,7 @@ int tty_release(struct inode *inode, struct file *filp)

if (once) {
once = 0;
- tty_warn(tty, "read/write wait queue active!\n");
+ dev_warn(tty->dev, "read/write wait queue active!\n");
}
schedule_timeout_killable(timeout);
if (timeout < 120 * HZ)
@@ -1834,12 +1834,12 @@ int tty_release(struct inode *inode, struct file *filp)

if (o_tty) {
if (--o_tty->count < 0) {
- tty_warn(tty, "bad slave count (%d)\n", o_tty->count);
+ dev_warn(tty->dev, "bad slave count (%d)\n", o_tty->count);
o_tty->count = 0;
}
}
if (--tty->count < 0) {
- tty_warn(tty, "bad tty->count (%d)\n", tty->count);
+ dev_warn(tty->dev, "bad tty->count (%d)\n", tty->count);
tty->count = 0;
}

diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c
index 0728730d38d1..19ec43a6ef76 100644
--- a/drivers/tty/tty_jobctrl.c
+++ b/drivers/tty/tty_jobctrl.c
@@ -61,7 +61,7 @@ int __tty_check_change(struct tty_struct *tty, int sig)
rcu_read_unlock();

if (!tty_pgrp)
- tty_warn(tty, "sig=%d, tty->pgrp == NULL!\n", sig);
+ dev_warn(tty->dev, "sig=%d, tty->pgrp == NULL!\n", sig);

return ret;
}
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index 303c198fbf5c..575fe3933ff9 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -567,12 +567,12 @@ int tty_port_close_start(struct tty_port *port,

spin_lock_irqsave(&port->lock, flags);
if (tty->count == 1 && port->count != 1) {
- tty_warn(tty, "%s: tty->count = 1 port count = %d\n", __func__,
+ dev_warn(tty->dev, "%s: tty->count = 1 port count = %d\n", __func__,
port->count);
port->count = 1;
}
if (--port->count < 0) {
- tty_warn(tty, "%s: bad port count (%d)\n", __func__,
+ dev_warn(tty->dev, "%s: bad port count (%d)\n", __func__,
port->count);
port->count = 0;
}
--
2.31.1