diff options
author | Matthias Kaehlcke <matthias@kaehlcke.net> | 2008-02-15 14:56:48 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-02-29 15:37:16 -0500 |
commit | 6f865c0ab9318cd4c357654e460cb4c9aaf23a92 (patch) | |
tree | ea5bedba8b046a1695ad88ad6b923bd2ce719060 /drivers | |
parent | 5c05863d0346c025a712b57622efe7828b29758e (diff) |
prism54: Convert acl->sem in a mutex
The semaphore acl->sem is used as mutex, convert it to the mutex API
Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Acked-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/prism54/isl_ioctl.c | 28 | ||||
-rw-r--r-- | drivers/net/wireless/prism54/islpci_dev.h | 2 |
2 files changed, 15 insertions, 15 deletions
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c index 1b595a6525f4..df1594ea942c 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.c +++ b/drivers/net/wireless/prism54/isl_ioctl.c | |||
@@ -1780,7 +1780,7 @@ prism54_set_raw(struct net_device *ndev, struct iw_request_info *info, | |||
1780 | void | 1780 | void |
1781 | prism54_acl_init(struct islpci_acl *acl) | 1781 | prism54_acl_init(struct islpci_acl *acl) |
1782 | { | 1782 | { |
1783 | sema_init(&acl->sem, 1); | 1783 | mutex_init(&acl->lock); |
1784 | INIT_LIST_HEAD(&acl->mac_list); | 1784 | INIT_LIST_HEAD(&acl->mac_list); |
1785 | acl->size = 0; | 1785 | acl->size = 0; |
1786 | acl->policy = MAC_POLICY_OPEN; | 1786 | acl->policy = MAC_POLICY_OPEN; |
@@ -1792,10 +1792,10 @@ prism54_clear_mac(struct islpci_acl *acl) | |||
1792 | struct list_head *ptr, *next; | 1792 | struct list_head *ptr, *next; |
1793 | struct mac_entry *entry; | 1793 | struct mac_entry *entry; |
1794 | 1794 | ||
1795 | down(&acl->sem); | 1795 | mutex_lock(&acl->lock); |
1796 | 1796 | ||
1797 | if (acl->size == 0) { | 1797 | if (acl->size == 0) { |
1798 | up(&acl->sem); | 1798 | mutex_unlock(&acl->lock); |
1799 | return; | 1799 | return; |
1800 | } | 1800 | } |
1801 | 1801 | ||
@@ -1806,7 +1806,7 @@ prism54_clear_mac(struct islpci_acl *acl) | |||
1806 | kfree(entry); | 1806 | kfree(entry); |
1807 | } | 1807 | } |
1808 | acl->size = 0; | 1808 | acl->size = 0; |
1809 | up(&acl->sem); | 1809 | mutex_unlock(&acl->lock); |
1810 | } | 1810 | } |
1811 | 1811 | ||
1812 | void | 1812 | void |
@@ -1833,13 +1833,13 @@ prism54_add_mac(struct net_device *ndev, struct iw_request_info *info, | |||
1833 | 1833 | ||
1834 | memcpy(entry->addr, addr->sa_data, ETH_ALEN); | 1834 | memcpy(entry->addr, addr->sa_data, ETH_ALEN); |
1835 | 1835 | ||
1836 | if (down_interruptible(&acl->sem)) { | 1836 | if (mutex_lock_interruptible(&acl->lock)) { |
1837 | kfree(entry); | 1837 | kfree(entry); |
1838 | return -ERESTARTSYS; | 1838 | return -ERESTARTSYS; |
1839 | } | 1839 | } |
1840 | list_add_tail(&entry->_list, &acl->mac_list); | 1840 | list_add_tail(&entry->_list, &acl->mac_list); |
1841 | acl->size++; | 1841 | acl->size++; |
1842 | up(&acl->sem); | 1842 | mutex_unlock(&acl->lock); |
1843 | 1843 | ||
1844 | return 0; | 1844 | return 0; |
1845 | } | 1845 | } |
@@ -1856,18 +1856,18 @@ prism54_del_mac(struct net_device *ndev, struct iw_request_info *info, | |||
1856 | if (addr->sa_family != ARPHRD_ETHER) | 1856 | if (addr->sa_family != ARPHRD_ETHER) |
1857 | return -EOPNOTSUPP; | 1857 | return -EOPNOTSUPP; |
1858 | 1858 | ||
1859 | if (down_interruptible(&acl->sem)) | 1859 | if (mutex_lock_interruptible(&acl->lock)) |
1860 | return -ERESTARTSYS; | 1860 | return -ERESTARTSYS; |
1861 | list_for_each_entry(entry, &acl->mac_list, _list) { | 1861 | list_for_each_entry(entry, &acl->mac_list, _list) { |
1862 | if (memcmp(entry->addr, addr->sa_data, ETH_ALEN) == 0) { | 1862 | if (memcmp(entry->addr, addr->sa_data, ETH_ALEN) == 0) { |
1863 | list_del(&entry->_list); | 1863 | list_del(&entry->_list); |
1864 | acl->size--; | 1864 | acl->size--; |
1865 | kfree(entry); | 1865 | kfree(entry); |
1866 | up(&acl->sem); | 1866 | mutex_unlock(&acl->lock); |
1867 | return 0; | 1867 | return 0; |
1868 | } | 1868 | } |
1869 | } | 1869 | } |
1870 | up(&acl->sem); | 1870 | mutex_unlock(&acl->lock); |
1871 | return -EINVAL; | 1871 | return -EINVAL; |
1872 | } | 1872 | } |
1873 | 1873 | ||
@@ -1882,7 +1882,7 @@ prism54_get_mac(struct net_device *ndev, struct iw_request_info *info, | |||
1882 | 1882 | ||
1883 | dwrq->length = 0; | 1883 | dwrq->length = 0; |
1884 | 1884 | ||
1885 | if (down_interruptible(&acl->sem)) | 1885 | if (mutex_lock_interruptible(&acl->lock)) |
1886 | return -ERESTARTSYS; | 1886 | return -ERESTARTSYS; |
1887 | 1887 | ||
1888 | list_for_each_entry(entry, &acl->mac_list, _list) { | 1888 | list_for_each_entry(entry, &acl->mac_list, _list) { |
@@ -1891,7 +1891,7 @@ prism54_get_mac(struct net_device *ndev, struct iw_request_info *info, | |||
1891 | dwrq->length++; | 1891 | dwrq->length++; |
1892 | dst++; | 1892 | dst++; |
1893 | } | 1893 | } |
1894 | up(&acl->sem); | 1894 | mutex_unlock(&acl->lock); |
1895 | return 0; | 1895 | return 0; |
1896 | } | 1896 | } |
1897 | 1897 | ||
@@ -1955,11 +1955,11 @@ prism54_mac_accept(struct islpci_acl *acl, char *mac) | |||
1955 | struct mac_entry *entry; | 1955 | struct mac_entry *entry; |
1956 | int res = 0; | 1956 | int res = 0; |
1957 | 1957 | ||
1958 | if (down_interruptible(&acl->sem)) | 1958 | if (mutex_lock_interruptible(&acl->lock)) |
1959 | return -ERESTARTSYS; | 1959 | return -ERESTARTSYS; |
1960 | 1960 | ||
1961 | if (acl->policy == MAC_POLICY_OPEN) { | 1961 | if (acl->policy == MAC_POLICY_OPEN) { |
1962 | up(&acl->sem); | 1962 | mutex_unlock(&acl->lock); |
1963 | return 1; | 1963 | return 1; |
1964 | } | 1964 | } |
1965 | 1965 | ||
@@ -1970,7 +1970,7 @@ prism54_mac_accept(struct islpci_acl *acl, char *mac) | |||
1970 | } | 1970 | } |
1971 | } | 1971 | } |
1972 | res = (acl->policy == MAC_POLICY_ACCEPT) ? !res : res; | 1972 | res = (acl->policy == MAC_POLICY_ACCEPT) ? !res : res; |
1973 | up(&acl->sem); | 1973 | mutex_unlock(&acl->lock); |
1974 | 1974 | ||
1975 | return res; | 1975 | return res; |
1976 | } | 1976 | } |
diff --git a/drivers/net/wireless/prism54/islpci_dev.h b/drivers/net/wireless/prism54/islpci_dev.h index 4e0182ce835b..b03a2ab0009b 100644 --- a/drivers/net/wireless/prism54/islpci_dev.h +++ b/drivers/net/wireless/prism54/islpci_dev.h | |||
@@ -55,7 +55,7 @@ struct islpci_acl { | |||
55 | enum { MAC_POLICY_OPEN=0, MAC_POLICY_ACCEPT=1, MAC_POLICY_REJECT=2 } policy; | 55 | enum { MAC_POLICY_OPEN=0, MAC_POLICY_ACCEPT=1, MAC_POLICY_REJECT=2 } policy; |
56 | struct list_head mac_list; /* a list of mac_entry */ | 56 | struct list_head mac_list; /* a list of mac_entry */ |
57 | int size; /* size of queue */ | 57 | int size; /* size of queue */ |
58 | struct semaphore sem; /* accessed in ioctls and trap_work */ | 58 | struct mutex lock; /* accessed in ioctls and trap_work */ |
59 | }; | 59 | }; |
60 | 60 | ||
61 | struct islpci_membuf { | 61 | struct islpci_membuf { |