dhd_dbg.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (c) 2010 Broadcom Corporation
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  11. * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  13. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef _BRCMF_DBG_H_
  17. #define _BRCMF_DBG_H_
  18. #if defined(BCMDBG)
  19. #define brcmf_dbg(level, fmt, ...) \
  20. do { \
  21. if (BRCMF_ERROR_VAL == BRCMF_##level##_VAL) { \
  22. if (brcmf_msg_level & BRCMF_##level##_VAL) { \
  23. if (net_ratelimit()) \
  24. printk(KERN_DEBUG "%s: " fmt, \
  25. __func__, ##__VA_ARGS__); \
  26. } \
  27. } else { \
  28. if (brcmf_msg_level & BRCMF_##level##_VAL) { \
  29. printk(KERN_DEBUG "%s: " fmt, \
  30. __func__, ##__VA_ARGS__); \
  31. } \
  32. } \
  33. } while (0)
  34. #define BRCMF_DATA_ON() (brcmf_msg_level & BRCMF_DATA_VAL)
  35. #define BRCMF_CTL_ON() (brcmf_msg_level & BRCMF_CTL_VAL)
  36. #define BRCMF_HDRS_ON() (brcmf_msg_level & BRCMF_HDRS_VAL)
  37. #define BRCMF_BYTES_ON() (brcmf_msg_level & BRCMF_BYTES_VAL)
  38. #define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL)
  39. #else /* (defined BCMDBG) || (defined BCMDBG) */
  40. #define brcmf_dbg(level, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
  41. #define BRCMF_DATA_ON() 0
  42. #define BRCMF_CTL_ON() 0
  43. #define BRCMF_HDRS_ON() 0
  44. #define BRCMF_BYTES_ON() 0
  45. #define BRCMF_GLOM_ON() 0
  46. #endif /* defined(BCMDBG) */
  47. extern int brcmf_msg_level;
  48. #endif /* _BRCMF_DBG_H_ */