]> err.no Git - linux-2.6/blobdiff - net/ieee80211/softmac/ieee80211softmac_module.c
Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
[linux-2.6] / net / ieee80211 / softmac / ieee80211softmac_module.c
index 4f8c3ef7081950b6e20157245b100dfca7f64065..6398e6e674936af9be7124f897da0478a681e724 100644 (file)
@@ -33,7 +33,10 @@ struct net_device *alloc_ieee80211softmac(int sizeof_priv)
        struct ieee80211softmac_device *softmac;
        struct net_device *dev;
 
-       dev = alloc_ieee80211(sizeof(struct ieee80211softmac_device) + sizeof_priv);
+       dev = alloc_ieee80211(sizeof(*softmac) + sizeof_priv);
+       if (!dev)
+               return NULL;
+
        softmac = ieee80211_priv(dev);
        softmac->dev = dev;
        softmac->ieee = netdev_priv(dev);
@@ -265,17 +268,10 @@ void ieee80211softmac_init_bss(struct ieee80211softmac_device *mac)
        /* Change the default txrate to the highest possible value.
         * The txrate machine will lower it, if it is too high.
         */
-       /* FIXME: We don't correctly handle backing down to lower
-          rates, so 801.11g devices start off at 11M for now. People
-          can manually change it if they really need to, but 11M is
-          more reliable. Note similar logic in
-          ieee80211softmac_wx_set_rate() */
-       if (ieee->modulation & IEEE80211_CCK_MODULATION) {
+       if (ieee->modulation & IEEE80211_OFDM_MODULATION)
+               txrates->user_rate = IEEE80211_OFDM_RATE_24MB;
+       else
                txrates->user_rate = IEEE80211_CCK_RATE_11MB;
-       } else if (ieee->modulation & IEEE80211_OFDM_MODULATION) {
-               txrates->user_rate = IEEE80211_OFDM_RATE_54MB;
-       } else
-               assert(0);
 
        txrates->default_rate = IEEE80211_CCK_RATE_1MB;
        change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT;
@@ -460,18 +456,13 @@ void
 ieee80211softmac_add_network_locked(struct ieee80211softmac_device *mac,
        struct ieee80211softmac_network *add_net)
 {
-       struct list_head *list_ptr;
-       struct ieee80211softmac_network *softmac_net = NULL;
+       struct ieee80211softmac_network *softmac_net;
 
-       list_for_each(list_ptr, &mac->network_list) {
-               softmac_net = list_entry(list_ptr, struct ieee80211softmac_network, list);
+       list_for_each_entry(softmac_net, &mac->network_list, list) {
                if(!memcmp(softmac_net->bssid, add_net->bssid, ETH_ALEN))
-                       break;
-               else
-                       softmac_net = NULL;
+                       return;
        }
-       if(softmac_net == NULL)
-               list_add(&(add_net->list), &mac->network_list);
+       list_add(&(add_net->list), &mac->network_list);
 }
 
 /* Add a network to the list, with locking */
@@ -510,16 +501,13 @@ struct ieee80211softmac_network *
 ieee80211softmac_get_network_by_bssid_locked(struct ieee80211softmac_device *mac,
        u8 *bssid)
 {
-       struct list_head *list_ptr;
-       struct ieee80211softmac_network *softmac_net = NULL;
-       list_for_each(list_ptr, &mac->network_list) {
-               softmac_net = list_entry(list_ptr, struct ieee80211softmac_network, list);
+       struct ieee80211softmac_network *softmac_net;
+
+       list_for_each_entry(softmac_net, &mac->network_list, list) {
                if(!memcmp(softmac_net->bssid, bssid, ETH_ALEN))
-                       break;
-               else
-                       softmac_net = NULL;
+                       return softmac_net;
        }
-       return softmac_net;
+       return NULL;
 }
 
 /* Get a network from the list by BSSID with locking */
@@ -541,11 +529,9 @@ struct ieee80211softmac_network *
 ieee80211softmac_get_network_by_essid_locked(struct ieee80211softmac_device *mac,
        struct ieee80211softmac_essid *essid)
 {
-       struct list_head *list_ptr;
-       struct ieee80211softmac_network *softmac_net = NULL;
+       struct ieee80211softmac_network *softmac_net;
 
-       list_for_each(list_ptr, &mac->network_list) {
-               softmac_net = list_entry(list_ptr, struct ieee80211softmac_network, list);
+       list_for_each_entry(softmac_net, &mac->network_list, list) {
                if (softmac_net->essid.len == essid->len &&
                        !memcmp(softmac_net->essid.data, essid->data, essid->len))
                        return softmac_net;