trace.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (c) 2014 Qualcomm Atheros, Inc.
  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
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #if !defined(_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  17. #define _TRACE_H
  18. #include <linux/tracepoint.h>
  19. #include "ath.h"
  20. #undef TRACE_SYSTEM
  21. #define TRACE_SYSTEM ath
  22. #if !defined(CONFIG_ATH_TRACEPOINTS)
  23. #undef TRACE_EVENT
  24. #define TRACE_EVENT(name, proto, ...) static inline void trace_ ## name(proto) {}
  25. #endif /* CONFIG_ATH_TRACEPOINTS */
  26. TRACE_EVENT(ath_log,
  27. TP_PROTO(struct wiphy *wiphy,
  28. struct va_format *vaf),
  29. TP_ARGS(wiphy, vaf),
  30. TP_STRUCT__entry(
  31. __string(device, wiphy_name(wiphy))
  32. __string(driver, KBUILD_MODNAME)
  33. __dynamic_array(char, msg, ATH_DBG_MAX_LEN)
  34. ),
  35. TP_fast_assign(
  36. __assign_str(device, wiphy_name(wiphy));
  37. __assign_str(driver, KBUILD_MODNAME);
  38. WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
  39. ATH_DBG_MAX_LEN,
  40. vaf->fmt,
  41. *vaf->va) >= ATH_DBG_MAX_LEN);
  42. ),
  43. TP_printk(
  44. "%s %s %s",
  45. __get_str(driver),
  46. __get_str(device),
  47. __get_str(msg)
  48. )
  49. );
  50. #endif /* _TRACE_H || TRACE_HEADER_MULTI_READ */
  51. #undef TRACE_INCLUDE_PATH
  52. #define TRACE_INCLUDE_PATH .
  53. #undef TRACE_INCLUDE_FILE
  54. #define TRACE_INCLUDE_FILE trace
  55. /* This part must be outside protection */
  56. #include <trace/define_trace.h>