Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
Larry Finger | a8d7606 | 2012-01-07 20:46:42 -0600 | [diff] [blame] | 3 | * Copyright(c) 2009-2012 Realtek Corporation. |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 4 | * |
Larry Finger | f3a97e9 | 2014-09-22 09:39:24 -0500 | [diff] [blame] | 5 | * This program is free software; you can redistribute it and/or modify it |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 6 | * under the terms of version 2 of the GNU General Public License as |
| 7 | * published by the Free Software Foundation. |
| 8 | * |
Larry Finger | f3a97e9 | 2014-09-22 09:39:24 -0500 | [diff] [blame] | 9 | * This program is distributed in the hope that it will be useful, but WITHOUT |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 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 | * |
Larry Finger | f3a97e9 | 2014-09-22 09:39:24 -0500 | [diff] [blame] | 14 | * The full GNU General Public License is included in this distribution in the |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 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 | |
| 25 | #include "wifi.h" |
| 26 | |
Larry Finger | d273bb2 | 2012-01-27 13:59:25 -0600 | [diff] [blame] | 27 | #include <linux/moduleparam.h> |
| 28 | |
Joe Perches | 9ce2219 | 2016-06-25 15:46:45 -0700 | [diff] [blame] | 29 | #ifdef CONFIG_RTLWIFI_DEBUG |
Ping-Ke Shih | 79b64ed | 2017-06-18 11:12:43 -0500 | [diff] [blame] | 30 | void _rtl_dbg_trace(struct rtl_priv *rtlpriv, u64 comp, int level, |
Larry Finger | 102e295 | 2017-01-19 11:25:19 -0600 | [diff] [blame] | 31 | const char *fmt, ...) |
Joe Perches | 9ce2219 | 2016-06-25 15:46:45 -0700 | [diff] [blame] | 32 | { |
Larry Finger | c34df31 | 2017-01-19 11:25:20 -0600 | [diff] [blame] | 33 | if (unlikely((comp & rtlpriv->cfg->mod_params->debug_mask) && |
| 34 | (level <= rtlpriv->cfg->mod_params->debug_level))) { |
Joe Perches | 9ce2219 | 2016-06-25 15:46:45 -0700 | [diff] [blame] | 35 | struct va_format vaf; |
| 36 | va_list args; |
| 37 | |
| 38 | va_start(args, fmt); |
| 39 | |
| 40 | vaf.fmt = fmt; |
| 41 | vaf.va = &args; |
| 42 | |
Larry Finger | c34df31 | 2017-01-19 11:25:20 -0600 | [diff] [blame] | 43 | pr_info(":<%lx> %pV", in_interrupt(), &vaf); |
Joe Perches | 9ce2219 | 2016-06-25 15:46:45 -0700 | [diff] [blame] | 44 | |
| 45 | va_end(args); |
| 46 | } |
| 47 | } |
| 48 | EXPORT_SYMBOL_GPL(_rtl_dbg_trace); |
Larry Finger | 102e295 | 2017-01-19 11:25:19 -0600 | [diff] [blame] | 49 | |
| 50 | void _rtl_dbg_print(struct rtl_priv *rtlpriv, u64 comp, int level, |
| 51 | const char *fmt, ...) |
| 52 | { |
Larry Finger | c34df31 | 2017-01-19 11:25:20 -0600 | [diff] [blame] | 53 | if (unlikely((comp & rtlpriv->cfg->mod_params->debug_mask) && |
| 54 | (level <= rtlpriv->cfg->mod_params->debug_level))) { |
Larry Finger | 102e295 | 2017-01-19 11:25:19 -0600 | [diff] [blame] | 55 | struct va_format vaf; |
| 56 | va_list args; |
| 57 | |
| 58 | va_start(args, fmt); |
| 59 | |
| 60 | vaf.fmt = fmt; |
| 61 | vaf.va = &args; |
| 62 | |
Larry Finger | c34df31 | 2017-01-19 11:25:20 -0600 | [diff] [blame] | 63 | pr_info("%pV", &vaf); |
Larry Finger | 102e295 | 2017-01-19 11:25:19 -0600 | [diff] [blame] | 64 | |
| 65 | va_end(args); |
| 66 | } |
| 67 | } |
| 68 | EXPORT_SYMBOL_GPL(_rtl_dbg_print); |
| 69 | |
| 70 | void _rtl_dbg_print_data(struct rtl_priv *rtlpriv, u64 comp, int level, |
| 71 | const char *titlestring, |
| 72 | const void *hexdata, int hexdatalen) |
| 73 | { |
Larry Finger | c34df31 | 2017-01-19 11:25:20 -0600 | [diff] [blame] | 74 | if (unlikely(((comp) & rtlpriv->cfg->mod_params->debug_mask) && |
| 75 | ((level) <= rtlpriv->cfg->mod_params->debug_level))) { |
| 76 | pr_info("In process \"%s\" (pid %i): %s\n", |
| 77 | current->comm, current->pid, titlestring); |
Larry Finger | 102e295 | 2017-01-19 11:25:19 -0600 | [diff] [blame] | 78 | print_hex_dump_bytes("", DUMP_PREFIX_NONE, |
| 79 | hexdata, hexdatalen); |
| 80 | } |
| 81 | } |
| 82 | EXPORT_SYMBOL_GPL(_rtl_dbg_print_data); |
| 83 | |
Joe Perches | 9ce2219 | 2016-06-25 15:46:45 -0700 | [diff] [blame] | 84 | #endif |