diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2008-12-18 21:37:08 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 15:58:55 -0500 |
commit | 40b8ec0bfa2d96c9feae2bc1596e9b427c77b8da (patch) | |
tree | 9c1bf8e43c1ace421cfe1c6e15c5db5cd573f987 /drivers/net | |
parent | 3d24a9f790c0e39cfdef1446c7100e89c542805c (diff) |
iwl3945: Getting rid of iwl-3945-debug.h
At the cost of adding a debug_level field to iwl3945_priv, we are now able to
get rid of iwl-3945-debug.h, and use iwl-debug.h instead.
Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com>
Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945-debug.h | 167 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945-io.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 13 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debug.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 95 |
7 files changed, 59 insertions, 227 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-debug.h b/drivers/net/wireless/iwlwifi/iwl-3945-debug.h deleted file mode 100644 index 85eb778f9df1..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-3945-debug.h +++ /dev/null | |||
@@ -1,167 +0,0 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved. | ||
4 | * | ||
5 | * Portions of this file are derived from the ipw3945 project. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of version 2 of the GNU General Public License as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
14 | * more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along with | ||
17 | * this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA | ||
19 | * | ||
20 | * The full GNU General Public License is included in this distribution in the | ||
21 | * file called LICENSE. | ||
22 | * | ||
23 | * Contact Information: | ||
24 | * Intel Linux Wireless <ilw@linux.intel.com> | ||
25 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
26 | * | ||
27 | *****************************************************************************/ | ||
28 | |||
29 | #ifndef __iwl3945_debug_h__ | ||
30 | #define __iwl3945_debug_h__ | ||
31 | |||
32 | #ifdef CONFIG_IWL3945_DEBUG | ||
33 | extern u32 iwl3945_debug_level; | ||
34 | #define IWL_DEBUG(level, fmt, args...) \ | ||
35 | do { if (iwl3945_debug_level & (level)) \ | ||
36 | printk(KERN_ERR DRV_NAME": %c %s " fmt, \ | ||
37 | in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0) | ||
38 | |||
39 | #define IWL_DEBUG_LIMIT(level, fmt, args...) \ | ||
40 | do { if ((iwl3945_debug_level & (level)) && net_ratelimit()) \ | ||
41 | printk(KERN_ERR DRV_NAME": %c %s " fmt, \ | ||
42 | in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0) | ||
43 | |||
44 | static inline void iwl3945_print_hex_dump(int level, void *p, u32 len) | ||
45 | { | ||
46 | if (!(iwl3945_debug_level & level)) | ||
47 | return; | ||
48 | |||
49 | print_hex_dump(KERN_DEBUG, "iwl data: ", DUMP_PREFIX_OFFSET, 16, 1, | ||
50 | p, len, 1); | ||
51 | } | ||
52 | #else | ||
53 | static inline void IWL_DEBUG(int level, const char *fmt, ...) | ||
54 | { | ||
55 | } | ||
56 | static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...) | ||
57 | { | ||
58 | } | ||
59 | static inline void iwl3945_print_hex_dump(int level, void *p, u32 len) | ||
60 | { | ||
61 | } | ||
62 | #endif /* CONFIG_IWL3945_DEBUG */ | ||
63 | |||
64 | |||
65 | |||
66 | /* | ||
67 | * To use the debug system; | ||
68 | * | ||
69 | * If you are defining a new debug classification, simply add it to the #define | ||
70 | * list here in the form of: | ||
71 | * | ||
72 | * #define IWL_DL_xxxx VALUE | ||
73 | * | ||
74 | * shifting value to the left one bit from the previous entry. xxxx should be | ||
75 | * the name of the classification (for example, WEP) | ||
76 | * | ||
77 | * You then need to either add a IWL_xxxx_DEBUG() macro definition for your | ||
78 | * classification, or use IWL_DEBUG(IWL_DL_xxxx, ...) whenever you want | ||
79 | * to send output to that classification. | ||
80 | * | ||
81 | * To add your debug level to the list of levels seen when you perform | ||
82 | * | ||
83 | * % cat /proc/net/iwl/debug_level | ||
84 | * | ||
85 | * you simply need to add your entry to the iwl3945_debug_levels array. | ||
86 | * | ||
87 | * If you do not see debug_level in /proc/net/iwl then you do not have | ||
88 | * CONFIG_IWL3945_DEBUG defined in your kernel configuration | ||
89 | * | ||
90 | */ | ||
91 | |||
92 | #define IWL_DL_INFO (1 << 0) | ||
93 | #define IWL_DL_MAC80211 (1 << 1) | ||
94 | #define IWL_DL_HOST_COMMAND (1 << 2) | ||
95 | #define IWL_DL_STATE (1 << 3) | ||
96 | |||
97 | #define IWL_DL_RADIO (1 << 7) | ||
98 | #define IWL_DL_POWER (1 << 8) | ||
99 | #define IWL_DL_TEMP (1 << 9) | ||
100 | |||
101 | #define IWL_DL_NOTIF (1 << 10) | ||
102 | #define IWL_DL_SCAN (1 << 11) | ||
103 | #define IWL_DL_ASSOC (1 << 12) | ||
104 | #define IWL_DL_DROP (1 << 13) | ||
105 | |||
106 | #define IWL_DL_TXPOWER (1 << 14) | ||
107 | |||
108 | #define IWL_DL_AP (1 << 15) | ||
109 | |||
110 | #define IWL_DL_FW (1 << 16) | ||
111 | #define IWL_DL_RF_KILL (1 << 17) | ||
112 | #define IWL_DL_FW_ERRORS (1 << 18) | ||
113 | |||
114 | #define IWL_DL_LED (1 << 19) | ||
115 | |||
116 | #define IWL_DL_RATE (1 << 20) | ||
117 | |||
118 | #define IWL_DL_CALIB (1 << 21) | ||
119 | #define IWL_DL_WEP (1 << 22) | ||
120 | #define IWL_DL_TX (1 << 23) | ||
121 | #define IWL_DL_RX (1 << 24) | ||
122 | #define IWL_DL_ISR (1 << 25) | ||
123 | #define IWL_DL_HT (1 << 26) | ||
124 | #define IWL_DL_IO (1 << 27) | ||
125 | #define IWL_DL_11H (1 << 28) | ||
126 | |||
127 | #define IWL_DL_STATS (1 << 29) | ||
128 | #define IWL_DL_TX_REPLY (1 << 30) | ||
129 | #define IWL_DL_QOS (1 << 31) | ||
130 | |||
131 | #define IWL_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a) | ||
132 | #define IWL_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a) | ||
133 | #define IWL_DEBUG_INFO(f, a...) IWL_DEBUG(IWL_DL_INFO, f, ## a) | ||
134 | |||
135 | #define IWL_DEBUG_MAC80211(f, a...) IWL_DEBUG(IWL_DL_MAC80211, f, ## a) | ||
136 | #define IWL_DEBUG_TEMP(f, a...) IWL_DEBUG(IWL_DL_TEMP, f, ## a) | ||
137 | #define IWL_DEBUG_SCAN(f, a...) IWL_DEBUG(IWL_DL_SCAN, f, ## a) | ||
138 | #define IWL_DEBUG_RX(f, a...) IWL_DEBUG(IWL_DL_RX, f, ## a) | ||
139 | #define IWL_DEBUG_TX(f, a...) IWL_DEBUG(IWL_DL_TX, f, ## a) | ||
140 | #define IWL_DEBUG_ISR(f, a...) IWL_DEBUG(IWL_DL_ISR, f, ## a) | ||
141 | #define IWL_DEBUG_LED(f, a...) IWL_DEBUG(IWL_DL_LED, f, ## a) | ||
142 | #define IWL_DEBUG_WEP(f, a...) IWL_DEBUG(IWL_DL_WEP, f, ## a) | ||
143 | #define IWL_DEBUG_HC(f, a...) IWL_DEBUG(IWL_DL_HOST_COMMAND, f, ## a) | ||
144 | #define IWL_DEBUG_CALIB(f, a...) IWL_DEBUG(IWL_DL_CALIB, f, ## a) | ||
145 | #define IWL_DEBUG_FW(f, a...) IWL_DEBUG(IWL_DL_FW, f, ## a) | ||
146 | #define IWL_DEBUG_RF_KILL(f, a...) IWL_DEBUG(IWL_DL_RF_KILL, f, ## a) | ||
147 | #define IWL_DEBUG_DROP(f, a...) IWL_DEBUG(IWL_DL_DROP, f, ## a) | ||
148 | #define IWL_DEBUG_DROP_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_DROP, f, ## a) | ||
149 | #define IWL_DEBUG_AP(f, a...) IWL_DEBUG(IWL_DL_AP, f, ## a) | ||
150 | #define IWL_DEBUG_TXPOWER(f, a...) IWL_DEBUG(IWL_DL_TXPOWER, f, ## a) | ||
151 | #define IWL_DEBUG_IO(f, a...) IWL_DEBUG(IWL_DL_IO, f, ## a) | ||
152 | #define IWL_DEBUG_RATE(f, a...) IWL_DEBUG(IWL_DL_RATE, f, ## a) | ||
153 | #define IWL_DEBUG_RATE_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_RATE, f, ## a) | ||
154 | #define IWL_DEBUG_NOTIF(f, a...) IWL_DEBUG(IWL_DL_NOTIF, f, ## a) | ||
155 | #define IWL_DEBUG_ASSOC(f, a...) IWL_DEBUG(IWL_DL_ASSOC | IWL_DL_INFO, f, ## a) | ||
156 | #define IWL_DEBUG_ASSOC_LIMIT(f, a...) \ | ||
157 | IWL_DEBUG_LIMIT(IWL_DL_ASSOC | IWL_DL_INFO, f, ## a) | ||
158 | #define IWL_DEBUG_HT(f, a...) IWL_DEBUG(IWL_DL_HT, f, ## a) | ||
159 | #define IWL_DEBUG_STATS(f, a...) IWL_DEBUG(IWL_DL_STATS, f, ## a) | ||
160 | #define IWL_DEBUG_STATS_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_STATS, f, ## a) | ||
161 | #define IWL_DEBUG_TX_REPLY(f, a...) IWL_DEBUG(IWL_DL_TX_REPLY, f, ## a) | ||
162 | #define IWL_DEBUG_QOS(f, a...) IWL_DEBUG(IWL_DL_QOS, f, ## a) | ||
163 | #define IWL_DEBUG_RADIO(f, a...) IWL_DEBUG(IWL_DL_RADIO, f, ## a) | ||
164 | #define IWL_DEBUG_POWER(f, a...) IWL_DEBUG(IWL_DL_POWER, f, ## a) | ||
165 | #define IWL_DEBUG_11H(f, a...) IWL_DEBUG(IWL_DL_11H, f, ## a) | ||
166 | |||
167 | #endif | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-io.h b/drivers/net/wireless/iwlwifi/iwl-3945-io.h index 2440fd664dd5..d49dfd1ff538 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-io.h | |||
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
33 | 33 | ||
34 | #include "iwl-3945-debug.h" | 34 | #include "iwl-debug.h" |
35 | 35 | ||
36 | /* | 36 | /* |
37 | * IO, register, and NIC memory access functions | 37 | * IO, register, and NIC memory access functions |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index 9d63cdb5ea0f..42b8bc495d8f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
@@ -52,6 +52,7 @@ struct iwl3945_rate_scale_data { | |||
52 | 52 | ||
53 | struct iwl3945_rs_sta { | 53 | struct iwl3945_rs_sta { |
54 | spinlock_t lock; | 54 | spinlock_t lock; |
55 | struct iwl3945_priv *priv; | ||
55 | s32 *expected_tpt; | 56 | s32 *expected_tpt; |
56 | unsigned long last_partial_flush; | 57 | unsigned long last_partial_flush; |
57 | unsigned long last_flush; | 58 | unsigned long last_flush; |
@@ -182,6 +183,7 @@ static int iwl3945_rate_scale_flush_windows(struct iwl3945_rs_sta *rs_sta) | |||
182 | int unflushed = 0; | 183 | int unflushed = 0; |
183 | int i; | 184 | int i; |
184 | unsigned long flags; | 185 | unsigned long flags; |
186 | struct iwl3945_priv *priv = rs_sta->priv; | ||
185 | 187 | ||
186 | /* | 188 | /* |
187 | * For each rate, if we have collected data on that rate | 189 | * For each rate, if we have collected data on that rate |
@@ -214,6 +216,7 @@ static int iwl3945_rate_scale_flush_windows(struct iwl3945_rs_sta *rs_sta) | |||
214 | static void iwl3945_bg_rate_scale_flush(unsigned long data) | 216 | static void iwl3945_bg_rate_scale_flush(unsigned long data) |
215 | { | 217 | { |
216 | struct iwl3945_rs_sta *rs_sta = (void *)data; | 218 | struct iwl3945_rs_sta *rs_sta = (void *)data; |
219 | struct iwl3945_priv *priv = rs_sta->priv; | ||
217 | int unflushed = 0; | 220 | int unflushed = 0; |
218 | unsigned long flags; | 221 | unsigned long flags; |
219 | u32 packet_count, duration, pps; | 222 | u32 packet_count, duration, pps; |
@@ -287,6 +290,7 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta, | |||
287 | { | 290 | { |
288 | unsigned long flags; | 291 | unsigned long flags; |
289 | s32 fail_count; | 292 | s32 fail_count; |
293 | struct iwl3945_priv *priv = rs_sta->priv; | ||
290 | 294 | ||
291 | if (!retries) { | 295 | if (!retries) { |
292 | IWL_DEBUG_RATE("leave: retries == 0 -- should be at least 1\n"); | 296 | IWL_DEBUG_RATE("leave: retries == 0 -- should be at least 1\n"); |
@@ -380,10 +384,11 @@ static void rs_free(void *priv) | |||
380 | return; | 384 | return; |
381 | } | 385 | } |
382 | 386 | ||
383 | static void *rs_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) | 387 | static void *rs_alloc_sta(void *iwl_priv, struct ieee80211_sta *sta, gfp_t gfp) |
384 | { | 388 | { |
385 | struct iwl3945_rs_sta *rs_sta; | 389 | struct iwl3945_rs_sta *rs_sta; |
386 | struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; | 390 | struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; |
391 | struct iwl3945_priv *priv = iwl_priv; | ||
387 | int i; | 392 | int i; |
388 | 393 | ||
389 | /* | 394 | /* |
@@ -403,6 +408,8 @@ static void *rs_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) | |||
403 | 408 | ||
404 | spin_lock_init(&rs_sta->lock); | 409 | spin_lock_init(&rs_sta->lock); |
405 | 410 | ||
411 | rs_sta->priv = priv; | ||
412 | |||
406 | rs_sta->start_rate = IWL_RATE_INVALID; | 413 | rs_sta->start_rate = IWL_RATE_INVALID; |
407 | 414 | ||
408 | /* default to just 802.11b */ | 415 | /* default to just 802.11b */ |
@@ -426,11 +433,12 @@ static void *rs_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) | |||
426 | return rs_sta; | 433 | return rs_sta; |
427 | } | 434 | } |
428 | 435 | ||
429 | static void rs_free_sta(void *priv, struct ieee80211_sta *sta, | 436 | static void rs_free_sta(void *iwl_priv, struct ieee80211_sta *sta, |
430 | void *priv_sta) | 437 | void *priv_sta) |
431 | { | 438 | { |
432 | struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; | 439 | struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; |
433 | struct iwl3945_rs_sta *rs_sta = priv_sta; | 440 | struct iwl3945_rs_sta *rs_sta = priv_sta; |
441 | struct iwl3945_priv *priv = rs_sta->priv; | ||
434 | 442 | ||
435 | psta->rs_sta = NULL; | 443 | psta->rs_sta = NULL; |
436 | 444 | ||
@@ -548,6 +556,7 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta, | |||
548 | { | 556 | { |
549 | u8 high = IWL_RATE_INVALID; | 557 | u8 high = IWL_RATE_INVALID; |
550 | u8 low = IWL_RATE_INVALID; | 558 | u8 low = IWL_RATE_INVALID; |
559 | struct iwl3945_priv *priv = rs_sta->priv; | ||
551 | 560 | ||
552 | /* 802.11A walks to the next literal adjacent rate in | 561 | /* 802.11A walks to the next literal adjacent rate in |
553 | * the rate table */ | 562 | * the rate table */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 080f1a856325..b64e07f0dad5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -542,7 +542,7 @@ static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv, | |||
542 | } | 542 | } |
543 | } | 543 | } |
544 | if (print_dump) | 544 | if (print_dump) |
545 | iwl3945_print_hex_dump(IWL_DL_RX, data, length); | 545 | iwl_print_hex_dump(priv, IWL_DL_RX, data, length); |
546 | } | 546 | } |
547 | #else | 547 | #else |
548 | static inline void iwl3945_dbg_report_frame(struct iwl3945_priv *priv, | 548 | static inline void iwl3945_dbg_report_frame(struct iwl3945_priv *priv, |
@@ -708,7 +708,7 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv, | |||
708 | rx_status.noise, rx_status.rate_idx); | 708 | rx_status.noise, rx_status.rate_idx); |
709 | 709 | ||
710 | #ifdef CONFIG_IWL3945_DEBUG | 710 | #ifdef CONFIG_IWL3945_DEBUG |
711 | if (iwl3945_debug_level & (IWL_DL_RX)) | 711 | if (priv->debug_level & (IWL_DL_RX)) |
712 | /* Set "1" to report good data frames in groups of 100 */ | 712 | /* Set "1" to report good data frames in groups of 100 */ |
713 | iwl3945_dbg_report_frame(priv, pkt, header, 1); | 713 | iwl3945_dbg_report_frame(priv, pkt, header, 1); |
714 | #endif | 714 | #endif |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index 5d5176a62562..d5154ecbe898 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h | |||
@@ -47,7 +47,7 @@ extern struct pci_device_id iwl3945_hw_card_ids[]; | |||
47 | #include "iwl-csr.h" | 47 | #include "iwl-csr.h" |
48 | #include "iwl-prph.h" | 48 | #include "iwl-prph.h" |
49 | #include "iwl-3945-hw.h" | 49 | #include "iwl-3945-hw.h" |
50 | #include "iwl-3945-debug.h" | 50 | #include "iwl-debug.h" |
51 | #include "iwl-3945-led.h" | 51 | #include "iwl-3945-led.h" |
52 | 52 | ||
53 | /* Highest firmware API version supported */ | 53 | /* Highest firmware API version supported */ |
@@ -889,6 +889,7 @@ struct iwl3945_priv { | |||
889 | 889 | ||
890 | #ifdef CONFIG_IWL3945_DEBUG | 890 | #ifdef CONFIG_IWL3945_DEBUG |
891 | /* debugging info */ | 891 | /* debugging info */ |
892 | u32 debug_level; | ||
892 | u32 framecnt_to_us; | 893 | u32 framecnt_to_us; |
893 | atomic_t restrict_refcnt; | 894 | atomic_t restrict_refcnt; |
894 | #endif | 895 | #endif |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h index 7c4ee0cd81c6..f98921880abf 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-debug.h | |||
@@ -29,6 +29,8 @@ | |||
29 | #ifndef __iwl_debug_h__ | 29 | #ifndef __iwl_debug_h__ |
30 | #define __iwl_debug_h__ | 30 | #define __iwl_debug_h__ |
31 | 31 | ||
32 | struct iwl_priv; | ||
33 | |||
32 | #ifdef CONFIG_IWLWIFI_DEBUG | 34 | #ifdef CONFIG_IWLWIFI_DEBUG |
33 | #define IWL_DEBUG(level, fmt, args...) \ | 35 | #define IWL_DEBUG(level, fmt, args...) \ |
34 | do { if (priv->debug_level & (level)) \ | 36 | do { if (priv->debug_level & (level)) \ |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 3d8669c6cc83..c706ccff159b 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -52,10 +52,6 @@ | |||
52 | #include "iwl-3945-fh.h" | 52 | #include "iwl-3945-fh.h" |
53 | #include "iwl-helpers.h" | 53 | #include "iwl-helpers.h" |
54 | 54 | ||
55 | #ifdef CONFIG_IWL3945_DEBUG | ||
56 | u32 iwl3945_debug_level; | ||
57 | #endif | ||
58 | |||
59 | static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv, | 55 | static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv, |
60 | struct iwl3945_tx_queue *txq); | 56 | struct iwl3945_tx_queue *txq); |
61 | 57 | ||
@@ -2434,7 +2430,7 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h | |||
2434 | IWL_DEBUG_DROP("Station %pM not in station map. " | 2430 | IWL_DEBUG_DROP("Station %pM not in station map. " |
2435 | "Defaulting to broadcast...\n", | 2431 | "Defaulting to broadcast...\n", |
2436 | hdr->addr1); | 2432 | hdr->addr1); |
2437 | iwl3945_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); | 2433 | iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); |
2438 | return priv->hw_setting.bcast_sta_id; | 2434 | return priv->hw_setting.bcast_sta_id; |
2439 | } | 2435 | } |
2440 | /* If we are in monitor mode, use BCAST. This is required for | 2436 | /* If we are in monitor mode, use BCAST. This is required for |
@@ -2640,10 +2636,10 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb) | |||
2640 | txq->need_update = 0; | 2636 | txq->need_update = 0; |
2641 | } | 2637 | } |
2642 | 2638 | ||
2643 | iwl3945_print_hex_dump(IWL_DL_TX, out_cmd->cmd.payload, | 2639 | iwl_print_hex_dump(priv, IWL_DL_TX, out_cmd->cmd.payload, |
2644 | sizeof(out_cmd->cmd.tx)); | 2640 | sizeof(out_cmd->cmd.tx)); |
2645 | 2641 | ||
2646 | iwl3945_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, | 2642 | iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, |
2647 | ieee80211_hdrlen(fc)); | 2643 | ieee80211_hdrlen(fc)); |
2648 | 2644 | ||
2649 | /* Tell device the write index *just past* this latest filled TFD */ | 2645 | /* Tell device the write index *just past* this latest filled TFD */ |
@@ -3050,7 +3046,8 @@ static void iwl3945_rx_pm_debug_statistics_notif(struct iwl3945_priv *priv, | |||
3050 | IWL_DEBUG_RADIO("Dumping %d bytes of unhandled " | 3046 | IWL_DEBUG_RADIO("Dumping %d bytes of unhandled " |
3051 | "notification for %s:\n", | 3047 | "notification for %s:\n", |
3052 | le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd)); | 3048 | le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd)); |
3053 | iwl3945_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len)); | 3049 | iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->u.raw, |
3050 | le32_to_cpu(pkt->len)); | ||
3054 | } | 3051 | } |
3055 | 3052 | ||
3056 | static void iwl3945_bg_beacon_update(struct work_struct *work) | 3053 | static void iwl3945_bg_beacon_update(struct work_struct *work) |
@@ -3850,13 +3847,13 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv) | |||
3850 | * handle those that need handling via function in | 3847 | * handle those that need handling via function in |
3851 | * rx_handlers table. See iwl3945_setup_rx_handlers() */ | 3848 | * rx_handlers table. See iwl3945_setup_rx_handlers() */ |
3852 | if (priv->rx_handlers[pkt->hdr.cmd]) { | 3849 | if (priv->rx_handlers[pkt->hdr.cmd]) { |
3853 | IWL_DEBUG(IWL_DL_HOST_COMMAND | IWL_DL_RX | IWL_DL_ISR, | 3850 | IWL_DEBUG(IWL_DL_HCMD | IWL_DL_RX | IWL_DL_ISR, |
3854 | "r = %d, i = %d, %s, 0x%02x\n", r, i, | 3851 | "r = %d, i = %d, %s, 0x%02x\n", r, i, |
3855 | get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); | 3852 | get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); |
3856 | priv->rx_handlers[pkt->hdr.cmd] (priv, rxb); | 3853 | priv->rx_handlers[pkt->hdr.cmd] (priv, rxb); |
3857 | } else { | 3854 | } else { |
3858 | /* No handling needed */ | 3855 | /* No handling needed */ |
3859 | IWL_DEBUG(IWL_DL_HOST_COMMAND | IWL_DL_RX | IWL_DL_ISR, | 3856 | IWL_DEBUG(IWL_DL_HCMD | IWL_DL_RX | IWL_DL_ISR, |
3860 | "r %d i %d No handler needed for %s, 0x%02x\n", | 3857 | "r %d i %d No handler needed for %s, 0x%02x\n", |
3861 | r, i, get_cmd_string(pkt->hdr.cmd), | 3858 | r, i, get_cmd_string(pkt->hdr.cmd), |
3862 | pkt->hdr.cmd); | 3859 | pkt->hdr.cmd); |
@@ -3951,10 +3948,11 @@ static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv, | |||
3951 | } | 3948 | } |
3952 | 3949 | ||
3953 | #ifdef CONFIG_IWL3945_DEBUG | 3950 | #ifdef CONFIG_IWL3945_DEBUG |
3954 | static void iwl3945_print_rx_config_cmd(struct iwl3945_rxon_cmd *rxon) | 3951 | static void iwl3945_print_rx_config_cmd(struct iwl3945_priv *priv, |
3952 | struct iwl3945_rxon_cmd *rxon) | ||
3955 | { | 3953 | { |
3956 | IWL_DEBUG_RADIO("RX CONFIG:\n"); | 3954 | IWL_DEBUG_RADIO("RX CONFIG:\n"); |
3957 | iwl3945_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); | 3955 | iwl_print_hex_dump(priv, IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); |
3958 | IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel)); | 3956 | IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel)); |
3959 | IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); | 3957 | IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); |
3960 | IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n", | 3958 | IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n", |
@@ -4188,10 +4186,10 @@ static void iwl3945_irq_handle_error(struct iwl3945_priv *priv) | |||
4188 | clear_bit(STATUS_HCMD_ACTIVE, &priv->status); | 4186 | clear_bit(STATUS_HCMD_ACTIVE, &priv->status); |
4189 | 4187 | ||
4190 | #ifdef CONFIG_IWL3945_DEBUG | 4188 | #ifdef CONFIG_IWL3945_DEBUG |
4191 | if (iwl3945_debug_level & IWL_DL_FW_ERRORS) { | 4189 | if (priv->debug_level & IWL_DL_FW_ERRORS) { |
4192 | iwl3945_dump_nic_error_log(priv); | 4190 | iwl3945_dump_nic_error_log(priv); |
4193 | iwl3945_dump_nic_event_log(priv); | 4191 | iwl3945_dump_nic_event_log(priv); |
4194 | iwl3945_print_rx_config_cmd(&priv->staging_rxon); | 4192 | iwl3945_print_rx_config_cmd(priv, &priv->staging_rxon); |
4195 | } | 4193 | } |
4196 | #endif | 4194 | #endif |
4197 | 4195 | ||
@@ -4255,7 +4253,7 @@ static void iwl3945_irq_tasklet(struct iwl3945_priv *priv) | |||
4255 | iwl3945_write32(priv, CSR_FH_INT_STATUS, inta_fh); | 4253 | iwl3945_write32(priv, CSR_FH_INT_STATUS, inta_fh); |
4256 | 4254 | ||
4257 | #ifdef CONFIG_IWL3945_DEBUG | 4255 | #ifdef CONFIG_IWL3945_DEBUG |
4258 | if (iwl3945_debug_level & IWL_DL_ISR) { | 4256 | if (priv->debug_level & IWL_DL_ISR) { |
4259 | /* just for debug */ | 4257 | /* just for debug */ |
4260 | inta_mask = iwl3945_read32(priv, CSR_INT_MASK); | 4258 | inta_mask = iwl3945_read32(priv, CSR_INT_MASK); |
4261 | IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", | 4259 | IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", |
@@ -4289,7 +4287,7 @@ static void iwl3945_irq_tasklet(struct iwl3945_priv *priv) | |||
4289 | } | 4287 | } |
4290 | 4288 | ||
4291 | #ifdef CONFIG_IWL3945_DEBUG | 4289 | #ifdef CONFIG_IWL3945_DEBUG |
4292 | if (iwl3945_debug_level & (IWL_DL_ISR)) { | 4290 | if (priv->debug_level & (IWL_DL_ISR)) { |
4293 | /* NIC fires this, but we don't use it, redundant with WAKEUP */ | 4291 | /* NIC fires this, but we don't use it, redundant with WAKEUP */ |
4294 | if (inta & CSR_INT_BIT_SCD) | 4292 | if (inta & CSR_INT_BIT_SCD) |
4295 | IWL_DEBUG_ISR("Scheduler finished to transmit " | 4293 | IWL_DEBUG_ISR("Scheduler finished to transmit " |
@@ -4360,7 +4358,7 @@ static void iwl3945_irq_tasklet(struct iwl3945_priv *priv) | |||
4360 | iwl3945_enable_interrupts(priv); | 4358 | iwl3945_enable_interrupts(priv); |
4361 | 4359 | ||
4362 | #ifdef CONFIG_IWL3945_DEBUG | 4360 | #ifdef CONFIG_IWL3945_DEBUG |
4363 | if (iwl3945_debug_level & (IWL_DL_ISR)) { | 4361 | if (priv->debug_level & (IWL_DL_ISR)) { |
4364 | inta = iwl3945_read32(priv, CSR_INT); | 4362 | inta = iwl3945_read32(priv, CSR_INT); |
4365 | inta_mask = iwl3945_read32(priv, CSR_INT_MASK); | 4363 | inta_mask = iwl3945_read32(priv, CSR_INT_MASK); |
4366 | inta_fh = iwl3945_read32(priv, CSR_FH_INT_STATUS); | 4364 | inta_fh = iwl3945_read32(priv, CSR_FH_INT_STATUS); |
@@ -7143,9 +7141,6 @@ static int iwl3945_mac_get_tx_stats(struct ieee80211_hw *hw, | |||
7143 | static int iwl3945_mac_get_stats(struct ieee80211_hw *hw, | 7141 | static int iwl3945_mac_get_stats(struct ieee80211_hw *hw, |
7144 | struct ieee80211_low_level_stats *stats) | 7142 | struct ieee80211_low_level_stats *stats) |
7145 | { | 7143 | { |
7146 | IWL_DEBUG_MAC80211("enter\n"); | ||
7147 | IWL_DEBUG_MAC80211("leave\n"); | ||
7148 | |||
7149 | return 0; | 7144 | return 0; |
7150 | } | 7145 | } |
7151 | 7146 | ||
@@ -7260,29 +7255,33 @@ static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk | |||
7260 | * | 7255 | * |
7261 | * See the level definitions in iwl for details. | 7256 | * See the level definitions in iwl for details. |
7262 | */ | 7257 | */ |
7263 | 7258 | static ssize_t show_debug_level(struct device *d, | |
7264 | static ssize_t show_debug_level(struct device_driver *d, char *buf) | 7259 | struct device_attribute *attr, char *buf) |
7265 | { | 7260 | { |
7266 | return sprintf(buf, "0x%08X\n", iwl3945_debug_level); | 7261 | struct iwl3945_priv *priv = d->driver_data; |
7262 | |||
7263 | return sprintf(buf, "0x%08X\n", priv->debug_level); | ||
7267 | } | 7264 | } |
7268 | static ssize_t store_debug_level(struct device_driver *d, | 7265 | static ssize_t store_debug_level(struct device *d, |
7266 | struct device_attribute *attr, | ||
7269 | const char *buf, size_t count) | 7267 | const char *buf, size_t count) |
7270 | { | 7268 | { |
7271 | char *p = (char *)buf; | 7269 | struct iwl3945_priv *priv = d->driver_data; |
7272 | u32 val; | 7270 | unsigned long val; |
7271 | int ret; | ||
7273 | 7272 | ||
7274 | val = simple_strtoul(p, &p, 0); | 7273 | ret = strict_strtoul(buf, 0, &val); |
7275 | if (p == buf) | 7274 | if (ret) |
7276 | printk(KERN_INFO DRV_NAME | 7275 | printk(KERN_INFO DRV_NAME |
7277 | ": %s is not in hex or decimal form.\n", buf); | 7276 | ": %s is not in hex or decimal form.\n", buf); |
7278 | else | 7277 | else |
7279 | iwl3945_debug_level = val; | 7278 | priv->debug_level = val; |
7280 | 7279 | ||
7281 | return strnlen(buf, count); | 7280 | return strnlen(buf, count); |
7282 | } | 7281 | } |
7283 | 7282 | ||
7284 | static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, | 7283 | static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO, |
7285 | show_debug_level, store_debug_level); | 7284 | show_debug_level, store_debug_level); |
7286 | 7285 | ||
7287 | #endif /* CONFIG_IWL3945_DEBUG */ | 7286 | #endif /* CONFIG_IWL3945_DEBUG */ |
7288 | 7287 | ||
@@ -7763,7 +7762,9 @@ static struct attribute *iwl3945_sysfs_entries[] = { | |||
7763 | &dev_attr_status.attr, | 7762 | &dev_attr_status.attr, |
7764 | &dev_attr_temperature.attr, | 7763 | &dev_attr_temperature.attr, |
7765 | &dev_attr_tx_power.attr, | 7764 | &dev_attr_tx_power.attr, |
7766 | 7765 | #ifdef CONFIG_IWL3945_DEBUG | |
7766 | &dev_attr_debug_level.attr, | ||
7767 | #endif | ||
7767 | NULL | 7768 | NULL |
7768 | }; | 7769 | }; |
7769 | 7770 | ||
@@ -7802,13 +7803,6 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
7802 | * 1. Allocating HW data | 7803 | * 1. Allocating HW data |
7803 | * ********************/ | 7804 | * ********************/ |
7804 | 7805 | ||
7805 | /* Disabling hardware scan means that mac80211 will perform scans | ||
7806 | * "the hard way", rather than using device's scan. */ | ||
7807 | if (iwl3945_param_disable_hw_scan) { | ||
7808 | IWL_DEBUG_INFO("Disabling hw_scan\n"); | ||
7809 | iwl3945_hw_ops.hw_scan = NULL; | ||
7810 | } | ||
7811 | |||
7812 | if ((iwl3945_param_queues_num > IWL39_MAX_NUM_QUEUES) || | 7806 | if ((iwl3945_param_queues_num > IWL39_MAX_NUM_QUEUES) || |
7813 | (iwl3945_param_queues_num < IWL_MIN_NUM_QUEUES)) { | 7807 | (iwl3945_param_queues_num < IWL_MIN_NUM_QUEUES)) { |
7814 | IWL_ERROR("invalid queues_num, should be between %d and %d\n", | 7808 | IWL_ERROR("invalid queues_num, should be between %d and %d\n", |
@@ -7833,6 +7827,13 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
7833 | priv->pci_dev = pdev; | 7827 | priv->pci_dev = pdev; |
7834 | priv->cfg = cfg; | 7828 | priv->cfg = cfg; |
7835 | 7829 | ||
7830 | /* Disabling hardware scan means that mac80211 will perform scans | ||
7831 | * "the hard way", rather than using device's scan. */ | ||
7832 | if (iwl3945_param_disable_hw_scan) { | ||
7833 | IWL_DEBUG_INFO("Disabling hw_scan\n"); | ||
7834 | iwl3945_hw_ops.hw_scan = NULL; | ||
7835 | } | ||
7836 | |||
7836 | IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); | 7837 | IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); |
7837 | hw->rate_control_algorithm = "iwl-3945-rs"; | 7838 | hw->rate_control_algorithm = "iwl-3945-rs"; |
7838 | hw->sta_data_size = sizeof(struct iwl3945_sta_priv); | 7839 | hw->sta_data_size = sizeof(struct iwl3945_sta_priv); |
@@ -7840,7 +7841,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
7840 | /* Select antenna (may be helpful if only one antenna is connected) */ | 7841 | /* Select antenna (may be helpful if only one antenna is connected) */ |
7841 | priv->antenna = (enum iwl3945_antenna)iwl3945_param_antenna; | 7842 | priv->antenna = (enum iwl3945_antenna)iwl3945_param_antenna; |
7842 | #ifdef CONFIG_IWL3945_DEBUG | 7843 | #ifdef CONFIG_IWL3945_DEBUG |
7843 | iwl3945_debug_level = iwl3945_param_debug; | 7844 | priv->debug_level = iwl3945_param_debug; |
7844 | atomic_set(&priv->restrict_refcnt, 0); | 7845 | atomic_set(&priv->restrict_refcnt, 0); |
7845 | #endif | 7846 | #endif |
7846 | 7847 | ||
@@ -8301,20 +8302,9 @@ static int __init iwl3945_init(void) | |||
8301 | IWL_ERROR("Unable to initialize PCI module\n"); | 8302 | IWL_ERROR("Unable to initialize PCI module\n"); |
8302 | goto error_register; | 8303 | goto error_register; |
8303 | } | 8304 | } |
8304 | #ifdef CONFIG_IWL3945_DEBUG | ||
8305 | ret = driver_create_file(&iwl3945_driver.driver, &driver_attr_debug_level); | ||
8306 | if (ret) { | ||
8307 | IWL_ERROR("Unable to create driver sysfs file\n"); | ||
8308 | goto error_debug; | ||
8309 | } | ||
8310 | #endif | ||
8311 | 8305 | ||
8312 | return ret; | 8306 | return ret; |
8313 | 8307 | ||
8314 | #ifdef CONFIG_IWL3945_DEBUG | ||
8315 | error_debug: | ||
8316 | pci_unregister_driver(&iwl3945_driver); | ||
8317 | #endif | ||
8318 | error_register: | 8308 | error_register: |
8319 | iwl3945_rate_control_unregister(); | 8309 | iwl3945_rate_control_unregister(); |
8320 | return ret; | 8310 | return ret; |
@@ -8322,9 +8312,6 @@ error_register: | |||
8322 | 8312 | ||
8323 | static void __exit iwl3945_exit(void) | 8313 | static void __exit iwl3945_exit(void) |
8324 | { | 8314 | { |
8325 | #ifdef CONFIG_IWL3945_DEBUG | ||
8326 | driver_remove_file(&iwl3945_driver.driver, &driver_attr_debug_level); | ||
8327 | #endif | ||
8328 | pci_unregister_driver(&iwl3945_driver); | 8315 | pci_unregister_driver(&iwl3945_driver); |
8329 | iwl3945_rate_control_unregister(); | 8316 | iwl3945_rate_control_unregister(); |
8330 | } | 8317 | } |