diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index 346d20f4a486..94bd3af9e1db 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c @@ -566,8 +566,9 @@ 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__, - port->count); + if (strcmp(tty_driver_name(tty), "ttyprintk")) + tty_warn(tty, "%s: tty->count = 1 port count = %d\n", __func__, + port->count); port->count = 1; } if (--port->count < 0) { diff --git a/include/linux/tty.h b/include/linux/tty.h index 95fc2f100f12..5540209ba849 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -772,16 +772,16 @@ static inline void proc_tty_register_driver(struct tty_driver *d) {} static inline void proc_tty_unregister_driver(struct tty_driver *d) {} #endif -#define tty_msg(fn, tty, f, ...) \ - fn("%s %s: " f, tty_driver_name(tty), tty_name(tty), ##__VA_ARGS__) +#define tty_msg(lv, tty, f, ...) \ + printk_deferred(lv pr_fmt("%s %s (%p): " f), tty_driver_name(tty), tty_name(tty), tty, ##__VA_ARGS__) -#define tty_debug(tty, f, ...) tty_msg(pr_debug, tty, f, ##__VA_ARGS__) -#define tty_info(tty, f, ...) tty_msg(pr_info, tty, f, ##__VA_ARGS__) -#define tty_notice(tty, f, ...) tty_msg(pr_notice, tty, f, ##__VA_ARGS__) -#define tty_warn(tty, f, ...) tty_msg(pr_warn, tty, f, ##__VA_ARGS__) -#define tty_err(tty, f, ...) tty_msg(pr_err, tty, f, ##__VA_ARGS__) +#define tty_debug(tty, f, ...) tty_msg(KERN_DEBUG, tty, f, ##__VA_ARGS__) +#define tty_info(tty, f, ...) tty_msg(KERN_INFO, tty, f, ##__VA_ARGS__) +#define tty_notice(tty, f, ...) tty_msg(KERN_NOTICE, tty, f, ##__VA_ARGS__) +#define tty_warn(tty, f, ...) tty_msg(KERN_WARNING, tty, f, ##__VA_ARGS__) +#define tty_err(tty, f, ...) tty_msg(KERN_ERR, tty, f, ##__VA_ARGS__) #define tty_info_ratelimited(tty, f, ...) \ - tty_msg(pr_info_ratelimited, tty, f, ##__VA_ARGS__) + pr_info_ratelimited("%s %s (%p): " f, tty_driver_name(tty), tty_name(tty), tty, ##__VA_ARGS__) #endif