debug.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Copyright (c) 2013,2016 Qualcomm Atheros, Inc.
  3. * Copyright (c) 2018, The Linux Foundation. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. #include "wil6210.h"
  18. #include "trace.h"
  19. void __wil_err(struct wil6210_priv *wil, const char *fmt, ...)
  20. {
  21. struct va_format vaf;
  22. va_list args;
  23. va_start(args, fmt);
  24. vaf.fmt = fmt;
  25. vaf.va = &args;
  26. netdev_err(wil->main_ndev, "%pV", &vaf);
  27. trace_wil6210_log_err(&vaf);
  28. va_end(args);
  29. }
  30. void __wil_err_ratelimited(struct wil6210_priv *wil, const char *fmt, ...)
  31. {
  32. struct va_format vaf;
  33. va_list args;
  34. if (!net_ratelimit())
  35. return;
  36. va_start(args, fmt);
  37. vaf.fmt = fmt;
  38. vaf.va = &args;
  39. netdev_err(wil->main_ndev, "%pV", &vaf);
  40. trace_wil6210_log_err(&vaf);
  41. va_end(args);
  42. }
  43. void wil_dbg_ratelimited(const struct wil6210_priv *wil, const char *fmt, ...)
  44. {
  45. struct va_format vaf;
  46. va_list args;
  47. if (!net_ratelimit())
  48. return;
  49. va_start(args, fmt);
  50. vaf.fmt = fmt;
  51. vaf.va = &args;
  52. netdev_dbg(wil->main_ndev, "%pV", &vaf);
  53. trace_wil6210_log_dbg(&vaf);
  54. va_end(args);
  55. }
  56. void __wil_info(struct wil6210_priv *wil, const char *fmt, ...)
  57. {
  58. struct va_format vaf;
  59. va_list args;
  60. va_start(args, fmt);
  61. vaf.fmt = fmt;
  62. vaf.va = &args;
  63. netdev_info(wil->main_ndev, "%pV", &vaf);
  64. trace_wil6210_log_info(&vaf);
  65. va_end(args);
  66. }
  67. void wil_dbg_trace(struct wil6210_priv *wil, const char *fmt, ...)
  68. {
  69. struct va_format vaf;
  70. va_list args;
  71. va_start(args, fmt);
  72. vaf.fmt = fmt;
  73. vaf.va = &args;
  74. trace_wil6210_log_dbg(&vaf);
  75. va_end(args);
  76. }