debug.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (c) 2009 Atheros Communications 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 "ath.h"
  17. #include "debug.h"
  18. void ath_print(struct ath_common *common, int dbg_mask, const char *fmt, ...)
  19. {
  20. struct va_format vaf;
  21. va_list args;
  22. if (likely(!(common->debug_mask & dbg_mask)))
  23. return;
  24. va_start(args, fmt);
  25. vaf.fmt = fmt;
  26. vaf.va = &args;
  27. printk(KERN_DEBUG "ath: %pV", &vaf);
  28. va_end(args);
  29. }
  30. EXPORT_SYMBOL(ath_print);
  31. const char *ath_opmode_to_string(enum nl80211_iftype opmode)
  32. {
  33. switch (opmode) {
  34. case NL80211_IFTYPE_UNSPECIFIED:
  35. return "UNSPEC";
  36. case NL80211_IFTYPE_ADHOC:
  37. return "ADHOC";
  38. case NL80211_IFTYPE_STATION:
  39. return "STATION";
  40. case NL80211_IFTYPE_AP:
  41. return "AP";
  42. case NL80211_IFTYPE_AP_VLAN:
  43. return "AP-VLAN";
  44. case NL80211_IFTYPE_WDS:
  45. return "WDS";
  46. case NL80211_IFTYPE_MONITOR:
  47. return "MONITOR";
  48. case NL80211_IFTYPE_MESH_POINT:
  49. return "MESH";
  50. case NL80211_IFTYPE_P2P_CLIENT:
  51. return "P2P-CLIENT";
  52. case NL80211_IFTYPE_P2P_GO:
  53. return "P2P-GO";
  54. default:
  55. return "UNKNOWN";
  56. }
  57. }
  58. EXPORT_SYMBOL(ath_opmode_to_string);