madwifi build scripts cleanup
[15.05/openwrt.git] / package / madwifi / patches / 200-no_debug.patch
1 Index: madwifi-trunk-r3314/ath/if_ath.c
2 ===================================================================
3 --- madwifi-trunk-r3314.orig/ath/if_ath.c       2008-05-19 14:54:42.000000000 +0200
4 +++ madwifi-trunk-r3314/ath/if_ath.c    2008-05-19 14:54:47.000000000 +0200
5 @@ -42,7 +42,6 @@
6   * This software is derived from work of Atsushi Onoe; his contribution
7   * is greatly appreciated.
8   */
9 -#define        AR_DEBUG
10  #include "if_ath_debug.h"
11  #include "opt_ah.h"
12  
13 @@ -368,8 +367,10 @@
14  static void ath_set_dfs_cac_time(struct ieee80211com *, unsigned int seconds);
15  
16  static unsigned int ath_test_radar(struct ieee80211com *);
17 -static unsigned int ath_dump_hal_map(struct ieee80211com *ic);
18 +#ifdef AR_DEBUG
19  
20 +static unsigned int ath_dump_hal_map(struct ieee80211com *ic);
21 +#endif
22  static u_int32_t ath_get_clamped_maxtxpower(struct ath_softc *sc);
23  static u_int32_t ath_set_clamped_maxtxpower(struct ath_softc *sc, 
24                 u_int32_t new_clamped_maxtxpower);
25 @@ -520,9 +521,11 @@
26         u_int8_t csz;
27  
28         sc->devid = devid;
29 +#ifdef AR_DEBUG
30         ath_debug_global = (ath_debug & ATH_DEBUG_GLOBAL);
31         sc->sc_debug     = (ath_debug & ~ATH_DEBUG_GLOBAL);
32         DPRINTF(sc, ATH_DEBUG_ANY, "%s: devid 0x%x\n", __func__, devid);
33 +#endif
34  
35         /* Allocate space for dynamically determined maximum VAP count */
36         sc->sc_bslot = 
37 @@ -1038,8 +1041,9 @@
38         ic->ic_vap_delete = ath_vap_delete;
39  
40         ic->ic_test_radar           = ath_test_radar;
41 +#ifdef AR_DEBUG
42         ic->ic_dump_hal_map         = ath_dump_hal_map;
43 -
44 +#endif
45         ic->ic_set_dfs_testmode     = ath_set_dfs_testmode;
46         ic->ic_get_dfs_testmode     = ath_get_dfs_testmode;
47  
48 @@ -1297,12 +1301,14 @@
49                 /* If no default VAP debug flags are passed, allow a few to
50                  * transfer down from the driver to new VAPs so we can have load
51                  * time debugging for VAPs too. */
52 +#ifdef AR_DEBUG
53                 vap->iv_debug = 0 |
54                         ((sc->sc_debug & ATH_DEBUG_RATE) ? IEEE80211_MSG_XRATE  : 0) | 
55                         ((sc->sc_debug & ATH_DEBUG_XMIT) ? IEEE80211_MSG_OUTPUT : 0) | 
56                         ((sc->sc_debug & ATH_DEBUG_RECV) ? IEEE80211_MSG_INPUT  : 0) |
57                         0
58                         ;
59 +#endif
60         }
61         ic->ic_debug = (sc->sc_default_ieee80211_debug & IEEE80211_MSG_IC);
62  
63 @@ -10496,9 +10502,11 @@
64                                 /* XXX validate? */
65                                 sc->sc_ledpin = val;
66                                 break;
67 +#ifdef AR_DEBUG
68                         case ATH_DEBUG:
69                                 sc->sc_debug     = (val & ~ATH_DEBUG_GLOBAL);
70                                 ath_debug_global = (val &  ATH_DEBUG_GLOBAL);
71 +#endif
72                                 break;
73                         case ATH_TXANTENNA:
74                                 /*
75 @@ -10918,9 +10926,11 @@
76         }
77  
78         /* initialize values */
79 +#ifdef AR_DEBUG
80         ath_debug_global = (ath_debug & ATH_DEBUG_GLOBAL);
81         sc->sc_debug     = (ath_debug & ~ATH_DEBUG_GLOBAL);
82         sc->sc_default_ieee80211_debug = ieee80211_debug;
83 +#endif
84         sc->sc_txantenna = 0;           /* default to auto-selection */
85         sc->sc_txintrperiod = ATH_TXQ_INTR_PERIOD;
86  }
87 @@ -11762,6 +11772,7 @@
88  }
89  
90  /* This is called by a private ioctl (iwpriv) to dump the HAL obfuscation table */
91 +#ifdef AR_DEBUG
92  static unsigned int
93  ath_dump_hal_map(struct ieee80211com *ic)
94  {
95 @@ -11770,7 +11781,7 @@
96         ath_hal_dump_map(sc->sc_ah);
97         return 0;
98  }
99 -
100 +#endif
101  /* If we are shutting down or blowing off the DFS channel availability check
102   * then we call this to stop the behavior before we take the rest of the
103   * necessary actions (such as a DFS reaction to radar). */
104 Index: madwifi-trunk-r3314/ath_rate/amrr/amrr.c
105 ===================================================================
106 --- madwifi-trunk-r3314.orig/ath_rate/amrr/amrr.c       2008-05-19 14:53:01.000000000 +0200
107 +++ madwifi-trunk-r3314/ath_rate/amrr/amrr.c    2008-05-19 14:54:47.000000000 +0200
108 @@ -70,7 +70,9 @@
109  
110  #include "amrr.h"
111  
112 +#ifdef AR_DEBUG
113  #define        AMRR_DEBUG
114 +#endif
115  #ifdef AMRR_DEBUG
116  #define        DPRINTF(sc, _fmt, ...) do {                                     \
117         if (sc->sc_debug & 0x10)                                        \
118 Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
119 ===================================================================
120 --- madwifi-trunk-r3314.orig/ath_rate/minstrel/minstrel.c       2008-05-19 14:54:42.000000000 +0200
121 +++ madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c    2008-05-19 14:54:47.000000000 +0200
122 @@ -117,7 +117,9 @@
123  
124  #include "minstrel.h"
125  
126 +#ifdef AR_DEBUG
127  #define        MINSTREL_DEBUG
128 +#endif
129  #ifdef MINSTREL_DEBUG
130  enum {
131                 ATH_DEBUG_RATE          = 0x00000010    /* rate control */
132 Index: madwifi-trunk-r3314/ath_rate/onoe/onoe.c
133 ===================================================================
134 --- madwifi-trunk-r3314.orig/ath_rate/onoe/onoe.c       2008-05-19 14:53:01.000000000 +0200
135 +++ madwifi-trunk-r3314/ath_rate/onoe/onoe.c    2008-05-19 14:54:47.000000000 +0200
136 @@ -66,7 +66,9 @@
137  
138  #include "onoe.h"
139  
140 +#ifdef AR_DEBUG
141  #define        ONOE_DEBUG
142 +#endif
143  #ifdef ONOE_DEBUG
144  enum {
145         ATH_DEBUG_RATE  = 0x00000010,   /* rate control */
146 Index: madwifi-trunk-r3314/ath_rate/sample/sample.c
147 ===================================================================
148 --- madwifi-trunk-r3314.orig/ath_rate/sample/sample.c   2008-05-19 14:53:01.000000000 +0200
149 +++ madwifi-trunk-r3314/ath_rate/sample/sample.c        2008-05-19 14:54:47.000000000 +0200
150 @@ -68,7 +68,9 @@
151  
152  #include "sample.h"
153  
154 -#define        SAMPLE_DEBUG
155 +#ifdef AR_DEBUG
156 +#define SAMPLE_DEBUG
157 +#endif
158  #ifdef SAMPLE_DEBUG
159  enum {
160         ATH_DEBUG_RATE          = 0x00000010,   /* rate control */
161 Index: madwifi-trunk-r3314/tools/do_multi.c
162 ===================================================================
163 --- madwifi-trunk-r3314.orig/tools/do_multi.c   2008-05-19 14:53:01.000000000 +0200
164 +++ madwifi-trunk-r3314/tools/do_multi.c        2008-05-19 14:54:47.000000000 +0200
165 @@ -9,16 +9,20 @@
166  
167      progname = basename(argv[0]);
168  
169 +#ifdef AR_DEBUG
170      if(strcmp(progname, "80211debug") == 0)
171         ret = a80211debug_init(argc, argv);
172 +#endif
173      if(strcmp(progname, "80211stats") == 0)
174         ret = a80211stats_init(argc, argv);
175      if(strcmp(progname, "athchans") == 0)
176         ret = athchans_init(argc, argv);
177      if(strcmp(progname, "athctrl") == 0)
178         ret =  athctrl_init(argc, argv);
179 +#ifdef AR_DEBUG
180      if(strcmp(progname, "athdebug") == 0)
181         ret =  athdebug_init(argc, argv);
182 +#endif
183      if(strcmp(progname, "athkey") == 0)
184         ret =  athkey_init(argc, argv);
185      if(strcmp(progname, "athstats") == 0)
186 Index: madwifi-trunk-r3314/tools/Makefile
187 ===================================================================
188 --- madwifi-trunk-r3314.orig/tools/Makefile     2008-05-19 14:54:31.000000000 +0200
189 +++ madwifi-trunk-r3314/tools/Makefile  2008-05-19 14:55:14.000000000 +0200
190 @@ -48,6 +48,8 @@
191  
192  all: compile
193  
194 +DEBUG = -DAR_DEBUG
195 +
196  ALLPROGS=      athstats 80211stats athkey athchans athctrl \
197         athdebug 80211debug wlanconfig ath_info
198  
199 @@ -55,7 +57,7 @@
200  
201  INCS=  -I. -I../ath -I$(HAL) -I$(TOP) -I$(ATH_HAL)
202  CFLAGS=        -g -O2 -Wall
203 -ALL_CFLAGS= $(CFLAGS) $(INCS)
204 +ALL_CFLAGS= $(CFLAGS) $(INCS) $(DEBUG)
205  LDFLAGS=
206  
207  
208 Index: madwifi-trunk-r3314/net80211/ieee80211_linux.h
209 ===================================================================
210 --- madwifi-trunk-r3314.orig/net80211/ieee80211_linux.h 2008-05-19 14:53:01.000000000 +0200
211 +++ madwifi-trunk-r3314/net80211/ieee80211_linux.h      2008-05-19 14:54:47.000000000 +0200
212 @@ -29,8 +29,6 @@
213  #ifndef _NET80211_IEEE80211_LINUX_H_
214  #define _NET80211_IEEE80211_LINUX_H_
215  
216 -#define        IEEE80211_DEBUG
217 -#define        IEEE80211_DEBUG_REFCNT                  /* Node reference count debugging */
218  /* #define ATH_DEBUG_SPINLOCKS */              /* announce before spinlocking */
219  
220  #include <linux/wireless.h>
221 Index: madwifi-trunk-r3314/Makefile.inc
222 ===================================================================
223 --- madwifi-trunk-r3314.orig/Makefile.inc       2008-05-19 14:53:01.000000000 +0200
224 +++ madwifi-trunk-r3314/Makefile.inc    2008-05-19 14:54:47.000000000 +0200
225 @@ -148,7 +148,8 @@
226  TOOLS=  $(TOP)/tools 
227  
228  WARNINGS = -Werror
229 -COPTS+= $(WARNINGS)
230 +DEBUG = -DAR_DEBUG -DIEEE80211_DEBUG
231 +COPTS+= $(WARNINGS) $(DEBUG)
232  INCS=  -include $(TOP)/include/compat.h -I$(TOP)/include
233  
234  # TARGET defines the target platform architecture. It must match one of
235 Index: madwifi-trunk-r3314/ath/if_ath_radar.c
236 ===================================================================
237 --- madwifi-trunk-r3314.orig/ath/if_ath_radar.c 2008-05-19 14:54:42.000000000 +0200
238 +++ madwifi-trunk-r3314/ath/if_ath_radar.c      2008-05-19 14:54:47.000000000 +0200
239 @@ -19,8 +19,6 @@
240   * $Id: if_ath_radar.c 2464 2007-06-15 22:51:56Z mtaylor $
241   */
242  #include "opt_ah.h"
243 -
244 -#define        AR_DEBUG
245  #include "if_ath_debug.h"
246  
247  #ifndef AUTOCONF_INCLUDED
248 @@ -56,8 +54,6 @@
249  #include <net80211/if_llc.h>
250  #endif
251  
252 -#define        AR_DEBUG
253 -
254  #include "net80211/if_athproto.h"
255  #include "if_athvar.h"
256  
257 Index: madwifi-trunk-r3314/ath/if_ath_hal.h
258 ===================================================================
259 --- madwifi-trunk-r3314.orig/ath/if_ath_hal.h   2008-05-19 14:53:01.000000000 +0200
260 +++ madwifi-trunk-r3314/ath/if_ath_hal.h        2008-05-19 14:54:47.000000000 +0200
261 @@ -1081,6 +1081,7 @@
262  
263             tail -f /var/log/messages | sed -f hal_unmangle.sed 
264   */
265 +#ifdef AR_DEBUG
266  static inline void ath_hal_dump_map(struct ath_hal *ah)
267  {
268  #ifdef CONFIG_KALLSYMS
269 @@ -1345,7 +1346,7 @@
270  #endif                         /* #ifndef CONFIG_KALLSYMS */
271  
272  }
273 -
274 +#endif
275  #include "if_ath_hal_wrappers.h"
276  
277  #endif                         /* #ifndef _IF_ATH_HAL_H_ */
278 Index: madwifi-trunk-r3314/net80211/ieee80211_var.h
279 ===================================================================
280 --- madwifi-trunk-r3314.orig/net80211/ieee80211_var.h   2008-05-19 14:53:01.000000000 +0200
281 +++ madwifi-trunk-r3314/net80211/ieee80211_var.h        2008-05-19 14:54:47.000000000 +0200
282 @@ -492,9 +492,10 @@
283         /* inject a fake radar signal -- used while on a 802.11h DFS channels */
284         unsigned int (*ic_test_radar)(struct ieee80211com *);
285  
286 +#ifdef AR_DEBUG
287         /* dump HAL */
288         unsigned int (*ic_dump_hal_map)(struct ieee80211com *);
289 -
290 +#endif
291         /* DFS channel availability check time (in seconds) */
292         void (*ic_set_dfs_cac_time)(struct ieee80211com *, unsigned int);
293         unsigned int (*ic_get_dfs_cac_time)(struct ieee80211com *);
294 Index: madwifi-trunk-r3314/net80211/ieee80211_wireless.c
295 ===================================================================
296 --- madwifi-trunk-r3314.orig/net80211/ieee80211_wireless.c      2008-05-19 14:53:01.000000000 +0200
297 +++ madwifi-trunk-r3314/net80211/ieee80211_wireless.c   2008-05-19 14:54:47.000000000 +0200
298 @@ -1548,6 +1548,7 @@
299         return 0;
300  }
301  
302 +#ifdef AR_DEBUG
303  static int 
304  ieee80211_ioctl_hal_map(struct net_device *dev, struct iw_request_info *info,
305         void *w, char *extra)
306 @@ -1558,7 +1559,7 @@
307         params[0] = ic->ic_dump_hal_map(ic);
308         return 0;
309  }
310 -
311 +#endif
312  
313  static int
314  ieee80211_ioctl_radar(struct net_device *dev, struct iw_request_info *info,
315 @@ -5258,8 +5259,10 @@
316           IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,   "getwmmparams" },
317         { IEEE80211_IOCTL_RADAR,
318           0, 0, "doth_radar" },
319 +#ifdef AR_DEBUG
320         { IEEE80211_IOCTL_HALMAP,
321           0, 0, "dump_hal_map" },
322 +#endif
323         /*
324          * These depends on sub-ioctl support which added in version 12.
325          */
326 @@ -5695,7 +5698,9 @@
327         set_priv(IEEE80211_IOCTL_SETMLME, ieee80211_ioctl_setmlme),
328         set_priv(IEEE80211_IOCTL_SETKEY, ieee80211_ioctl_setkey),
329         set_priv(IEEE80211_IOCTL_DELKEY, ieee80211_ioctl_delkey),
330 +#ifdef AR_DEBUG
331         set_priv(IEEE80211_IOCTL_HALMAP, ieee80211_ioctl_hal_map),
332 +#endif
333         set_priv(IEEE80211_IOCTL_ADDMAC, ieee80211_ioctl_addmac),
334         set_priv(IEEE80211_IOCTL_DELMAC, ieee80211_ioctl_delmac),
335         set_priv(IEEE80211_IOCTL_WDSADDMAC, ieee80211_ioctl_wdsmac),
336 Index: madwifi-trunk-r3314/ath/if_ath_debug.h
337 ===================================================================
338 --- madwifi-trunk-r3314.orig/ath/if_ath_debug.h 2008-05-19 14:53:01.000000000 +0200
339 +++ madwifi-trunk-r3314/ath/if_ath_debug.h      2008-05-19 14:54:47.000000000 +0200
340 @@ -68,13 +68,6 @@
341                 ath_keyprint((_sc), __func__, _ix, _hk, _mac);          \
342  } while (0)
343  
344 -#else /* #ifdef AR_DEBUG */
345 -
346 -#define        DFLAG_ISSET(sc, _m)             0
347 -#define        DPRINTF(sc, _m, _fmt, ...)
348 -#define        KEYPRINTF(sc, k, ix, mac)
349 -
350 -#endif /* #ifdef AR_DEBUG */
351  
352  #define        IFF_DUMPPKTS(_sc, _m)   DFLAG_ISSET((_sc), (_m))
353  
354 @@ -89,5 +82,15 @@
355  #define        IPRINTF(_sc, _fmt, ...) \
356                 printk(KERN_INFO "%s: %s: " _fmt, \
357                         SC_DEV_NAME(_sc), __func__, ## __VA_ARGS__)
358 +#else
359 +#define        DFLAG_ISSET(sc, _m)             0
360 +#define        DPRINTF(sc, _m, _fmt, ...)
361 +#define        KEYPRINTF(sc, k, ix, mac)
362 +#define EPRINTF(...)
363 +#define WPRINTF(...)
364 +#define IPRINTF(...)
365 +#define IFF_DUMPPKTS(...) 0
366 +
367 +#endif
368  
369  #endif /* #ifndef _IF_ATH_DEBUG_H_ */
370 Index: madwifi-trunk-r3314/net80211/ieee80211_node.c
371 ===================================================================
372 --- madwifi-trunk-r3314.orig/net80211/ieee80211_node.c  2008-05-19 14:53:01.000000000 +0200
373 +++ madwifi-trunk-r3314/net80211/ieee80211_node.c       2008-05-19 14:54:47.000000000 +0200
374 @@ -920,6 +920,9 @@
375         ni->ni_rxkeyoff = 0;
376  }
377  
378 +#ifndef IEEE80211_DEBUG
379 +#define node_print_message(...) do {} while(0)
380 +#else
381  static void node_print_message(
382                 u_int32_t flags,
383                 int show_counter, 
384 @@ -972,7 +975,7 @@
385                         adjusted_refcount);
386         va_end(args);
387  }
388 -EXPORT_SYMBOL(node_print_message);
389 +#endif
390  
391  static void
392  #ifdef IEEE80211_DEBUG_REFCNT