debug.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2009-2012 Realtek Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * The full GNU General Public License is included in this distribution in the
  15. * file called LICENSE.
  16. *
  17. * Contact Information:
  18. * wlanfae <wlanfae@realtek.com>
  19. * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
  20. * Hsinchu 300, Taiwan.
  21. *
  22. * Larry Finger <Larry.Finger@lwfinger.net>
  23. *****************************************************************************/
  24. #include "wifi.h"
  25. #include <linux/moduleparam.h>
  26. #ifdef CONFIG_RTLWIFI_DEBUG
  27. void _rtl_dbg_trace(struct rtl_priv *rtlpriv, int comp, int level,
  28. const char *fmt, ...)
  29. {
  30. if (unlikely((comp & rtlpriv->cfg->mod_params->debug_mask) &&
  31. (level <= rtlpriv->cfg->mod_params->debug_level))) {
  32. struct va_format vaf;
  33. va_list args;
  34. va_start(args, fmt);
  35. vaf.fmt = fmt;
  36. vaf.va = &args;
  37. pr_info(":<%lx> %pV", in_interrupt(), &vaf);
  38. va_end(args);
  39. }
  40. }
  41. EXPORT_SYMBOL_GPL(_rtl_dbg_trace);
  42. void _rtl_dbg_print(struct rtl_priv *rtlpriv, u64 comp, int level,
  43. const char *fmt, ...)
  44. {
  45. if (unlikely((comp & rtlpriv->cfg->mod_params->debug_mask) &&
  46. (level <= rtlpriv->cfg->mod_params->debug_level))) {
  47. struct va_format vaf;
  48. va_list args;
  49. va_start(args, fmt);
  50. vaf.fmt = fmt;
  51. vaf.va = &args;
  52. pr_info("%pV", &vaf);
  53. va_end(args);
  54. }
  55. }
  56. EXPORT_SYMBOL_GPL(_rtl_dbg_print);
  57. void _rtl_dbg_print_data(struct rtl_priv *rtlpriv, u64 comp, int level,
  58. const char *titlestring,
  59. const void *hexdata, int hexdatalen)
  60. {
  61. if (unlikely(((comp) & rtlpriv->cfg->mod_params->debug_mask) &&
  62. ((level) <= rtlpriv->cfg->mod_params->debug_level))) {
  63. pr_info("In process \"%s\" (pid %i): %s\n",
  64. current->comm, current->pid, titlestring);
  65. print_hex_dump_bytes("", DUMP_PREFIX_NONE,
  66. hexdata, hexdatalen);
  67. }
  68. }
  69. EXPORT_SYMBOL_GPL(_rtl_dbg_print_data);
  70. #endif