diff options
author | Matthias Kaehlcke <matthias.kaehlcke@gmail.com> | 2007-07-09 15:03:32 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2007-07-10 14:25:40 -0400 |
commit | 426921bda10c33231e2b335e4ad08bc755c50740 (patch) | |
tree | d19d07527125ce1b1ce17db050df9dafaa52dd04 /drivers/net/wireless/prism54 | |
parent | 777fa98194f91dae24fd12de47eec1cbb0375b29 (diff) |
[PATCH] use list_for_each_entry() for iteration in Prism 54 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>
Cc: Christoph Hellwig <hch@lst.de>
Acked-by: Luis R. Rodriguez <mcgrof@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/prism54')
-rw-r--r-- | drivers/net/wireless/prism54/isl_ioctl.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c index 283be4a70524..585f5996d292 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, | |||
1853 | islpci_private *priv = netdev_priv(ndev); | 1853 | islpci_private *priv = netdev_priv(ndev); |
1854 | struct islpci_acl *acl = &priv->acl; | 1854 | struct islpci_acl *acl = &priv->acl; |
1855 | struct mac_entry *entry; | 1855 | struct mac_entry *entry; |
1856 | struct list_head *ptr; | ||
1857 | struct sockaddr *addr = (struct sockaddr *) extra; | 1856 | struct sockaddr *addr = (struct sockaddr *) extra; |
1858 | 1857 | ||
1859 | if (addr->sa_family != ARPHRD_ETHER) | 1858 | if (addr->sa_family != ARPHRD_ETHER) |
@@ -1861,11 +1860,9 @@ prism54_del_mac(struct net_device *ndev, struct iw_request_info *info, | |||
1861 | 1860 | ||
1862 | if (down_interruptible(&acl->sem)) | 1861 | if (down_interruptible(&acl->sem)) |
1863 | return -ERESTARTSYS; | 1862 | return -ERESTARTSYS; |
1864 | for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) { | 1863 | list_for_each_entry(entry, &acl->mac_list, _list) { |
1865 | entry = list_entry(ptr, struct mac_entry, _list); | ||
1866 | |||
1867 | if (memcmp(entry->addr, addr->sa_data, ETH_ALEN) == 0) { | 1864 | if (memcmp(entry->addr, addr->sa_data, ETH_ALEN) == 0) { |
1868 | list_del(ptr); | 1865 | list_del(&entry->_list); |
1869 | acl->size--; | 1866 | acl->size--; |
1870 | kfree(entry); | 1867 | kfree(entry); |
1871 | up(&acl->sem); | 1868 | up(&acl->sem); |
@@ -1883,7 +1880,6 @@ prism54_get_mac(struct net_device *ndev, struct iw_request_info *info, | |||
1883 | islpci_private *priv = netdev_priv(ndev); | 1880 | islpci_private *priv = netdev_priv(ndev); |
1884 | struct islpci_acl *acl = &priv->acl; | 1881 | struct islpci_acl *acl = &priv->acl; |
1885 | struct mac_entry *entry; | 1882 | struct mac_entry *entry; |
1886 | struct list_head *ptr; | ||
1887 | struct sockaddr *dst = (struct sockaddr *) extra; | 1883 | struct sockaddr *dst = (struct sockaddr *) extra; |
1888 | 1884 | ||
1889 | dwrq->length = 0; | 1885 | dwrq->length = 0; |
@@ -1891,9 +1887,7 @@ prism54_get_mac(struct net_device *ndev, struct iw_request_info *info, | |||
1891 | if (down_interruptible(&acl->sem)) | 1887 | if (down_interruptible(&acl->sem)) |
1892 | return -ERESTARTSYS; | 1888 | return -ERESTARTSYS; |
1893 | 1889 | ||
1894 | for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) { | 1890 | list_for_each_entry(entry, &acl->mac_list, _list) { |
1895 | entry = list_entry(ptr, struct mac_entry, _list); | ||
1896 | |||
1897 | memcpy(dst->sa_data, entry->addr, ETH_ALEN); | 1891 | memcpy(dst->sa_data, entry->addr, ETH_ALEN); |
1898 | dst->sa_family = ARPHRD_ETHER; | 1892 | dst->sa_family = ARPHRD_ETHER; |
1899 | dwrq->length++; | 1893 | dwrq->length++; |
@@ -1960,7 +1954,6 @@ prism54_get_policy(struct net_device *ndev, struct iw_request_info *info, | |||
1960 | static int | 1954 | static int |
1961 | prism54_mac_accept(struct islpci_acl *acl, char *mac) | 1955 | prism54_mac_accept(struct islpci_acl *acl, char *mac) |
1962 | { | 1956 | { |
1963 | struct list_head *ptr; | ||
1964 | struct mac_entry *entry; | 1957 | struct mac_entry *entry; |
1965 | int res = 0; | 1958 | int res = 0; |
1966 | 1959 | ||
@@ -1972,8 +1965,7 @@ prism54_mac_accept(struct islpci_acl *acl, char *mac) | |||
1972 | return 1; | 1965 | return 1; |
1973 | } | 1966 | } |
1974 | 1967 | ||
1975 | for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) { | 1968 | list_for_each_entry(entry, &acl->mac_list, _list) { |
1976 | entry = list_entry(ptr, struct mac_entry, _list); | ||
1977 | if (memcmp(entry->addr, mac, ETH_ALEN) == 0) { | 1969 | if (memcmp(entry->addr, mac, ETH_ALEN) == 0) { |
1978 | res = 1; | 1970 | res = 1; |
1979 | break; | 1971 | break; |
@@ -2216,11 +2208,9 @@ prism54_wpa_bss_ie_init(islpci_private *priv) | |||
2216 | void | 2208 | void |
2217 | prism54_wpa_bss_ie_clean(islpci_private *priv) | 2209 | prism54_wpa_bss_ie_clean(islpci_private *priv) |
2218 | { | 2210 | { |
2219 | struct list_head *ptr, *n; | 2211 | struct islpci_bss_wpa_ie *bss, *n; |
2220 | 2212 | ||
2221 | list_for_each_safe(ptr, n, &priv->bss_wpa_list) { | 2213 | list_for_each_entry_safe(bss, n, &priv->bss_wpa_list, list) { |
2222 | struct islpci_bss_wpa_ie *bss; | ||
2223 | bss = list_entry(ptr, struct islpci_bss_wpa_ie, list); | ||
2224 | kfree(bss); | 2214 | kfree(bss); |
2225 | } | 2215 | } |
2226 | } | 2216 | } |