rtdefs.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * include/linux/rtdefs.h
  3. *
  4. * Richtek driver common definitions
  5. *
  6. * Copyright (C) 2013 Richtek Technology Corp.
  7. * Author: Patrick Chang <patrick_chang@richtek.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation; either version 2
  12. * of the License, or (at your option) any later version.
  13. */
  14. #ifndef RTDEFS_H
  15. #define RTDEFS_H
  16. #include <linux/kernel.h>
  17. #ifndef RTDBGLEVEL
  18. #define RTDBGLEVEL 3
  19. #endif
  20. #define RTDBGINFO_LEVEL 3
  21. #define RTDBGWARN_LEVEL 2
  22. #define RTDBGERR_LEVEL 1
  23. #define RTDBGFPRN_LEVEL 0
  24. #if RTDBGINFO_LEVEL<=RTDBGLEVEL
  25. #define RTINFO(format, args...) \
  26. printk(KERN_INFO "%s:%s() line-%d: " format, \
  27. ALIAS_NAME, __FUNCTION__, __LINE__, ## args)
  28. #define RTINFO_IF(cond, format, args...) \
  29. if (cond) \
  30. printk(KERN_INFO "%s:%s() line-%d: " format, \
  31. ALIAS_NAME, __FUNCTION__, __LINE__, ## args)
  32. #else
  33. #define RTINFO(format, args...)
  34. #define RTINFO_IF(cond, format, args...)
  35. #endif
  36. #if RTDBGWARN_LEVEL<=RTDBGLEVEL
  37. #define RTWARN(format, args...) \
  38. printk(KERN_WARNING "%s:%s() line-%d: " format, \
  39. ALIAS_NAME, __FUNCTION__, __LINE__, ## args)
  40. #define RTWARN_IF(cond, format, args...) \
  41. if (cond) \
  42. printk(KERN_WARNING "%s:%s() line-%d: " format, \
  43. ALIAS_NAME, __FUNCTION__, __LINE__, ## args)
  44. #else
  45. #define RTWARN(format, args...)
  46. #define RTWARN_IF(cond, format, args...)
  47. #endif
  48. #if RTDBGERR_LEVEL<=RTDBGLEVEL
  49. #define RTERR(format, args...) \
  50. printk(KERN_ERR "%s:%s() line-%d: " format, \
  51. ALIAS_NAME, __FUNCTION__, __LINE__, ## args)
  52. #define RTERR_IF(cond, format, args...) \
  53. if (cond) printk(KERN_ERR "%s:%s() line-%d: " format, \
  54. ALIAS_NAME, __FUNCTION__, __LINE__, ## args)
  55. #else
  56. #define RTERR(format, args...)
  57. #define RTERR_IF(cond, format, args...)
  58. #endif
  59. #if RTDBGFPRN_LEVEL<=RTDBGLEVEL
  60. #define RTPRN(format, args...) \
  61. printk(KERN_DEBUG "%s:%s() line-%d: " format, \
  62. ALIAS_NAME, __FUNCTION__, __LINE__, ## args)
  63. #define RTPRN_IF(cond, format, args...) \
  64. if (cond) printk(KERN_DEBUG "%s:%s() line-%d: " format, \
  65. ALIAS_NAME, __FUNCTION__, __LINE__, ## args)
  66. #else
  67. #define RTPRN(format, args...)
  68. #define RTPRN_IF(cond, format, args...)
  69. #endif
  70. #endif // RTDEFS_H