* [patch 1/3] Convert acl->sem in a mutex
[not found] <20080215195329.912560854@kaehlcke.net>
@ 2008-02-15 19:56 ` matthias
2008-02-15 21:55 ` Luis R. Rodriguez
2008-02-15 19:56 ` [patch 2/3] Convert stats_sem " matthias
2008-02-15 19:57 ` [patch 3/3] Convert wpa_sem " matthias
2 siblings, 1 reply; 6+ messages in thread
From: matthias @ 2008-02-15 19:56 UTC (permalink / raw)
To: mcgrof, linux-wireless; +Cc: linux-kernel, akpm, Matthias Kaehlcke
[-- Attachment #1: net-wireless-prism54-acl_sem-to-mutex.diff --]
[-- Type: text/plain, Size: 3701 bytes --]
The semaphore acl->sem is used as mutex, convert it to the mutex API
Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Index: linux-2.6/drivers/net/wireless/prism54/isl_ioctl.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/prism54/isl_ioctl.c 2008-02-15 20:42:17.000000000 +0100
+++ linux-2.6/drivers/net/wireless/prism54/isl_ioctl.c 2008-02-15 20:43:05.000000000 +0100
@@ -1780,7 +1780,7 @@
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 @@
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 @@
kfree(entry);
}
acl->size = 0;
- up(&acl->sem);
+ mutex_unlock(&acl->lock);
}
void
@@ -1833,13 +1833,13 @@
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 @@
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 @@
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 @@
dwrq->length++;
dst++;
}
- up(&acl->sem);
+ mutex_unlock(&acl->lock);
return 0;
}
@@ -1955,11 +1955,11 @@
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 @@
}
}
res = (acl->policy == MAC_POLICY_ACCEPT) ? !res : res;
- up(&acl->sem);
+ mutex_unlock(&acl->lock);
return res;
}
Index: linux-2.6/drivers/net/wireless/prism54/islpci_dev.h
===================================================================
--- linux-2.6.orig/drivers/net/wireless/prism54/islpci_dev.h 2008-02-15 20:43:27.000000000 +0100
+++ linux-2.6/drivers/net/wireless/prism54/islpci_dev.h 2008-02-15 20:43:49.000000000 +0100
@@ -55,7 +55,7 @@
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 {
--
Matthias Kaehlcke
Linux System Developer
Barcelona
We build too many walls and not enough bridges
(Isaac Newton)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 2/3] Convert stats_sem in a mutex
[not found] <20080215195329.912560854@kaehlcke.net>
2008-02-15 19:56 ` [patch 1/3] Convert acl->sem in a mutex matthias
@ 2008-02-15 19:56 ` matthias
2008-02-15 21:55 ` Luis R. Rodriguez
2008-02-15 19:57 ` [patch 3/3] Convert wpa_sem " matthias
2 siblings, 1 reply; 6+ messages in thread
From: matthias @ 2008-02-15 19:56 UTC (permalink / raw)
To: mcgrof, linux-wireless; +Cc: linux-kernel, akpm, Matthias Kaehlcke
[-- Attachment #1: net-wireless-prism54-stats_sem-to-mutex.diff --]
[-- Type: text/plain, Size: 2996 bytes --]
The semaphore stats_sem is used as mutex, convert it to the mutex API
Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Index: linux-2.6/drivers/net/wireless/prism54/isl_ioctl.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/prism54/isl_ioctl.c 2008-02-15 20:43:05.000000000 +0100
+++ linux-2.6/drivers/net/wireless/prism54/isl_ioctl.c 2008-02-15 20:44:03.000000000 +0100
@@ -165,7 +165,7 @@
struct obj_bss bss, *bss2;
union oid_res_t r;
- down(&priv->stats_sem);
+ mutex_lock(&priv->stats_lock);
/* Noise floor.
* I'm not sure if the unit is dBm.
@@ -207,7 +207,7 @@
mgt_get_request(priv, DOT11_OID_MPDUTXFAILED, 0, NULL, &r);
priv->local_iwstatistics.discard.retries = r.u;
- up(&priv->stats_sem);
+ mutex_unlock(&priv->stats_lock);
return;
}
@@ -218,12 +218,12 @@
islpci_private *priv = netdev_priv(ndev);
/* If the stats are being updated return old data */
- if (down_trylock(&priv->stats_sem) == 0) {
+ if (mutex_trylock(&priv->stats_lock) == 0) {
memcpy(&priv->iwstatistics, &priv->local_iwstatistics,
sizeof (struct iw_statistics));
/* They won't be marked updated for the next time */
priv->local_iwstatistics.qual.updated = 0;
- up(&priv->stats_sem);
+ mutex_unlock(&priv->stats_lock);
} else
priv->iwstatistics.qual.updated = 0;
Index: linux-2.6/drivers/net/wireless/prism54/islpci_dev.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/prism54/islpci_dev.c 2008-02-15 20:42:15.000000000 +0100
+++ linux-2.6/drivers/net/wireless/prism54/islpci_dev.c 2008-02-15 20:44:03.000000000 +0100
@@ -864,7 +864,7 @@
mutex_init(&priv->mgmt_lock);
priv->mgmt_received = NULL;
init_waitqueue_head(&priv->mgmt_wqueue);
- sema_init(&priv->stats_sem, 1);
+ mutex_init(&priv->stats_lock);
spin_lock_init(&priv->slock);
/* init state machine with off#1 state */
Index: linux-2.6/drivers/net/wireless/prism54/islpci_dev.h
===================================================================
--- linux-2.6.orig/drivers/net/wireless/prism54/islpci_dev.h 2008-02-15 20:43:49.000000000 +0100
+++ linux-2.6/drivers/net/wireless/prism54/islpci_dev.h 2008-02-15 20:44:03.000000000 +0100
@@ -88,7 +88,7 @@
/* Take care of the wireless stats */
struct work_struct stats_work;
- struct semaphore stats_sem;
+ struct mutex stats_lock;
/* remember when we last updated the stats */
unsigned long stats_timestamp;
/* The first is accessed under semaphore locking.
--
Matthias Kaehlcke
Linux System Developer
Barcelona
We build too many walls and not enough bridges
(Isaac Newton)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch 2/3] Convert stats_sem in a mutex
2008-02-15 19:56 ` [patch 2/3] Convert stats_sem " matthias
@ 2008-02-15 21:55 ` Luis R. Rodriguez
0 siblings, 0 replies; 6+ messages in thread
From: Luis R. Rodriguez @ 2008-02-15 21:55 UTC (permalink / raw)
To: matthias, mcgrof, linux-wireless, linux-kernel, akpm
On Fri, Feb 15, 2008 at 2:56 PM, <matthias@kaehlcke.net> wrote:
> The semaphore stats_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>
Thanks, BTW, for the next set you send please review the linux
wireless submitting patch guide. You just need to address the patch to
John, the maintainers and CC linux-wireless.
http://linuxwireless.org/en/developers/Documentation/SubmittingPatches
Luis
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 3/3] Convert wpa_sem in a mutex
[not found] <20080215195329.912560854@kaehlcke.net>
2008-02-15 19:56 ` [patch 1/3] Convert acl->sem in a mutex matthias
2008-02-15 19:56 ` [patch 2/3] Convert stats_sem " matthias
@ 2008-02-15 19:57 ` matthias
2008-02-15 21:56 ` Luis R. Rodriguez
2 siblings, 1 reply; 6+ messages in thread
From: matthias @ 2008-02-15 19:57 UTC (permalink / raw)
To: mcgrof, linux-wireless; +Cc: linux-kernel, akpm, Matthias Kaehlcke
[-- Attachment #1: net-wireless-prism54-wpa_sem-to-mutex.diff --]
[-- Type: text/plain, Size: 2345 bytes --]
The semaphore wpa_sem is used as mutex, convert it to the mutex API
Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Index: linux-2.6/drivers/net/wireless/prism54/isl_ioctl.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/prism54/isl_ioctl.c 2008-02-15 20:44:03.000000000 +0100
+++ linux-2.6/drivers/net/wireless/prism54/isl_ioctl.c 2008-02-15 20:44:11.000000000 +0100
@@ -2114,7 +2114,7 @@
if (wpa_ie_len > MAX_WPA_IE_LEN)
wpa_ie_len = MAX_WPA_IE_LEN;
- down(&priv->wpa_sem);
+ mutex_lock(&priv->wpa_lock);
/* try to use existing entry */
list_for_each(ptr, &priv->bss_wpa_list) {
@@ -2165,7 +2165,7 @@
kfree(bss);
}
- up(&priv->wpa_sem);
+ mutex_unlock(&priv->wpa_lock);
}
static size_t
@@ -2175,7 +2175,7 @@
struct islpci_bss_wpa_ie *bss = NULL;
size_t len = 0;
- down(&priv->wpa_sem);
+ mutex_lock(&priv->wpa_lock);
list_for_each(ptr, &priv->bss_wpa_list) {
bss = list_entry(ptr, struct islpci_bss_wpa_ie, list);
@@ -2187,7 +2187,7 @@
len = bss->wpa_ie_len;
memcpy(wpa_ie, bss->wpa_ie, len);
}
- up(&priv->wpa_sem);
+ mutex_unlock(&priv->wpa_lock);
return len;
}
@@ -2196,7 +2196,7 @@
prism54_wpa_bss_ie_init(islpci_private *priv)
{
INIT_LIST_HEAD(&priv->bss_wpa_list);
- sema_init(&priv->wpa_sem, 1);
+ mutex_init(&priv->wpa_lock);
}
void
Index: linux-2.6/drivers/net/wireless/prism54/islpci_dev.h
===================================================================
--- linux-2.6.orig/drivers/net/wireless/prism54/islpci_dev.h 2008-02-15 20:44:03.000000000 +0100
+++ linux-2.6/drivers/net/wireless/prism54/islpci_dev.h 2008-02-15 20:44:11.000000000 +0100
@@ -178,7 +178,7 @@
int wpa; /* WPA mode enabled */
struct list_head bss_wpa_list;
int num_bss_wpa;
- struct semaphore wpa_sem;
+ struct mutex wpa_lock;
u8 wpa_ie[MAX_WPA_IE_LEN];
size_t wpa_ie_len;
--
Matthias Kaehlcke
Linux System Developer
Barcelona
We build too many walls and not enough bridges
(Isaac Newton)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch 3/3] Convert wpa_sem in a mutex
2008-02-15 19:57 ` [patch 3/3] Convert wpa_sem " matthias
@ 2008-02-15 21:56 ` Luis R. Rodriguez
0 siblings, 0 replies; 6+ messages in thread
From: Luis R. Rodriguez @ 2008-02-15 21:56 UTC (permalink / raw)
To: matthias, mcgrof, linux-wireless, linux-kernel, akpm, John W. Linville
On Fri, Feb 15, 2008 at 2:57 PM, <matthias@kaehlcke.net> wrote:
> The semaphore wpa_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>
Luis
^ permalink raw reply [flat|nested] 6+ messages in thread