netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Walker <dwalker@mvista.com>
To: jgarzik@pobox.com
Cc: netdev@vger.kernel.org, matthew@wil.cx, rusty@rustcorp.com.au,
	mingo@elte.hu, linux-kernel@vger.kernel.org, arjan@infradead.org,
	mokuno@sm.sony.co.jp, geoffrey.levand@am.sony.com
Subject: [PATCH 2/3] ps3: gelic: assoc_stat_lock semaphore to mutex
Date: Thu, 22 May 2008 00:00:02 -0700	[thread overview]
Message-ID: <20080522195406.490863853@mvista.com> (raw)
In-Reply-To: 20080522195404.061391772@mvista.com

[-- Attachment #1: ps3-gelic-wireless-assoc_stat_lock-semaphore-to-mutex.patch --]
[-- Type: text/plain, Size: 4002 bytes --]

Signed-off-by: Daniel Walker <dwalker@mvista.com>

---
 drivers/net/ps3_gelic_wireless.c |   22 +++++++++++-----------
 drivers/net/ps3_gelic_wireless.h |    2 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

Index: linux-2.6.25/drivers/net/ps3_gelic_wireless.c
===================================================================
--- linux-2.6.25.orig/drivers/net/ps3_gelic_wireless.c
+++ linux-2.6.25/drivers/net/ps3_gelic_wireless.c
@@ -240,12 +240,12 @@ static u32 gelic_wl_get_link(struct net_
 	u32 ret;
 
 	pr_debug("%s: <-\n", __func__);
-	down(&wl->assoc_stat_lock);
+	mutex_lock(&wl->assoc_stat_lock);
 	if (wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED)
 		ret = 1;
 	else
 		ret = 0;
-	up(&wl->assoc_stat_lock);
+	mutex_unlock(&wl->assoc_stat_lock);
 	pr_debug("%s: ->\n", __func__);
 	return ret;
 }
@@ -979,7 +979,7 @@ static int gelic_wl_get_essid(struct net
 	unsigned long irqflag;
 
 	pr_debug("%s: <- \n", __func__);
-	down(&wl->assoc_stat_lock);
+	mutex_lock(&wl->assoc_stat_lock);
 	spin_lock_irqsave(&wl->lock, irqflag);
 	if (test_bit(GELIC_WL_STAT_ESSID_SET, &wl->stat) ||
 	    wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) {
@@ -989,7 +989,7 @@ static int gelic_wl_get_essid(struct net
 	} else
 		data->essid.flags = 0;
 
-	up(&wl->assoc_stat_lock);
+	mutex_unlock(&wl->assoc_stat_lock);
 	spin_unlock_irqrestore(&wl->lock, irqflag);
 	pr_debug("%s: -> len=%d \n", __func__, data->essid.length);
 
@@ -1170,7 +1170,7 @@ static int gelic_wl_get_ap(struct net_de
 	unsigned long irqflag;
 
 	pr_debug("%s: <-\n", __func__);
-	down(&wl->assoc_stat_lock);
+	mutex_lock(&wl->assoc_stat_lock);
 	spin_lock_irqsave(&wl->lock, irqflag);
 	if (wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) {
 		data->ap_addr.sa_family = ARPHRD_ETHER;
@@ -1180,7 +1180,7 @@ static int gelic_wl_get_ap(struct net_de
 		memset(data->ap_addr.sa_data, 0, ETH_ALEN);
 
 	spin_unlock_irqrestore(&wl->lock, irqflag);
-	up(&wl->assoc_stat_lock);
+	mutex_unlock(&wl->assoc_stat_lock);
 	pr_debug("%s: ->\n", __func__);
 	return 0;
 }
@@ -2151,7 +2151,7 @@ static void gelic_wl_disconnect_event(st
 	 * As it waits with timeout, just leave assoc_done
 	 * uncompleted, then it terminates with timeout
 	 */
-	if (down_trylock(&wl->assoc_stat_lock)) {
+	if (!mutex_trylock(&wl->assoc_stat_lock)) {
 		pr_debug("%s: already locked\n", __func__);
 		lock = 0;
 	} else {
@@ -2170,7 +2170,7 @@ static void gelic_wl_disconnect_event(st
 	netif_carrier_off(port_to_netdev(wl_port(wl)));
 
 	if (lock)
-		up(&wl->assoc_stat_lock);
+		mutex_unlock(&wl->assoc_stat_lock);
 }
 /*
  * event worker
@@ -2258,7 +2258,7 @@ static void gelic_wl_assoc_worker(struct
 
 	wl = container_of(work, struct gelic_wl_info, assoc_work.work);
 
-	down(&wl->assoc_stat_lock);
+	mutex_lock(&wl->assoc_stat_lock);
 
 	if (wl->assoc_stat != GELIC_WL_ASSOC_STAT_DISCONN)
 		goto out;
@@ -2304,7 +2304,7 @@ static void gelic_wl_assoc_worker(struct
 scan_lock_out:
 	mutex_unlock(&wl->scan_lock);
 out:
-	up(&wl->assoc_stat_lock);
+	mutex_unlock(&wl->assoc_stat_lock);
 }
 /*
  * Interrupt handler
@@ -2432,7 +2432,7 @@ static struct net_device *gelic_wl_alloc
 	INIT_DELAYED_WORK(&wl->event_work, gelic_wl_event_worker);
 	INIT_DELAYED_WORK(&wl->assoc_work, gelic_wl_assoc_worker);
 	mutex_init(&wl->scan_lock);
-	init_MUTEX(&wl->assoc_stat_lock);
+	mutex_init(&wl->assoc_stat_lock);
 
 	init_completion(&wl->scan_done);
 	/* for the case that no scan request is issued and stop() is called */
Index: linux-2.6.25/drivers/net/ps3_gelic_wireless.h
===================================================================
--- linux-2.6.25.orig/drivers/net/ps3_gelic_wireless.h
+++ linux-2.6.25/drivers/net/ps3_gelic_wireless.h
@@ -266,7 +266,7 @@ struct gelic_wl_info {
 	enum gelic_wl_wpa_level wpa_level; /* wpa/wpa2 */
 
 	/* association handling */
-	struct semaphore assoc_stat_lock;
+	struct mutex assoc_stat_lock;
 	struct delayed_work assoc_work;
 	enum gelic_wl_assoc_state assoc_stat;
 	struct completion assoc_done;

-- 

  reply	other threads:[~2008-05-22  7:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-22  7:00 [PATCH 1/3] ps3: gelic: scan_lock semaphore to mutex Daniel Walker
2008-05-22  7:00 ` Daniel Walker [this message]
2008-05-22  7:00 ` [PATCH 3/3] ps3: gelic: updown_lock " Daniel Walker
2008-05-31  2:20   ` Jeff Garzik
     [not found] ` <20080522195404.061391772-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
2008-05-27  7:24   ` [PATCH 1/3] ps3: gelic: scan_lock " Masakazu Mokuno

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=20080522195406.490863853@mvista.com \
    --to=dwalker@mvista.com \
    --cc=arjan@infradead.org \
    --cc=geoffrey.levand@am.sony.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=mingo@elte.hu \
    --cc=mokuno@sm.sony.co.jp \
    --cc=netdev@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).