ath9k: Print hw reset failure status as signed int
[pandora-kernel.git] / drivers / net / wireless / ath / ath9k / main.c
index 2398d4f..0e8f6d4 100644 (file)
@@ -189,7 +189,7 @@ static u8 parse_mpdudensity(u8 mpdudensity)
 
 static void ath_setup_rates(struct ath_softc *sc, enum ieee80211_band band)
 {
-       struct ath_rate_table *rate_table = NULL;
+       const struct ath_rate_table *rate_table = NULL;
        struct ieee80211_supported_band *sband;
        struct ieee80211_rate *rate;
        int i, maxrates;
@@ -280,7 +280,7 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
        if (r) {
                DPRINTF(sc, ATH_DBG_FATAL,
                        "Unable to reset channel (%u Mhz) "
-                       "reset status %u\n",
+                       "reset status %d\n",
                        channel->center_freq, r);
                spin_unlock_bh(&sc->sc_resetlock);
                return r;
@@ -1094,7 +1094,7 @@ void ath_radio_enable(struct ath_softc *sc)
        if (r) {
                DPRINTF(sc, ATH_DBG_FATAL,
                        "Unable to reset channel %u (%uMhz) ",
-                       "reset status %u\n",
+                       "reset status %d\n",
                        channel->center_freq, r);
        }
        spin_unlock_bh(&sc->sc_resetlock);
@@ -1146,7 +1146,7 @@ void ath_radio_disable(struct ath_softc *sc)
        if (r) {
                DPRINTF(sc, ATH_DBG_FATAL,
                        "Unable to reset channel %u (%uMhz) "
-                       "reset status %u\n",
+                       "reset status %d\n",
                        channel->center_freq, r);
        }
        spin_unlock_bh(&sc->sc_resetlock);
@@ -1709,7 +1709,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
        r = ath9k_hw_reset(ah, sc->sc_ah->curchan, false);
        if (r)
                DPRINTF(sc, ATH_DBG_FATAL,
-                       "Unable to reset hardware; reset status %u\n", r);
+                       "Unable to reset hardware; reset status %d\n", r);
        spin_unlock_bh(&sc->sc_resetlock);
 
        if (ath_startrecv(sc) != 0)
@@ -2001,7 +2001,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
        r = ath9k_hw_reset(sc->sc_ah, init_channel, false);
        if (r) {
                DPRINTF(sc, ATH_DBG_FATAL,
-                       "Unable to reset hardware; reset status %u "
+                       "Unable to reset hardware; reset status %d "
                        "(freq %u MHz)\n", r,
                        curchan->center_freq);
                spin_unlock_bh(&sc->sc_resetlock);
@@ -2358,114 +2358,6 @@ skip_chan_change:
        if (changed & IEEE80211_CONF_CHANGE_POWER)
                sc->config.txpowlimit = 2 * conf->power_level;
 
-       /*
-        * The HW TSF has to be reset when the beacon interval changes.
-        * We set the flag here, and ath_beacon_config_ap() would take this
-        * into account when it gets called through the subsequent
-        * config_interface() call - with IFCC_BEACON in the changed field.
-        */
-
-       if (changed & IEEE80211_CONF_CHANGE_BEACON_INTERVAL)
-               sc->sc_flags |= SC_OP_TSF_RESET;
-
-       mutex_unlock(&sc->mutex);
-
-       return 0;
-}
-
-static int ath9k_config_interface(struct ieee80211_hw *hw,
-                                 struct ieee80211_vif *vif,
-                                 struct ieee80211_if_conf *conf)
-{
-       struct ath_wiphy *aphy = hw->priv;
-       struct ath_softc *sc = aphy->sc;
-       struct ath_hw *ah = sc->sc_ah;
-       struct ath_vif *avp = (void *)vif->drv_priv;
-       u32 rfilt = 0;
-       int error, i;
-
-       mutex_lock(&sc->mutex);
-
-       /* TODO: Need to decide which hw opmode to use for multi-interface
-        * cases */
-       if (vif->type == NL80211_IFTYPE_AP &&
-           ah->opmode != NL80211_IFTYPE_AP) {
-               ah->opmode = NL80211_IFTYPE_STATION;
-               ath9k_hw_setopmode(ah);
-               memcpy(sc->curbssid, sc->sc_ah->macaddr, ETH_ALEN);
-               sc->curaid = 0;
-               ath9k_hw_write_associd(sc);
-               /* Request full reset to get hw opmode changed properly */
-               sc->sc_flags |= SC_OP_FULL_RESET;
-       }
-
-       if ((conf->changed & IEEE80211_IFCC_BSSID) &&
-           !is_zero_ether_addr(conf->bssid)) {
-               switch (vif->type) {
-               case NL80211_IFTYPE_STATION:
-               case NL80211_IFTYPE_ADHOC:
-               case NL80211_IFTYPE_MESH_POINT:
-                       /* Set BSSID */
-                       memcpy(sc->curbssid, conf->bssid, ETH_ALEN);
-                       memcpy(avp->bssid, conf->bssid, ETH_ALEN);
-                       sc->curaid = 0;
-                       ath9k_hw_write_associd(sc);
-
-                       /* Set aggregation protection mode parameters */
-                       sc->config.ath_aggr_prot = 0;
-
-                       DPRINTF(sc, ATH_DBG_CONFIG,
-                               "RX filter 0x%x bssid %pM aid 0x%x\n",
-                               rfilt, sc->curbssid, sc->curaid);
-
-                       /* need to reconfigure the beacon */
-                       sc->sc_flags &= ~SC_OP_BEACONS ;
-
-                       break;
-               default:
-                       break;
-               }
-       }
-
-       if ((vif->type == NL80211_IFTYPE_ADHOC) ||
-           (vif->type == NL80211_IFTYPE_AP) ||
-           (vif->type == NL80211_IFTYPE_MESH_POINT)) {
-               if ((conf->changed & IEEE80211_IFCC_BEACON) ||
-                   (conf->changed & IEEE80211_IFCC_BEACON_ENABLED &&
-                    conf->enable_beacon)) {
-                       /*
-                        * Allocate and setup the beacon frame.
-                        *
-                        * Stop any previous beacon DMA.  This may be
-                        * necessary, for example, when an ibss merge
-                        * causes reconfiguration; we may be called
-                        * with beacon transmission active.
-                        */
-                       ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
-
-                       error = ath_beacon_alloc(aphy, vif);
-                       if (error != 0) {
-                               mutex_unlock(&sc->mutex);
-                               return error;
-                       }
-
-                       ath_beacon_config(sc, vif);
-               }
-       }
-
-       /* Check for WLAN_CAPABILITY_PRIVACY ? */
-       if ((avp->av_opmode != NL80211_IFTYPE_STATION)) {
-               for (i = 0; i < IEEE80211_WEP_NKID; i++)
-                       if (ath9k_hw_keyisvalid(sc->sc_ah, (u16)i))
-                               ath9k_hw_keysetmac(sc->sc_ah,
-                                                  (u16)i,
-                                                  sc->curbssid);
-       }
-
-       /* Only legacy IBSS for now */
-       if (vif->type == NL80211_IFTYPE_ADHOC)
-               ath_update_chainmask(sc, 0);
-
        mutex_unlock(&sc->mutex);
 
        return 0;
@@ -2607,9 +2499,92 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
 {
        struct ath_wiphy *aphy = hw->priv;
        struct ath_softc *sc = aphy->sc;
+       struct ath_hw *ah = sc->sc_ah;
+       struct ath_vif *avp = (void *)vif->drv_priv;
+       u32 rfilt = 0;
+       int error, i;
 
        mutex_lock(&sc->mutex);
 
+       /*
+        * TODO: Need to decide which hw opmode to use for
+        *       multi-interface cases
+        * XXX: This belongs into add_interface!
+        */
+       if (vif->type == NL80211_IFTYPE_AP &&
+           ah->opmode != NL80211_IFTYPE_AP) {
+               ah->opmode = NL80211_IFTYPE_STATION;
+               ath9k_hw_setopmode(ah);
+               memcpy(sc->curbssid, sc->sc_ah->macaddr, ETH_ALEN);
+               sc->curaid = 0;
+               ath9k_hw_write_associd(sc);
+               /* Request full reset to get hw opmode changed properly */
+               sc->sc_flags |= SC_OP_FULL_RESET;
+       }
+
+       if ((changed & BSS_CHANGED_BSSID) &&
+           !is_zero_ether_addr(bss_conf->bssid)) {
+               switch (vif->type) {
+               case NL80211_IFTYPE_STATION:
+               case NL80211_IFTYPE_ADHOC:
+               case NL80211_IFTYPE_MESH_POINT:
+                       /* Set BSSID */
+                       memcpy(sc->curbssid, bss_conf->bssid, ETH_ALEN);
+                       memcpy(avp->bssid, bss_conf->bssid, ETH_ALEN);
+                       sc->curaid = 0;
+                       ath9k_hw_write_associd(sc);
+
+                       /* Set aggregation protection mode parameters */
+                       sc->config.ath_aggr_prot = 0;
+
+                       DPRINTF(sc, ATH_DBG_CONFIG,
+                               "RX filter 0x%x bssid %pM aid 0x%x\n",
+                               rfilt, sc->curbssid, sc->curaid);
+
+                       /* need to reconfigure the beacon */
+                       sc->sc_flags &= ~SC_OP_BEACONS ;
+
+                       break;
+               default:
+                       break;
+               }
+       }
+
+       if ((vif->type == NL80211_IFTYPE_ADHOC) ||
+           (vif->type == NL80211_IFTYPE_AP) ||
+           (vif->type == NL80211_IFTYPE_MESH_POINT)) {
+               if ((changed & BSS_CHANGED_BEACON) ||
+                   (changed & BSS_CHANGED_BEACON_ENABLED &&
+                    bss_conf->enable_beacon)) {
+                       /*
+                        * Allocate and setup the beacon frame.
+                        *
+                        * Stop any previous beacon DMA.  This may be
+                        * necessary, for example, when an ibss merge
+                        * causes reconfiguration; we may be called
+                        * with beacon transmission active.
+                        */
+                       ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
+
+                       error = ath_beacon_alloc(aphy, vif);
+                       if (!error)
+                               ath_beacon_config(sc, vif);
+               }
+       }
+
+       /* Check for WLAN_CAPABILITY_PRIVACY ? */
+       if ((avp->av_opmode != NL80211_IFTYPE_STATION)) {
+               for (i = 0; i < IEEE80211_WEP_NKID; i++)
+                       if (ath9k_hw_keyisvalid(sc->sc_ah, (u16)i))
+                               ath9k_hw_keysetmac(sc->sc_ah,
+                                                  (u16)i,
+                                                  sc->curbssid);
+       }
+
+       /* Only legacy IBSS for now */
+       if (vif->type == NL80211_IFTYPE_ADHOC)
+               ath_update_chainmask(sc, 0);
+
        if (changed & BSS_CHANGED_ERP_PREAMBLE) {
                DPRINTF(sc, ATH_DBG_CONFIG, "BSS Changed PREAMBLE %d\n",
                        bss_conf->use_short_preamble);
@@ -2635,6 +2610,18 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
                ath9k_bss_assoc_info(sc, vif, bss_conf);
        }
 
+       /*
+        * The HW TSF has to be reset when the beacon interval changes.
+        * We set the flag here, and ath_beacon_config_ap() would take this
+        * into account when it gets called through the subsequent
+        * config_interface() call - with IFCC_BEACON in the changed field.
+        */
+
+       if (changed & BSS_CHANGED_BEACON_INT) {
+               sc->sc_flags |= SC_OP_TSF_RESET;
+               sc->beacon_interval = bss_conf->beacon_int;
+       }
+
        mutex_unlock(&sc->mutex);
 }
 
@@ -2755,7 +2742,6 @@ struct ieee80211_ops ath9k_ops = {
        .add_interface      = ath9k_add_interface,
        .remove_interface   = ath9k_remove_interface,
        .config             = ath9k_config,
-       .config_interface   = ath9k_config_interface,
        .configure_filter   = ath9k_configure_filter,
        .sta_notify         = ath9k_sta_notify,
        .conf_tx            = ath9k_conf_tx,