device: Add dev_<level>_once variants
Add the equivalents to pr_<level>_once. Suggested-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d32394fae9
commit
e135303bd5
@ -1118,6 +1118,41 @@ do { \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PRINTK
|
||||
#define dev_level_once(dev_level, dev, fmt, ...) \
|
||||
do { \
|
||||
static bool __print_once __read_mostly; \
|
||||
\
|
||||
if (!__print_once) { \
|
||||
__print_once = true; \
|
||||
dev_level(dev, fmt, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
#define dev_level_once(dev_level, dev, fmt, ...) \
|
||||
do { \
|
||||
if (0) \
|
||||
dev_level(dev, fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#define dev_emerg_once(dev, fmt, ...) \
|
||||
dev_level_once(dev_emerg, dev, fmt, ##__VA_ARGS__)
|
||||
#define dev_alert_once(dev, fmt, ...) \
|
||||
dev_level_once(dev_alert, dev, fmt, ##__VA_ARGS__)
|
||||
#define dev_crit_once(dev, fmt, ...) \
|
||||
dev_level_once(dev_crit, dev, fmt, ##__VA_ARGS__)
|
||||
#define dev_err_once(dev, fmt, ...) \
|
||||
dev_level_once(dev_err, dev, fmt, ##__VA_ARGS__)
|
||||
#define dev_warn_once(dev, fmt, ...) \
|
||||
dev_level_once(dev_warn, dev, fmt, ##__VA_ARGS__)
|
||||
#define dev_notice_once(dev, fmt, ...) \
|
||||
dev_level_once(dev_notice, dev, fmt, ##__VA_ARGS__)
|
||||
#define dev_info_once(dev, fmt, ...) \
|
||||
dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__)
|
||||
#define dev_dbg_once(dev, fmt, ...) \
|
||||
dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__)
|
||||
|
||||
#define dev_level_ratelimited(dev_level, dev, fmt, ...) \
|
||||
do { \
|
||||
static DEFINE_RATELIMIT_STATE(_rs, \
|
||||
|
Loading…
Reference in New Issue
Block a user