LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: matthias@kaehlcke.net
To: mcgrof@gmail.com, linux-wireless@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
Matthias Kaehlcke <matthias@kaehlcke.net>
Subject: [patch 2/3] Convert stats_sem in a mutex
Date: Fri, 15 Feb 2008 20:56:59 +0100 [thread overview]
Message-ID: <20080215195659.GC22741@traven> (raw)
In-Reply-To: <20080215195329.912560854@kaehlcke.net>
[-- 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 `-
next prev parent reply other threads:[~2008-02-15 19:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20080215195329.912560854@kaehlcke.net>
2008-02-15 19:56 ` [patch 1/3] Convert acl->sem " matthias
2008-02-15 21:55 ` Luis R. Rodriguez
2008-02-15 19:56 ` matthias [this message]
2008-02-15 21:55 ` [patch 2/3] Convert stats_sem " Luis R. Rodriguez
2008-02-15 19:57 ` [patch 3/3] Convert wpa_sem " matthias
2008-02-15 21:56 ` Luis R. Rodriguez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080215195659.GC22741@traven \
--to=matthias@kaehlcke.net \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mcgrof@gmail.com \
--subject='Re: [patch 2/3] Convert stats_sem in a mutex' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).