Convert acl->sem in a mutex
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/3 Convert acl->sem in a mutex
The semaphore acl->sem is used as mutex, convert it to the mutex API
drivers/net/wireless/prism54/isl_ioctl.c +14 -14
@@ -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; }
drivers/net/wireless/prism54/islpci_dev.h +1 -1
@@ -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 {
Signature · 10 lines
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 `-Quoted 3 lines · On Fri, Feb 15, 2008 at 2:56 PM, <[email protected]> wrote:
The semaphore
acl->semis used as mutex, convert it to the mutex APISigned-off-by Matthias Kaehlcke <[email protected]>
Luis
PATCH 2/3 Convert stats_sem in a mutex
In reply to a message not in the archiveThe semaphore stats_sem is used as mutex, convert it to the mutex API
drivers/net/wireless/prism54/isl_ioctl.c +4 -4
@@ -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 ;
drivers/net/wireless/prism54/islpci_dev.c +1 -1
@@ -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 */
drivers/net/wireless/prism54/islpci_dev.h +1 -1
@@ -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.
Signature · 10 lines
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 `-Re: [patch 2/3] Convert stats_sem in a mutex
Quoted 3 lines · On Fri, Feb 15, 2008 at 2:56 PM, <[email protected]> wrote:
The semaphore
stats_semis used as mutex, convert it to the mutex APISigned-off-by Matthias Kaehlcke <[email protected]>
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
PATCH 3/3 Convert wpa_sem in a mutex
In reply to a message not in the archiveThe semaphore wpa_sem is used as mutex, convert it to the mutex API
drivers/net/wireless/prism54/isl_ioctl.c +5 -5
@@ -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
drivers/net/wireless/prism54/islpci_dev.h +1 -1
@@ -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;
Signature · 10 lines
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 `-Re: [patch 3/3] Convert wpa_sem in a mutex
Quoted 3 lines · On Fri, Feb 15, 2008 at 2:57 PM, <[email protected]> wrote:
The semaphore
wpa_semis used as mutex, convert it to the mutex APISigned-off-by Matthias Kaehlcke <[email protected]>
Luis