debug.c 2.3 KB
Newer Older
L
Larry Finger 已提交
1 2
/******************************************************************************
 *
L
Larry Finger 已提交
3
 * Copyright(c) 2009-2012  Realtek Corporation.
L
Larry Finger 已提交
4
 *
5
 * This program is free software; you can redistribute it and/or modify it
L
Larry Finger 已提交
6 7 8
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
9
 * This program is distributed in the hope that it will be useful, but WITHOUT
L
Larry Finger 已提交
10 11 12 13
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
14
 * The full GNU General Public License is included in this distribution in the
L
Larry Finger 已提交
15 16 17 18 19 20 21 22 23 24 25 26
 * file called LICENSE.
 *
 * Contact Information:
 * wlanfae <wlanfae@realtek.com>
 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
 * Hsinchu 300, Taiwan.
 *
 * Larry Finger <Larry.Finger@lwfinger.net>
 *****************************************************************************/

#include "wifi.h"

27 28
#include <linux/moduleparam.h>

29
#ifdef CONFIG_RTLWIFI_DEBUG
P
Ping-Ke Shih 已提交
30
void _rtl_dbg_trace(struct rtl_priv *rtlpriv, u64 comp, int level,
31
		    const char *fmt, ...)
32
{
33 34
	if (unlikely((comp & rtlpriv->cfg->mod_params->debug_mask) &&
		     (level <= rtlpriv->cfg->mod_params->debug_level))) {
35 36 37 38 39 40 41 42
		struct va_format vaf;
		va_list args;

		va_start(args, fmt);

		vaf.fmt = fmt;
		vaf.va = &args;

43
		pr_info(":<%lx> %pV", in_interrupt(), &vaf);
44 45 46 47 48

		va_end(args);
	}
}
EXPORT_SYMBOL_GPL(_rtl_dbg_trace);
49 50 51 52

void _rtl_dbg_print(struct rtl_priv *rtlpriv, u64 comp, int level,
		    const char *fmt, ...)
{
53 54
	if (unlikely((comp & rtlpriv->cfg->mod_params->debug_mask) &&
		     (level <= rtlpriv->cfg->mod_params->debug_level))) {
55 56 57 58 59 60 61 62
		struct va_format vaf;
		va_list args;

		va_start(args, fmt);

		vaf.fmt = fmt;
		vaf.va = &args;

63
		pr_info("%pV", &vaf);
64 65 66 67 68 69 70 71 72 73

		va_end(args);
	}
}
EXPORT_SYMBOL_GPL(_rtl_dbg_print);

void _rtl_dbg_print_data(struct rtl_priv *rtlpriv, u64 comp, int level,
			 const char *titlestring,
			 const void *hexdata, int hexdatalen)
{
74 75 76 77
	if (unlikely(((comp) & rtlpriv->cfg->mod_params->debug_mask) &&
		     ((level) <= rtlpriv->cfg->mod_params->debug_level))) {
		pr_info("In process \"%s\" (pid %i): %s\n",
			current->comm, current->pid, titlestring);
78 79 80 81 82 83
		print_hex_dump_bytes("", DUMP_PREFIX_NONE,
				     hexdata, hexdatalen);
	}
}
EXPORT_SYMBOL_GPL(_rtl_dbg_print_data);

84
#endif