zd1211rw: honour enable_beacon conf
authorJohannes Berg <johannes@sipsolutions.net>
Tue, 10 Feb 2009 20:25:39 +0000 (21:25 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 13 Feb 2009 18:45:22 +0000 (13:45 -0500)
This makes zd1211rw honour enable_beacon, as well as fixing
a memory leak: the beacon skb is leaked when configuring it
to the hardware fails.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/zd1211rw/zd_mac.c

index 732b69f40978abd09063ba7876f18670e113fa16..7579af27edbd6e6d639ac2644267fb9333299b4f 100644 (file)
@@ -768,13 +768,23 @@ static int zd_op_config_interface(struct ieee80211_hw *hw,
                        if (!beacon)
                                return -ENOMEM;
                        r = zd_mac_config_beacon(hw, beacon);
+                       kfree_skb(beacon);
+
                        if (r < 0)
                                return r;
-                       r = zd_set_beacon_interval(&mac->chip, BCN_MODE_IBSS |
-                                       hw->conf.beacon_int);
+               }
+
+               if (conf->changed & IEEE80211_IFCC_BEACON_ENABLED) {
+                       u32 interval;
+
+                       if (conf->enable_beacon)
+                               interval = BCN_MODE_IBSS | hw->conf.beacon_int;
+                       else
+                               interval = 0;
+
+                       r = zd_set_beacon_interval(&mac->chip, interval);
                        if (r < 0)
                                return r;
-                       kfree_skb(beacon);
                }
        } else
                associated = is_valid_ether_addr(conf->bssid);