bm_printk.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (C) 2021 Alibaba Group Holding Limited
  3. * Author: LuChongzhi <chongzhi.lcz@alibaba-inc.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #ifndef __BM_PRINTK__
  10. #define __BM_PRINTK__
  11. #include <stdarg.h>
  12. #include <linux/init.h>
  13. #include <linux/kern_levels.h>
  14. #include <linux/linkage.h>
  15. #include <linux/cache.h>
  16. /*
  17. * These can be used to print at the various log levels.
  18. * All of these will print unconditionally, although note that pr_debug()
  19. * and other debug macros are compiled out unless either DEBUG is defined
  20. * or CONFIG_DYNAMIC_DEBUG is set.
  21. */
  22. #define bm_emerg(fmt, ...) \
  23. printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
  24. #define bm_alert(fmt, ...) \
  25. printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
  26. #define bm_crit(fmt, ...) \
  27. printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
  28. #define bm_err(fmt, ...) \
  29. printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
  30. #define bm_warning(fmt, ...) \
  31. printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
  32. #define bm_warn pr_warning
  33. #ifdef DEBUG
  34. #define bm_notice(fmt, ...) \
  35. printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
  36. #define bm_info(fmt, ...) \
  37. printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
  38. #else
  39. #define bm_notice(fmt, ...)
  40. #define bm_info(fmt, ...)
  41. #endif
  42. #endif /* __BM_PRINTK__ */