* [PATCH 1/2] use list_for_each() for iteration in Host AP driver
[not found] <20070525125630.GE31790@traven>
@ 2007-05-25 13:03 ` Matthias Kaehlcke
2007-05-25 14:30 ` Christoph Hellwig
2007-05-25 13:04 ` [PATCH 2/2] use list_for_each() for iteration in Prism 54 driver Matthias Kaehlcke
1 sibling, 1 reply; 8+ messages in thread
From: Matthias Kaehlcke @ 2007-05-25 13:03 UTC (permalink / raw)
To: j, hostap, linux-wireless; +Cc: linux-kernel, akpm
Use list_for_each() in the Host AP driver to iterate over the MAC
restrictions and the STA info lists
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
--
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index 5b3abd5..0718eeb 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -352,8 +352,7 @@ static int ap_control_proc_read(char *page, char **start, off_t off,
p += sprintf(p, "MAC entries: %u\n", ap->mac_restrictions.entries);
p += sprintf(p, "MAC list:\n");
spin_lock_bh(&ap->mac_restrictions.lock);
- for (ptr = ap->mac_restrictions.mac_list.next;
- ptr != &ap->mac_restrictions.mac_list; ptr = ptr->next) {
+ list_for_each(ptr, &ap->mac_restrictions.mac_list) {
if (p - page > PAGE_SIZE - 80) {
p += sprintf(p, "All entries did not fit one page.\n");
break;
@@ -393,8 +392,7 @@ int ap_control_del_mac(struct mac_restrictions *mac_restrictions, u8 *mac)
struct mac_entry *entry;
spin_lock_bh(&mac_restrictions->lock);
- for (ptr = mac_restrictions->mac_list.next;
- ptr != &mac_restrictions->mac_list; ptr = ptr->next) {
+ list_for_each(ptr, &mac_restrictions->mac_list) {
entry = list_entry(ptr, struct mac_entry, list);
if (memcmp(entry->addr, mac, ETH_ALEN) == 0) {
@@ -421,8 +419,7 @@ static int ap_control_mac_deny(struct mac_restrictions *mac_restrictions,
return 0;
spin_lock_bh(&mac_restrictions->lock);
- for (ptr = mac_restrictions->mac_list.next;
- ptr != &mac_restrictions->mac_list; ptr = ptr->next) {
+ list_for_each(ptr, &mac_restrictions->mac_list) {
entry = list_entry(ptr, struct mac_entry, list);
if (memcmp(entry->addr, mac, ETH_ALEN) == 0) {
@@ -529,7 +526,7 @@ static int prism2_ap_proc_read(char *page, char **start, off_t off,
p += sprintf(p, "# BSSID CHAN SIGNAL NOISE RATE SSID FLAGS\n");
spin_lock_bh(&ap->sta_table_lock);
- for (ptr = ap->sta_list.next; ptr != &ap->sta_list; ptr = ptr->next) {
+ list_for_each(ptr, &ap->sta_list) {
struct sta_info *sta = (struct sta_info *) ptr;
if (!sta->ap)
@@ -3205,7 +3202,7 @@ void hostap_update_rates(local_info_t *local)
return;
spin_lock_bh(&ap->sta_table_lock);
- for (ptr = ap->sta_list.next; ptr != &ap->sta_list; ptr = ptr->next) {
+ list_for_each(ptr, &ap->sta_list) {
struct sta_info *sta = (struct sta_info *) ptr;
prism2_check_tx_rates(sta);
}
--
Matthias Kaehlcke
Linux Application Developer
Barcelona
You can chain me, you can torture me, you can even
destroy this body, but you will never imprison my mind
(Mahatma Gandhi)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] use list_for_each() for iteration in Prism 54 driver
[not found] <20070525125630.GE31790@traven>
2007-05-25 13:03 ` [PATCH 1/2] use list_for_each() for iteration in Host AP driver Matthias Kaehlcke
@ 2007-05-25 13:04 ` Matthias Kaehlcke
2007-05-27 10:39 ` [PATCH 2/2] use list_for_each_entry() " Matthias Kaehlcke
1 sibling, 1 reply; 8+ messages in thread
From: Matthias Kaehlcke @ 2007-05-25 13:04 UTC (permalink / raw)
To: developers, linux-wireless; +Cc: linux-kernel, akpm
Use list_for_each() in the Prism54 driver to iterate over the MAC list
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
--
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c
index 283be4a..34cf13c 100644
--- a/drivers/net/wireless/prism54/isl_ioctl.c
+++ b/drivers/net/wireless/prism54/isl_ioctl.c
@@ -1861,7 +1861,7 @@ prism54_del_mac(struct net_device *ndev, struct iw_request_info *info,
if (down_interruptible(&acl->sem))
return -ERESTARTSYS;
- for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
+ list_for_each(ptr, &acl->mac_list) {
entry = list_entry(ptr, struct mac_entry, _list);
if (memcmp(entry->addr, addr->sa_data, ETH_ALEN) == 0) {
@@ -1891,7 +1891,7 @@ prism54_get_mac(struct net_device *ndev, struct iw_request_info *info,
if (down_interruptible(&acl->sem))
return -ERESTARTSYS;
- for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
+ list_for_each(ptr, &acl->mac_list) {
entry = list_entry(ptr, struct mac_entry, _list);
memcpy(dst->sa_data, entry->addr, ETH_ALEN);
@@ -1972,7 +1972,7 @@ prism54_mac_accept(struct islpci_acl *acl, char *mac)
return 1;
}
- for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
+ list_for_each(ptr, &acl->mac_list) {
entry = list_entry(ptr, struct mac_entry, _list);
if (memcmp(entry->addr, mac, ETH_ALEN) == 0) {
res = 1;
--
Matthias Kaehlcke
Linux Application Developer
Barcelona
If sharing a thing in no way diminishes it,
it is not rightly owned if it is not shared
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] use list_for_each() for iteration in Host AP driver
2007-05-25 13:03 ` [PATCH 1/2] use list_for_each() for iteration in Host AP driver Matthias Kaehlcke
@ 2007-05-25 14:30 ` Christoph Hellwig
2007-05-27 10:28 ` [PATCH 1/2] use list_for_each_entry() for iteration in hostap_ap.c Matthias Kaehlcke
0 siblings, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2007-05-25 14:30 UTC (permalink / raw)
To: Matthias Kaehlcke, j, hostap, linux-wireless, linux-kernel, akpm
On Fri, May 25, 2007 at 03:03:08PM +0200, Matthias Kaehlcke wrote:
> Use list_for_each() in the Host AP driver to iterate over the MAC
> restrictions and the STA info lists
please go all the way to a proper list_for_each_entry. Then again now
that we have mac80211 shouldn't hostap be ported over to it and this code
go away completely?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] use list_for_each_entry() for iteration in hostap_ap.c
2007-05-25 14:30 ` Christoph Hellwig
@ 2007-05-27 10:28 ` Matthias Kaehlcke
2007-05-28 2:44 ` Jouni Malinen
2007-05-28 6:45 ` Matthias Kaehlcke
0 siblings, 2 replies; 8+ messages in thread
From: Matthias Kaehlcke @ 2007-05-27 10:28 UTC (permalink / raw)
To: Christoph Hellwig, j, hostap, linux-wireless, linux-kernel, akpm
El Fri, May 25, 2007 at 03:30:05PM +0100 Christoph Hellwig ha dit:
> On Fri, May 25, 2007 at 03:03:08PM +0200, Matthias Kaehlcke wrote:
> > Use list_for_each() in the Host AP driver to iterate over the MAC
> > restrictions and the STA info lists
>
> please go all the way to a proper list_for_each_entry.
thanks for your comment, here's a patch that uses
list_for_each_entry(), additionally to the initial patch it
substitutes some list_for_each() loops by list_for_each_entry()
> Then again now that we have mac80211 shouldn't hostap be ported over
> to it and this code go away completely?
i hope the patch can be useful in the meantime, otherwise just ignore
it
--
hostap_ap.c: Use list_for_each_entry() instead of manual iteration and
substitute some list_for_each() loops with list_for_each_entry()
--
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index 5b3abd5..120bc9b 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -326,7 +326,6 @@ static int ap_control_proc_read(char *page, char **start, off_t off,
char *p = page;
struct ap_data *ap = (struct ap_data *) data;
char *policy_txt;
- struct list_head *ptr;
struct mac_entry *entry;
if (off != 0) {
@@ -352,14 +351,12 @@ static int ap_control_proc_read(char *page, char **start, off_t off,
p += sprintf(p, "MAC entries: %u\n", ap->mac_restrictions.entries);
p += sprintf(p, "MAC list:\n");
spin_lock_bh(&ap->mac_restrictions.lock);
- for (ptr = ap->mac_restrictions.mac_list.next;
- ptr != &ap->mac_restrictions.mac_list; ptr = ptr->next) {
+ list_for_each_entry(entry, &ap->mac_restrictions.mac_list, list) {
if (p - page > PAGE_SIZE - 80) {
p += sprintf(p, "All entries did not fit one page.\n");
break;
}
- entry = list_entry(ptr, struct mac_entry, list);
p += sprintf(p, MACSTR "\n", MAC2STR(entry->addr));
}
spin_unlock_bh(&ap->mac_restrictions.lock);
@@ -410,10 +407,10 @@ int ap_control_del_mac(struct mac_restrictions *mac_restrictions, u8 *mac)
}
+
static int ap_control_mac_deny(struct mac_restrictions *mac_restrictions,
u8 *mac)
{
- struct list_head *ptr;
struct mac_entry *entry;
int found = 0;
@@ -421,10 +418,7 @@ static int ap_control_mac_deny(struct mac_restrictions *mac_restrictions,
return 0;
spin_lock_bh(&mac_restrictions->lock);
- for (ptr = mac_restrictions->mac_list.next;
- ptr != &mac_restrictions->mac_list; ptr = ptr->next) {
- entry = list_entry(ptr, struct mac_entry, list);
-
+ list_for_each_entry(entry, &mac_restrictions->mac_list, list) {
if (memcmp(entry->addr, mac, ETH_ALEN) == 0) {
found = 1;
break;
@@ -519,7 +513,7 @@ static int prism2_ap_proc_read(char *page, char **start, off_t off,
{
char *p = page;
struct ap_data *ap = (struct ap_data *) data;
- struct list_head *ptr;
+ struct sta_info *sta;
int i;
if (off > PROC_LIMIT) {
@@ -529,9 +523,7 @@ static int prism2_ap_proc_read(char *page, char **start, off_t off,
p += sprintf(p, "# BSSID CHAN SIGNAL NOISE RATE SSID FLAGS\n");
spin_lock_bh(&ap->sta_table_lock);
- for (ptr = ap->sta_list.next; ptr != &ap->sta_list; ptr = ptr->next) {
- struct sta_info *sta = (struct sta_info *) ptr;
-
+ list_for_each_entry(sta, &ap->sta_list, list) {
if (!sta->ap)
continue;
@@ -861,7 +853,7 @@ void hostap_init_ap_proc(local_info_t *local)
void hostap_free_data(struct ap_data *ap)
{
- struct list_head *n, *ptr;
+ struct sta_info *n, *sta;
if (ap == NULL || !ap->initialized) {
printk(KERN_DEBUG "hostap_free_data: ap has not yet been "
@@ -875,8 +867,7 @@ void hostap_free_data(struct ap_data *ap)
ap->crypt = ap->crypt_priv = NULL;
#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
- list_for_each_safe(ptr, n, &ap->sta_list) {
- struct sta_info *sta = list_entry(ptr, struct sta_info, list);
+ list_for_each_entry_safe(sta, n, &ap->sta_list, list) {
ap_sta_hash_del(ap, sta);
list_del(&sta->list);
if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap && sta->local)
@@ -3198,15 +3189,14 @@ int hostap_update_rx_stats(struct ap_data *ap,
void hostap_update_rates(local_info_t *local)
{
- struct list_head *ptr;
+ struct sta_info *sta;
struct ap_data *ap = local->ap;
if (!ap)
return;
spin_lock_bh(&ap->sta_table_lock);
- for (ptr = ap->sta_list.next; ptr != &ap->sta_list; ptr = ptr->next) {
- struct sta_info *sta = (struct sta_info *) ptr;
+ list_for_each_entry(sta, &ap->sta_list, list) {
prism2_check_tx_rates(sta);
}
spin_unlock_bh(&ap->sta_table_lock);
@@ -3242,11 +3232,10 @@ void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent,
void hostap_add_wds_links(local_info_t *local)
{
struct ap_data *ap = local->ap;
- struct list_head *ptr;
+ struct sta_info *sta;
spin_lock_bh(&ap->sta_table_lock);
- list_for_each(ptr, &ap->sta_list) {
- struct sta_info *sta = list_entry(ptr, struct sta_info, list);
+ list_for_each_entry(sta, &ap->sta_list, list) {
if (sta->ap)
hostap_wds_link_oper(local, sta->addr, WDS_ADD);
}
--
Matthias Kaehlcke
Linux Application Developer
Barcelona
You can chain me, you can torture me, you can even
destroy this body, but you will never imprison my mind
(Mahatma Gandhi)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] use list_for_each_entry() for iteration in Prism 54 driver
2007-05-25 13:04 ` [PATCH 2/2] use list_for_each() for iteration in Prism 54 driver Matthias Kaehlcke
@ 2007-05-27 10:39 ` Matthias Kaehlcke
2007-05-29 15:38 ` Luis R. Rodriguez
0 siblings, 1 reply; 8+ messages in thread
From: Matthias Kaehlcke @ 2007-05-27 10:39 UTC (permalink / raw)
To: developers, linux-wireless, linux-kernel, akpm
El Fri, May 25, 2007 at 03:04:44PM +0200 Matthias Kaehlcke ha dit:
> Use list_for_each() in the Prism54 driver to iterate over the MAC list
In response to a similar patch Christoph Hellwig suggests the use of
list_for_each_entry() instead of list_for_each(). Here is a evolution
of the patch that takes into account Christophs' suggestion
--
Prism54 driver: Use list_for_each_entry() instead of manual iteration
and substitute a list_for_each_safe() loop with
list_for_each_entry_safe()
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
--
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c
index 283be4a..585f599 100644
--- a/drivers/net/wireless/prism54/isl_ioctl.c
+++ b/drivers/net/wireless/prism54/isl_ioctl.c
@@ -1853,7 +1853,6 @@ prism54_del_mac(struct net_device *ndev, struct iw_request_info *info,
islpci_private *priv = netdev_priv(ndev);
struct islpci_acl *acl = &priv->acl;
struct mac_entry *entry;
- struct list_head *ptr;
struct sockaddr *addr = (struct sockaddr *) extra;
if (addr->sa_family != ARPHRD_ETHER)
@@ -1861,11 +1860,9 @@ prism54_del_mac(struct net_device *ndev, struct iw_request_info *info,
if (down_interruptible(&acl->sem))
return -ERESTARTSYS;
- for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
- entry = list_entry(ptr, struct mac_entry, _list);
-
+ list_for_each_entry(entry, &acl->mac_list, _list) {
if (memcmp(entry->addr, addr->sa_data, ETH_ALEN) == 0) {
- list_del(ptr);
+ list_del(&entry->_list);
acl->size--;
kfree(entry);
up(&acl->sem);
@@ -1883,7 +1880,6 @@ prism54_get_mac(struct net_device *ndev, struct iw_request_info *info,
islpci_private *priv = netdev_priv(ndev);
struct islpci_acl *acl = &priv->acl;
struct mac_entry *entry;
- struct list_head *ptr;
struct sockaddr *dst = (struct sockaddr *) extra;
dwrq->length = 0;
@@ -1891,9 +1887,7 @@ prism54_get_mac(struct net_device *ndev, struct iw_request_info *info,
if (down_interruptible(&acl->sem))
return -ERESTARTSYS;
- for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
- entry = list_entry(ptr, struct mac_entry, _list);
-
+ list_for_each_entry(entry, &acl->mac_list, _list) {
memcpy(dst->sa_data, entry->addr, ETH_ALEN);
dst->sa_family = ARPHRD_ETHER;
dwrq->length++;
@@ -1960,7 +1954,6 @@ prism54_get_policy(struct net_device *ndev, struct iw_request_info *info,
static int
prism54_mac_accept(struct islpci_acl *acl, char *mac)
{
- struct list_head *ptr;
struct mac_entry *entry;
int res = 0;
@@ -1972,8 +1965,7 @@ prism54_mac_accept(struct islpci_acl *acl, char *mac)
return 1;
}
- for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
- entry = list_entry(ptr, struct mac_entry, _list);
+ list_for_each_entry(entry, &acl->mac_list, _list) {
if (memcmp(entry->addr, mac, ETH_ALEN) == 0) {
res = 1;
break;
@@ -2216,11 +2208,9 @@ prism54_wpa_bss_ie_init(islpci_private *priv)
void
prism54_wpa_bss_ie_clean(islpci_private *priv)
{
- struct list_head *ptr, *n;
+ struct islpci_bss_wpa_ie *bss, *n;
- list_for_each_safe(ptr, n, &priv->bss_wpa_list) {
- struct islpci_bss_wpa_ie *bss;
- bss = list_entry(ptr, struct islpci_bss_wpa_ie, list);
+ list_for_each_entry_safe(bss, n, &priv->bss_wpa_list, list) {
kfree(bss);
}
}
--
Matthias Kaehlcke
Linux Application Developer
Barcelona
I am incapable of conceiving infinity, and yet I do not accept finity
(Simone de Beauvoir)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] use list_for_each_entry() for iteration in hostap_ap.c
2007-05-27 10:28 ` [PATCH 1/2] use list_for_each_entry() for iteration in hostap_ap.c Matthias Kaehlcke
@ 2007-05-28 2:44 ` Jouni Malinen
2007-05-28 6:45 ` Matthias Kaehlcke
1 sibling, 0 replies; 8+ messages in thread
From: Jouni Malinen @ 2007-05-28 2:44 UTC (permalink / raw)
To: Matthias Kaehlcke, Christoph Hellwig, hostap, linux-wireless,
linux-kernel, akpm
On Sun, May 27, 2007 at 12:28:24PM +0200, Matthias Kaehlcke wrote:
> thanks for your comment, here's a patch that uses
> list_for_each_entry(), additionally to the initial patch it
> substitutes some list_for_each() loops by list_for_each_entry()
Thanks! I added this to my list of patches for the driver.
Could you please send a Signed-off-by line for this later version of the
patch? You did it for the first version, but just to be sure, it would
be prefered to see this explicitly for each version.
--
Jouni Malinen PGP id EFC895FA
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] use list_for_each_entry() for iteration in hostap_ap.c
2007-05-27 10:28 ` [PATCH 1/2] use list_for_each_entry() for iteration in hostap_ap.c Matthias Kaehlcke
2007-05-28 2:44 ` Jouni Malinen
@ 2007-05-28 6:45 ` Matthias Kaehlcke
1 sibling, 0 replies; 8+ messages in thread
From: Matthias Kaehlcke @ 2007-05-28 6:45 UTC (permalink / raw)
To: Christoph Hellwig, j, hostap, linux-wireless, linux-kernel, akpm
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
--
Matthias Kaehlcke
Linux Application Developer
Barcelona
La posibilidad de realizar un suenyo es lo
que hace que la vida sea interesante
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] use list_for_each_entry() for iteration in Prism 54 driver
2007-05-27 10:39 ` [PATCH 2/2] use list_for_each_entry() " Matthias Kaehlcke
@ 2007-05-29 15:38 ` Luis R. Rodriguez
0 siblings, 0 replies; 8+ messages in thread
From: Luis R. Rodriguez @ 2007-05-29 15:38 UTC (permalink / raw)
To: Matthias Kaehlcke, developers, linux-wireless, linux-kernel, akpm
On 5/27/07, Matthias Kaehlcke <matthias.kaehlcke@gmail.com> wrote:
> El Fri, May 25, 2007 at 03:04:44PM +0200 Matthias Kaehlcke ha dit:
>
> > Use list_for_each() in the Prism54 driver to iterate over the MAC list
>
> In response to a similar patch Christoph Hellwig suggests the use of
> list_for_each_entry() instead of list_for_each(). Here is a evolution
> of the patch that takes into account Christophs' suggestion
>
> --
>
> Prism54 driver: Use list_for_each_entry() instead of manual iteration
> and substitute a list_for_each_safe() loop with
> list_for_each_entry_safe()
>
> Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Singed-off-by: Luis R. Rodriguez <mcgrof@gmail.com>
Looks good,
Luis
> --
>
> diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c
> index 283be4a..585f599 100644
> --- a/drivers/net/wireless/prism54/isl_ioctl.c
> +++ b/drivers/net/wireless/prism54/isl_ioctl.c
> @@ -1853,7 +1853,6 @@ prism54_del_mac(struct net_device *ndev, struct iw_request_info *info,
> islpci_private *priv = netdev_priv(ndev);
> struct islpci_acl *acl = &priv->acl;
> struct mac_entry *entry;
> - struct list_head *ptr;
> struct sockaddr *addr = (struct sockaddr *) extra;
>
> if (addr->sa_family != ARPHRD_ETHER)
> @@ -1861,11 +1860,9 @@ prism54_del_mac(struct net_device *ndev, struct iw_request_info *info,
>
> if (down_interruptible(&acl->sem))
> return -ERESTARTSYS;
> - for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
> - entry = list_entry(ptr, struct mac_entry, _list);
> -
> + list_for_each_entry(entry, &acl->mac_list, _list) {
> if (memcmp(entry->addr, addr->sa_data, ETH_ALEN) == 0) {
> - list_del(ptr);
> + list_del(&entry->_list);
> acl->size--;
> kfree(entry);
> up(&acl->sem);
> @@ -1883,7 +1880,6 @@ prism54_get_mac(struct net_device *ndev, struct iw_request_info *info,
> islpci_private *priv = netdev_priv(ndev);
> struct islpci_acl *acl = &priv->acl;
> struct mac_entry *entry;
> - struct list_head *ptr;
> struct sockaddr *dst = (struct sockaddr *) extra;
>
> dwrq->length = 0;
> @@ -1891,9 +1887,7 @@ prism54_get_mac(struct net_device *ndev, struct iw_request_info *info,
> if (down_interruptible(&acl->sem))
> return -ERESTARTSYS;
>
> - for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
> - entry = list_entry(ptr, struct mac_entry, _list);
> -
> + list_for_each_entry(entry, &acl->mac_list, _list) {
> memcpy(dst->sa_data, entry->addr, ETH_ALEN);
> dst->sa_family = ARPHRD_ETHER;
> dwrq->length++;
> @@ -1960,7 +1954,6 @@ prism54_get_policy(struct net_device *ndev, struct iw_request_info *info,
> static int
> prism54_mac_accept(struct islpci_acl *acl, char *mac)
> {
> - struct list_head *ptr;
> struct mac_entry *entry;
> int res = 0;
>
> @@ -1972,8 +1965,7 @@ prism54_mac_accept(struct islpci_acl *acl, char *mac)
> return 1;
> }
>
> - for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
> - entry = list_entry(ptr, struct mac_entry, _list);
> + list_for_each_entry(entry, &acl->mac_list, _list) {
> if (memcmp(entry->addr, mac, ETH_ALEN) == 0) {
> res = 1;
> break;
> @@ -2216,11 +2208,9 @@ prism54_wpa_bss_ie_init(islpci_private *priv)
> void
> prism54_wpa_bss_ie_clean(islpci_private *priv)
> {
> - struct list_head *ptr, *n;
> + struct islpci_bss_wpa_ie *bss, *n;
>
> - list_for_each_safe(ptr, n, &priv->bss_wpa_list) {
> - struct islpci_bss_wpa_ie *bss;
> - bss = list_entry(ptr, struct islpci_bss_wpa_ie, list);
> + list_for_each_entry_safe(bss, n, &priv->bss_wpa_list, list) {
> kfree(bss);
> }
> }
>
> --
> Matthias Kaehlcke
> Linux Application Developer
> Barcelona
>
> I am incapable of conceiving infinity, and yet I do not accept finity
> (Simone de Beauvoir)
> .''`.
> using free software / Debian GNU/Linux | http://debian.org : :' :
> `. `'`
> gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
> -
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-05-29 15:38 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20070525125630.GE31790@traven>
2007-05-25 13:03 ` [PATCH 1/2] use list_for_each() for iteration in Host AP driver Matthias Kaehlcke
2007-05-25 14:30 ` Christoph Hellwig
2007-05-27 10:28 ` [PATCH 1/2] use list_for_each_entry() for iteration in hostap_ap.c Matthias Kaehlcke
2007-05-28 2:44 ` Jouni Malinen
2007-05-28 6:45 ` Matthias Kaehlcke
2007-05-25 13:04 ` [PATCH 2/2] use list_for_each() for iteration in Prism 54 driver Matthias Kaehlcke
2007-05-27 10:39 ` [PATCH 2/2] use list_for_each_entry() " Matthias Kaehlcke
2007-05-29 15:38 ` Luis R. Rodriguez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).