summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias@kaehlcke.net>2008-02-15 19:56:48 (GMT)
committerJohn W. Linville <linville@tuxdriver.com>2008-02-29 20:37:16 (GMT)
commit6f865c0ab9318cd4c357654e460cb4c9aaf23a92 (patch)
treeea5bedba8b046a1695ad88ad6b923bd2ce719060 /drivers
parent5c05863d0346c025a712b57622efe7828b29758e (diff)
downloadlinux-6f865c0ab9318cd4c357654e460cb4c9aaf23a92.tar.xz
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.c28
-rw-r--r--drivers/net/wireless/prism54/islpci_dev.h2
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 1b595a6..df1594e 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,
void
prism54_acl_init(struct islpci_acl *acl)
{
- sema_init(&acl->sem, 1);
+ mutex_init(&acl->lock);
INIT_LIST_HEAD(&acl->mac_list);
acl->size = 0;
acl->policy = MAC_POLICY_OPEN;
@@ -1792,10 +1792,10 @@ prism54_clear_mac(struct islpci_acl *acl)
struct list_head *ptr, *next;
struct mac_entry *entry;
- down(&acl->sem);
+ mutex_lock(&acl->lock);
if (acl->size == 0) {
- up(&acl->sem);
+ mutex_unlock(&acl->lock);
return;
}
@@ -1806,7 +1806,7 @@ prism54_clear_mac(struct islpci_acl *acl)
kfree(entry);
}
acl->size = 0;
- up(&acl->sem);
+ mutex_unlock(&acl->lock);
}
void
@@ -1833,13 +1833,13 @@ prism54_add_mac(struct net_device *ndev, struct iw_request_info *info,
memcpy(entry->addr, addr->sa_data, ETH_ALEN);
- if (down_interruptible(&acl->sem)) {
+ if (mutex_lock_interruptible(&acl->lock)) {
kfree(entry);
return -ERESTARTSYS;
}
list_add_tail(&entry->_list, &acl->mac_list);
acl->size++;
- up(&acl->sem);
+ mutex_unlock(&acl->lock);
return 0;
}
@@ -1856,18 +1856,18 @@ prism54_del_mac(struct net_device *ndev, struct iw_request_info *info,
if (addr->sa_family != ARPHRD_ETHER)
return -EOPNOTSUPP;
- if (down_interruptible(&acl->sem))
+ if (mutex_lock_interruptible(&acl->lock))
return -ERESTARTSYS;
list_for_each_entry(entry, &acl->mac_list, _list) {
if (memcmp(entry->addr, addr->sa_data, ETH_ALEN) == 0) {
list_del(&entry->_list);
acl->size--;
kfree(entry);
- up(&acl->sem);
+ mutex_unlock(&acl->lock);
return 0;
}
}
- up(&acl->sem);
+ mutex_unlock(&acl->lock);
return -EINVAL;
}
@@ -1882,7 +1882,7 @@ prism54_get_mac(struct net_device *ndev, struct iw_request_info *info,
dwrq->length = 0;
- if (down_interruptible(&acl->sem))
+ if (mutex_lock_interruptible(&acl->lock))
return -ERESTARTSYS;
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,
dwrq->length++;
dst++;
}
- up(&acl->sem);
+ mutex_unlock(&acl->lock);
return 0;
}
@@ -1955,11 +1955,11 @@ prism54_mac_accept(struct islpci_acl *acl, char *mac)
struct mac_entry *entry;
int res = 0;
- if (down_interruptible(&acl->sem))
+ if (mutex_lock_interruptible(&acl->lock))
return -ERESTARTSYS;
if (acl->policy == MAC_POLICY_OPEN) {
- up(&acl->sem);
+ mutex_unlock(&acl->lock);
return 1;
}
@@ -1970,7 +1970,7 @@ prism54_mac_accept(struct islpci_acl *acl, char *mac)
}
}
res = (acl->policy == MAC_POLICY_ACCEPT) ? !res : res;
- up(&acl->sem);
+ mutex_unlock(&acl->lock);
return res;
}
diff --git a/drivers/net/wireless/prism54/islpci_dev.h b/drivers/net/wireless/prism54/islpci_dev.h
index 4e0182c..b03a2ab 100644
--- a/drivers/net/wireless/prism54/islpci_dev.h
+++ b/drivers/net/wireless/prism54/islpci_dev.h
@@ -55,7 +55,7 @@ struct islpci_acl {
enum { MAC_POLICY_OPEN=0, MAC_POLICY_ACCEPT=1, MAC_POLICY_REJECT=2 } policy;
struct list_head mac_list; /* a list of mac_entry */
int size; /* size of queue */
- struct semaphore sem; /* accessed in ioctls and trap_work */
+ struct mutex lock; /* accessed in ioctls and trap_work */
};
struct islpci_membuf {