brcms_trace_brcmsmac_msg.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright (c) 2011 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. #if !defined(__TRACE_BRCMSMAC_MSG_H) || defined(TRACE_HEADER_MULTI_READ)
  17. #define __TRACE_BRCMSMAC_MSG_H
  18. #include <linux/tracepoint.h>
  19. #undef TRACE_SYSTEM
  20. #define TRACE_SYSTEM brcmsmac_msg
  21. #define MAX_MSG_LEN 100
  22. DECLARE_EVENT_CLASS(brcms_msg_event,
  23. TP_PROTO(struct va_format *vaf),
  24. TP_ARGS(vaf),
  25. TP_STRUCT__entry(
  26. __dynamic_array(char, msg, MAX_MSG_LEN)
  27. ),
  28. TP_fast_assign(
  29. WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
  30. MAX_MSG_LEN, vaf->fmt,
  31. *vaf->va) >= MAX_MSG_LEN);
  32. ),
  33. TP_printk("%s", __get_str(msg))
  34. );
  35. DEFINE_EVENT(brcms_msg_event, brcms_info,
  36. TP_PROTO(struct va_format *vaf),
  37. TP_ARGS(vaf)
  38. );
  39. DEFINE_EVENT(brcms_msg_event, brcms_warn,
  40. TP_PROTO(struct va_format *vaf),
  41. TP_ARGS(vaf)
  42. );
  43. DEFINE_EVENT(brcms_msg_event, brcms_err,
  44. TP_PROTO(struct va_format *vaf),
  45. TP_ARGS(vaf)
  46. );
  47. DEFINE_EVENT(brcms_msg_event, brcms_crit,
  48. TP_PROTO(struct va_format *vaf),
  49. TP_ARGS(vaf)
  50. );
  51. TRACE_EVENT(brcms_dbg,
  52. TP_PROTO(u32 level, const char *func, struct va_format *vaf),
  53. TP_ARGS(level, func, vaf),
  54. TP_STRUCT__entry(
  55. __field(u32, level)
  56. __string(func, func)
  57. __dynamic_array(char, msg, MAX_MSG_LEN)
  58. ),
  59. TP_fast_assign(
  60. __entry->level = level;
  61. __assign_str(func, func);
  62. WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
  63. MAX_MSG_LEN, vaf->fmt,
  64. *vaf->va) >= MAX_MSG_LEN);
  65. ),
  66. TP_printk("%s: %s", __get_str(func), __get_str(msg))
  67. );
  68. #endif /* __TRACE_BRCMSMAC_MSG_H */
  69. #ifdef CONFIG_BRCM_TRACING
  70. #undef TRACE_INCLUDE_PATH
  71. #define TRACE_INCLUDE_PATH .
  72. #undef TRACE_INCLUDE_FILE
  73. #define TRACE_INCLUDE_FILE brcms_trace_brcmsmac_msg
  74. #include <trace/define_trace.h>
  75. #endif /* CONFIG_BRCM_TRACING */