summaryrefslogtreecommitdiffstats
path: root/include/linux/tty.h
diff options
context:
space:
mode:
authorPeter Hurley2015-11-08 19:01:13 +0100
committerGreg Kroah-Hartman2015-12-14 04:59:48 +0100
commit339f36ba14cf9f8fcf6e6b78385bd6811ec59fbe (patch)
treee5bed951017a1b12b262df03d00d1fbb8fc78db9 /include/linux/tty.h
parenttty: core: Add helper fn to deref tty driver name (diff)
downloadkernel-qcow2-linux-339f36ba14cf9f8fcf6e6b78385bd6811ec59fbe.tar.gz
kernel-qcow2-linux-339f36ba14cf9f8fcf6e6b78385bd6811ec59fbe.tar.xz
kernel-qcow2-linux-339f36ba14cf9f8fcf6e6b78385bd6811ec59fbe.zip
tty: Define tty_*() printk macros
Since not all ttys are devices (eg., SysV ptys), dev_*() printk macros cannot be used. Define tty_*() printk macros that output in similar format to dev_*() macros (ie., <driver> <tty>: .....). Transform the most-trivial printk( LEVEL ...) usage to tty_*() usage. NB: The function name has been eliminated from messages with unique context, or prefixed to the format when given. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/tty.h')
-rw-r--r--include/linux/tty.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index a9c1af990da9..f578e8405ff0 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -666,7 +666,17 @@ 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_debug(tty, f, ...) \
- pr_debug("%s: %s: " f, tty_name(tty), __func__, ##__VA_ARGS__)
+ tty_msg(pr_debug, tty, "%s:" f, __func__, ##__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_info_ratelimited(tty, f, ...) \
+ tty_msg(pr_info_ratelimited, tty, f, ##__VA_ARGS__)
#endif