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