debug.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (c) 2013 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 net_device *ndev = wil_to_ndev(wil);
  21. struct va_format vaf = {
  22. .fmt = fmt,
  23. };
  24. va_list args;
  25. va_start(args, fmt);
  26. vaf.va = &args;
  27. netdev_err(ndev, "%pV", &vaf);
  28. trace_wil6210_log_err(&vaf);
  29. va_end(args);
  30. }
  31. void wil_err_ratelimited(struct wil6210_priv *wil, const char *fmt, ...)
  32. {
  33. if (net_ratelimit()) {
  34. struct net_device *ndev = wil_to_ndev(wil);
  35. struct va_format vaf = {
  36. .fmt = fmt,
  37. };
  38. va_list args;
  39. va_start(args, fmt);
  40. vaf.va = &args;
  41. netdev_err(ndev, "%pV", &vaf);
  42. trace_wil6210_log_err(&vaf);
  43. va_end(args);
  44. }
  45. }
  46. void wil_info(struct wil6210_priv *wil, const char *fmt, ...)
  47. {
  48. struct net_device *ndev = wil_to_ndev(wil);
  49. struct va_format vaf = {
  50. .fmt = fmt,
  51. };
  52. va_list args;
  53. va_start(args, fmt);
  54. vaf.va = &args;
  55. netdev_info(ndev, "%pV", &vaf);
  56. trace_wil6210_log_info(&vaf);
  57. va_end(args);
  58. }
  59. void wil_dbg_trace(struct wil6210_priv *wil, const char *fmt, ...)
  60. {
  61. struct va_format vaf = {
  62. .fmt = fmt,
  63. };
  64. va_list args;
  65. va_start(args, fmt);
  66. vaf.va = &args;
  67. trace_wil6210_log_dbg(&vaf);
  68. va_end(args);
  69. }