diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2015-11-08 13:01:13 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-12-13 19:59:48 -0800 |
commit | 339f36ba14cf9f8fcf6e6b78385bd6811ec59fbe (patch) | |
tree | e5bed951017a1b12b262df03d00d1fbb8fc78db9 /include/linux/tty.h | |
parent | 0a083eddae33b6e20234d05a9cf54f87b0095511 (diff) | |
download | linux-339f36ba14cf9f8fcf6e6b78385bd6811ec59fbe.tar.gz linux-339f36ba14cf9f8fcf6e6b78385bd6811ec59fbe.tar.bz2 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.h | 12 |
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 |