mac80211: clean up ieee80211_hw_config errors
authorJohannes Berg <johannes@sipsolutions.net>
Tue, 7 Oct 2008 10:04:34 +0000 (12:04 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 31 Oct 2008 22:06:00 +0000 (18:06 -0400)
Warn when ieee80211_hw_config returns an error, it shouldn't
happen; remove a number of printks that would happen in such
a case and one printk that is user-triggerable.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/cfg.c
net/mac80211/main.c
net/mac80211/scan.c
net/mac80211/util.c
net/mac80211/wext.c

index 8dc5e46cea68979e1c687c8a891f84054a4465f8..cf3fd5d60665db502b3c70bb30ba337cbd5c7394 100644 (file)
@@ -394,8 +394,7 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
         */
        if (params->interval) {
                sdata->local->hw.conf.beacon_int = params->interval;
-               if (ieee80211_hw_config(sdata->local))
-                       return -EINVAL;
+               ieee80211_hw_config(sdata->local);
                /*
                 * We updated some parameter so if below bails out
                 * it's not an error.
index ff39d893a113b04a5b4d7f13080ae1b23f5c3cfc..2ff26d03cd503338302e40cc88ecafb1ccb3c0a9 100644 (file)
@@ -222,8 +222,14 @@ int ieee80211_hw_config(struct ieee80211_local *local)
               wiphy_name(local->hw.wiphy), chan->center_freq);
 #endif
 
-       if (local->open_count)
+       if (local->open_count) {
                ret = local->ops->config(local_to_hw(local), &local->hw.conf);
+               /*
+                * HW reconfiguration should never fail, the driver has told
+                * us what it can support so it should live up to that promise.
+                */
+               WARN_ON(ret);
+       }
 
        return ret;
 }
index 416bb41099f361159d0bc578533d08a371a7de03..0989b1c062e3faaf560c1d03aa4c79d0f2f3b113 100644 (file)
@@ -448,18 +448,12 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
 
        if (local->hw_scanning) {
                local->hw_scanning = false;
-               if (ieee80211_hw_config(local))
-                       printk(KERN_DEBUG "%s: failed to restore operational "
-                              "channel after scan\n", wiphy_name(local->hw.wiphy));
-
+               ieee80211_hw_config(local);
                goto done;
        }
 
        local->sw_scanning = false;
-       if (ieee80211_hw_config(local))
-               printk(KERN_DEBUG "%s: failed to restore operational "
-                      "channel after scan\n", wiphy_name(local->hw.wiphy));
-
+       ieee80211_hw_config(local);
 
        netif_tx_lock_bh(local->mdev);
        netif_addr_lock(local->mdev);
@@ -546,12 +540,8 @@ void ieee80211_scan_work(struct work_struct *work)
 
                if (!skip) {
                        local->scan_channel = chan;
-                       if (ieee80211_hw_config(local)) {
-                               printk(KERN_DEBUG "%s: failed to set freq to "
-                                      "%d MHz for scan\n", wiphy_name(local->hw.wiphy),
-                                      chan->center_freq);
+                       if (ieee80211_hw_config(local))
                                skip = 1;
-                       }
                }
 
                /* advance state machine to next channel/band */
index cee4884b9d06215f86b73630362fae1f9ab87168..1b605457017ea8988a2efae83dcfca87c8420d89 100644 (file)
@@ -638,11 +638,8 @@ int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freqMHz)
 
        if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) {
                if (sdata->vif.type == NL80211_IFTYPE_ADHOC &&
-                   chan->flags & IEEE80211_CHAN_NO_IBSS) {
-                       printk(KERN_DEBUG "%s: IBSS not allowed on frequency "
-                               "%d MHz\n", sdata->dev->name, chan->center_freq);
+                   chan->flags & IEEE80211_CHAN_NO_IBSS)
                        return ret;
-               }
                local->oper_channel = chan;
 
                if (local->sw_scanning || local->hw_scanning)
index 742f811ca416e5b16701ce2ae49f582ed32317a6..29c41040c8c92ec1c71061b2ae2afb199a982635 100644 (file)
@@ -689,12 +689,8 @@ static int ieee80211_ioctl_siwtxpower(struct net_device *dev,
                ieee80211_led_radio(local, local->hw.conf.radio_enabled);
        }
 
-       if (need_reconfig) {
+       if (need_reconfig)
                ieee80211_hw_config(local);
-               /* The return value of hw_config is not of big interest here,
-                * as it doesn't say that it failed because of _this_ config
-                * change or something else. Ignore it. */
-       }
 
        return 0;
 }