--- a/ath/if_ath.c
+++ b/ath/if_ath.c
@@ -453,8 +453,8 @@ MODULE_PARM_DESC(autocreate, "Create ath
 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
@@ -465,8 +465,8 @@ static void ath_printrxbuf(const struct
 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
@@ -1565,7 +1565,9 @@ ath_vap_delete(struct ieee80211vap *vap)
 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);
@@ -1574,7 +1576,9 @@ ath_suspend(struct net_device *dev)
 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);
@@ -4019,7 +4023,9 @@ static void
 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");
 	/*
@@ -4040,7 +4046,9 @@ static void
 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");
 	netif_wake_queue(dev);
@@ -6218,7 +6226,9 @@ ath_recv_mgmt(struct ieee80211vap * vap,
 	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;
@@ -8382,7 +8392,9 @@ ath_tx_timeout(struct net_device *dev)
 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
@@ -11002,6 +11014,7 @@ ath_announce(struct net_device *dev)
 		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++) {
@@ -11014,6 +11027,7 @@ ath_announce(struct net_device *dev)
 			sc->sc_cabq->axq_qnum);
 		IPRINTF(sc, "Use hw queue %u for beacons\n", sc->sc_bhalq);
 	}
+#endif
 #undef HAL_MODE_DUALBAND
 }
  
--- a/ath/if_ath_radar.c
+++ b/ath/if_ath_radar.c
@@ -156,7 +156,9 @@ static struct radar_pattern_specificatio
 #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 @@ int ath_radar_update(struct ath_softc *s
 {
 
 	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 @@ static struct ath_rp *pulse_prev(struct
 #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 @@ static const char* get_match_result_desc
 		return "unknown";
 	}
 }
+#endif
 
 static int32_t match_radar(
 	u_int32_t matched, 
@@ -775,7 +781,10 @@ static HAL_BOOL rp_analyse_short_pulse(
 	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 @@ static HAL_BOOL rp_analyse_short_pulse(
 	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 @@ static u_int32_t interval_to_frequency(u
 	/* 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_done(struct ath_softc *sc)
 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: "
--- a/ath_rate/minstrel/minstrel.c
+++ b/ath_rate/minstrel/minstrel.c
@@ -931,7 +931,9 @@ ath_proc_read_nodes(struct ieee80211vap
 			    (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) {
--- a/net80211/ieee80211_scan_ap.c
+++ b/net80211/ieee80211_scan_ap.c
@@ -731,6 +731,7 @@ pick_channel(struct ieee80211_scan_state
 
 	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);
 
@@ -742,6 +743,7 @@ pick_channel(struct ieee80211_scan_state
 				!!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. */
