diff -Nur madwifi-trunk-r3314.orig/ath/if_ath.c madwifi-trunk-r3314/ath/if_ath.c
--- madwifi-trunk-r3314.orig/ath/if_ath.c	2008-07-08 08:31:36.000000000 +0200
+++ madwifi-trunk-r3314/ath/if_ath.c	2008-07-08 08:40:45.000000000 +0200
@@ -463,8 +463,8 @@
 MODULE_PARM_DESC(ratectl, "Rate control algorithm [amrr|minstrel|onoe|sample], "
 		"defaults to '" DEF_RATE_CTL "'");
 
-static int	ath_debug = 0;
 #ifdef AR_DEBUG
+static int	ath_debug = 0;
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,52))
 MODULE_PARM(ath_debug, "i");
 #else
@@ -475,8 +475,8 @@
 static void ath_printtxbuf(const struct ath_buf *, int);
 #endif /* defined(AR_DEBUG) */
 
-static int	ieee80211_debug = 0;
 #ifdef AR_DEBUG
+static int	ieee80211_debug = 0;
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,52))
 MODULE_PARM(ieee80211_debug, "i");
 #else
@@ -1585,7 +1585,9 @@
 void
 ath_suspend(struct net_device *dev)
 {
+#ifdef AR_DEBUG
 	struct ath_softc *sc = dev->priv;
+#endif
 
 	DPRINTF(sc, ATH_DEBUG_ANY, "flags=%x\n", dev->flags);
 	ath_stop(dev);
@@ -1594,7 +1596,9 @@
 void
 ath_resume(struct net_device *dev)
 {
+#ifdef AR_DEBUG
 	struct ath_softc *sc = dev->priv;
+#endif
 
 	DPRINTF(sc, ATH_DEBUG_ANY, "flags=%x\n", dev->flags);
 	ath_init(dev);
@@ -4130,7 +4134,9 @@
 ath_key_update_begin(struct ieee80211vap *vap)
 {
 	struct net_device *dev = vap->iv_ic->ic_dev;
+#ifdef AR_DEBUG
 	struct ath_softc *sc = dev->priv;
+#endif
 
 	DPRINTF(sc, ATH_DEBUG_KEYCACHE, "Begin\n");
 	/*
@@ -4145,7 +4151,9 @@
 ath_key_update_end(struct ieee80211vap *vap)
 {
 	struct net_device *dev = vap->iv_ic->ic_dev;
+#ifdef AR_DEBUG
 	struct ath_softc *sc = dev->priv;
+#endif
 
 	DPRINTF(sc, ATH_DEBUG_KEYCACHE, "End\n");
 
@@ -6333,7 +6341,9 @@
 	struct sk_buff *skb, int subtype, int rssi, u_int64_t rtsf)
 {
 	struct ath_softc *sc = vap->iv_ic->ic_dev->priv;
+#ifdef AR_DEBUG
         struct ieee80211_frame *wh = (struct ieee80211_frame *)skb->data;
+#endif
 	struct ieee80211_node * ni = ni_or_null;
 	u_int64_t hw_tsf, beacon_tsf;
 	u_int32_t hw_tu, beacon_tu, intval;
@@ -8599,7 +8609,9 @@
 static void
 ath_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq)
 {
+#ifdef AR_DEBUG
 	struct ath_hal *ah = sc->sc_ah;
+#endif
 	struct ath_buf *bf;
 	/*
 	 * NB: this assumes output has been stopped and
@@ -11313,6 +11325,7 @@
 		strncat(m, b, MLEN);
 	}
 	strncat(m, "\n", MLEN);
+#ifdef AR_DEBUG
 	if (1 /* bootverbose */) {
 		unsigned int i;
 		for (i = 0; i <= WME_AC_VO; i++) {
@@ -11325,6 +11338,7 @@
 			sc->sc_cabq->axq_qnum);
 		IPRINTF(sc, "Use hw queue %u for beacons\n", sc->sc_bhalq);
 	}
+#endif
 #undef HAL_MODE_DUALBAND
 }
  
diff -Nur madwifi-trunk-r3314.orig/ath/if_ath_radar.c madwifi-trunk-r3314/ath/if_ath_radar.c
--- madwifi-trunk-r3314.orig/ath/if_ath_radar.c	2008-07-07 23:58:12.000000000 +0200
+++ madwifi-trunk-r3314/ath/if_ath_radar.c	2008-07-08 08:46:01.000000000 +0200
@@ -156,7 +156,9 @@
 #endif
 };
 
+#ifdef AR_DEBUG
 static u_int32_t interval_to_frequency(u_int32_t pri);
+#endif
 
 /* Returns true if radar detection is enabled. */
 int ath_radar_is_enabled(struct ath_softc *sc)
@@ -229,7 +231,9 @@
 {
 
 	struct ath_hal *ah = sc->sc_ah;
+#ifdef AR_DEBUG
 	struct net_device *dev = sc->sc_dev;
+#endif
 	struct ieee80211com *ic = &sc->sc_ic;
 	int required = 0;
 
@@ -366,6 +370,7 @@
 #define MR_FAIL_MIN_PERIOD	4
 #define MR_FAIL_MAX_PERIOD	5
 
+#ifdef AR_DEBUG
 static const char* get_match_result_desc(u_int32_t code) {
 	switch (code) {
 	case MR_MATCH:
@@ -384,6 +389,7 @@
 		return "unknown";
 	}
 }
+#endif
 
 static int32_t match_radar(
 	u_int32_t matched, 
@@ -775,7 +781,10 @@
 	struct ath_softc *sc, struct ath_rp *last_pulse, 
 	u_int32_t *index, u_int32_t *pri, u_int32_t *matching_pulses, 
 	u_int32_t *missed_pulses, u_int32_t *noise_pulses)
-{ struct net_device *dev = sc->sc_dev;
+{
+#ifdef AR_DEBUG
+	struct net_device *dev = sc->sc_dev;
+#endif
 	int i;
 	int best_index = -1;
 	unsigned int best_matched = 0;
@@ -1217,6 +1226,7 @@
 	return (-1 != best_index) ? AH_TRUE : AH_FALSE;
 }
 
+#ifdef AR_DEBUG
 static u_int32_t interval_to_frequency(u_int32_t interval)
 {
 	/* Calculate BRI from PRI */
@@ -1224,6 +1234,7 @@
 	/* Round to nearest multiple of 50 */
 	return frequency + ((frequency % 50) >= 25 ? 50 : 0) - (frequency % 50);
 }
+#endif
 
 #ifdef ATH_RADAR_LONG_PULSE
 static const char* get_longpulse_desc(int lp) {
@@ -1580,7 +1591,9 @@
 void ath_rp_record(struct ath_softc *sc, u_int64_t tsf, u_int8_t rssi, 
 			    u_int8_t width, HAL_BOOL is_simulated)
 {
+#ifdef AR_DEBUG
 	struct net_device *dev = sc->sc_dev;
+#endif
 	struct ath_rp *pulse;
 
 	DPRINTF(sc, ATH_DEBUG_DOTHPULSES, "%s: ath_rp_record: "
diff -Nur madwifi-trunk-r3314.orig/ath_rate/minstrel/minstrel.c madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
--- madwifi-trunk-r3314.orig/ath_rate/minstrel/minstrel.c	2008-07-07 23:58:12.000000000 +0200
+++ madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c	2008-07-08 08:46:29.000000000 +0200
@@ -951,7 +951,9 @@
 			    (struct ieee80211_node_table *) &vap->iv_ic->ic_sta;
 		unsigned int x = 0;
 		unsigned int this_tp, this_prob, this_eprob;
+#ifdef AR_DEBUG
 			struct ath_softc *sc = vap->iv_ic->ic_dev->priv;;
+#endif
 
 		IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
 		TAILQ_FOREACH(ni, &nt->nt_node, ni_list) {
diff -Nur madwifi-trunk-r3314.orig/net80211/ieee80211_scan_ap.c madwifi-trunk-r3314/net80211/ieee80211_scan_ap.c
--- madwifi-trunk-r3314.orig/net80211/ieee80211_scan_ap.c	2008-07-07 23:58:35.000000000 +0200
+++ madwifi-trunk-r3314/net80211/ieee80211_scan_ap.c	2008-07-08 08:47:45.000000000 +0200
@@ -510,6 +510,7 @@
 
 	sort(chans, ss_last, sizeof(*chans), pc_cmp, pc_swap);
 
+#ifdef IEEE80211_DEBUG
 	for (i = 0; i < ss_last; i++) {
 		int chan = ieee80211_chan2ieee(ic, chans[i].chan);
 
@@ -521,6 +522,7 @@
 				!!IEEE80211_ARE_CHANS_SAME_MODE(chans[i].chan, 
 					ic->ic_bsschan));
 	}
+#endif
 
 	best = NULL;
 	best_rssi = 0xff; /* If signal is bigger than 0xff, we'd be melting. */
