Commit 67c4f7aa authored by Akinobu Mita's avatar Akinobu Mita Committed by Jeff Garzik

[PATCH] softmac: use list_for_each_entry

Cleanup using list_for_each_entry.

Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Joe Jezak <josejx@gentoo.org>
Cc: Daniel Drake <dsd@gentoo.org>
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 77548f58
...@@ -456,17 +456,12 @@ void ...@@ -456,17 +456,12 @@ void
ieee80211softmac_add_network_locked(struct ieee80211softmac_device *mac, ieee80211softmac_add_network_locked(struct ieee80211softmac_device *mac,
struct ieee80211softmac_network *add_net) struct ieee80211softmac_network *add_net)
{ {
struct list_head *list_ptr; struct ieee80211softmac_network *softmac_net;
struct ieee80211softmac_network *softmac_net = NULL;
list_for_each(list_ptr, &mac->network_list) { list_for_each_entry(softmac_net, &mac->network_list, list) {
softmac_net = list_entry(list_ptr, struct ieee80211softmac_network, list);
if(!memcmp(softmac_net->bssid, add_net->bssid, ETH_ALEN)) if(!memcmp(softmac_net->bssid, add_net->bssid, ETH_ALEN))
break; return;
else
softmac_net = NULL;
} }
if(softmac_net == NULL)
list_add(&(add_net->list), &mac->network_list); list_add(&(add_net->list), &mac->network_list);
} }
...@@ -506,16 +501,13 @@ struct ieee80211softmac_network * ...@@ -506,16 +501,13 @@ struct ieee80211softmac_network *
ieee80211softmac_get_network_by_bssid_locked(struct ieee80211softmac_device *mac, ieee80211softmac_get_network_by_bssid_locked(struct ieee80211softmac_device *mac,
u8 *bssid) u8 *bssid)
{ {
struct list_head *list_ptr; struct ieee80211softmac_network *softmac_net;
struct ieee80211softmac_network *softmac_net = NULL;
list_for_each(list_ptr, &mac->network_list) { list_for_each_entry(softmac_net, &mac->network_list, list) {
softmac_net = list_entry(list_ptr, struct ieee80211softmac_network, list);
if(!memcmp(softmac_net->bssid, bssid, ETH_ALEN)) 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 */ /* Get a network from the list by BSSID with locking */
...@@ -537,11 +529,9 @@ struct ieee80211softmac_network * ...@@ -537,11 +529,9 @@ struct ieee80211softmac_network *
ieee80211softmac_get_network_by_essid_locked(struct ieee80211softmac_device *mac, ieee80211softmac_get_network_by_essid_locked(struct ieee80211softmac_device *mac,
struct ieee80211softmac_essid *essid) struct ieee80211softmac_essid *essid)
{ {
struct list_head *list_ptr; struct ieee80211softmac_network *softmac_net;
struct ieee80211softmac_network *softmac_net = NULL;
list_for_each(list_ptr, &mac->network_list) { list_for_each_entry(softmac_net, &mac->network_list, list) {
softmac_net = list_entry(list_ptr, struct ieee80211softmac_network, list);
if (softmac_net->essid.len == essid->len && if (softmac_net->essid.len == essid->len &&
!memcmp(softmac_net->essid.data, essid->data, essid->len)) !memcmp(softmac_net->essid.data, essid->data, essid->len))
return softmac_net; return softmac_net;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment