debug.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright (c) 2013,2016 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. #include "wil6210.h"
  17. #include "trace.h"
  18. void __wil_err(struct wil6210_priv *wil, const char *fmt, ...)
  19. {
  20. struct va_format vaf;
  21. va_list args;
  22. va_start(args, fmt);
  23. vaf.fmt = fmt;
  24. vaf.va = &args;
  25. netdev_err(wil_to_ndev(wil), "%pV", &vaf);
  26. trace_wil6210_log_err(&vaf);
  27. va_end(args);
  28. }
  29. void __wil_err_ratelimited(struct wil6210_priv *wil, const char *fmt, ...)
  30. {
  31. struct va_format vaf;
  32. va_list args;
  33. if (!net_ratelimit())
  34. return;
  35. va_start(args, fmt);
  36. vaf.fmt = fmt;
  37. vaf.va = &args;
  38. netdev_err(wil_to_ndev(wil), "%pV", &vaf);
  39. trace_wil6210_log_err(&vaf);
  40. va_end(args);
  41. }
  42. void wil_dbg_ratelimited(const struct wil6210_priv *wil, const char *fmt, ...)
  43. {
  44. struct va_format vaf;
  45. va_list args;
  46. if (!net_ratelimit())
  47. return;
  48. va_start(args, fmt);
  49. vaf.fmt = fmt;
  50. vaf.va = &args;
  51. netdev_dbg(wil_to_ndev(wil), "%pV", &vaf);
  52. trace_wil6210_log_dbg(&vaf);
  53. va_end(args);
  54. }
  55. void __wil_info(struct wil6210_priv *wil, const char *fmt, ...)
  56. {
  57. struct va_format vaf;
  58. va_list args;
  59. va_start(args, fmt);
  60. vaf.fmt = fmt;
  61. vaf.va = &args;
  62. netdev_info(wil_to_ndev(wil), "%pV", &vaf);
  63. trace_wil6210_log_info(&vaf);
  64. va_end(args);
  65. }
  66. void wil_dbg_trace(struct wil6210_priv *wil, const char *fmt, ...)
  67. {
  68. struct va_format vaf;
  69. va_list args;
  70. va_start(args, fmt);
  71. vaf.fmt = fmt;
  72. vaf.va = &args;
  73. trace_wil6210_log_dbg(&vaf);
  74. va_end(args);
  75. }