netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] ps3: gelic: scan_lock semaphore to mutex
@ 2008-05-22  7:00 Daniel Walker
  2008-05-22  7:00 ` [PATCH 2/3] ps3: gelic: assoc_stat_lock " Daniel Walker
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Daniel Walker @ 2008-05-22  7:00 UTC (permalink / raw)
  To: jgarzik
  Cc: netdev, matthew, rusty, mingo, linux-kernel, arjan, mokuno,
	geoffrey.levand

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

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

---
 drivers/net/ps3_gelic_wireless.c |   18 +++++++++---------
 drivers/net/ps3_gelic_wireless.h |    2 +-
 2 files changed, 10 insertions(+), 10 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
@@ -695,7 +695,7 @@ static int gelic_wl_get_scan(struct net_
 	unsigned long this_time = jiffies;
 
 	pr_debug("%s: <-\n", __func__);
-	if (down_interruptible(&wl->scan_lock))
+	if (mutex_lock_interruptible(&wl->scan_lock))
 		return -EAGAIN;
 
 	switch (wl->scan_stat) {
@@ -733,7 +733,7 @@ static int gelic_wl_get_scan(struct net_
 	wrqu->data.length = ev - extra;
 	wrqu->data.flags = 0;
 out:
-	up(&wl->scan_lock);
+	mutex_unlock(&wl->scan_lock);
 	pr_debug("%s: -> %d %d\n", __func__, ret, wrqu->data.length);
 	return ret;
 }
@@ -1554,7 +1554,7 @@ static int gelic_wl_start_scan(struct ge
 	int ret = 0;
 
 	pr_debug("%s: <- always=%d\n", __func__, always_scan);
-	if (down_interruptible(&wl->scan_lock))
+	if (mutex_lock_interruptible(&wl->scan_lock))
 		return -ERESTARTSYS;
 
 	/*
@@ -1588,7 +1588,7 @@ static int gelic_wl_start_scan(struct ge
 	}
 	kfree(cmd);
 out:
-	up(&wl->scan_lock);
+	mutex_unlock(&wl->scan_lock);
 	pr_debug("%s: ->\n", __func__);
 	return ret;
 }
@@ -1610,7 +1610,7 @@ static void gelic_wl_scan_complete_event
 	DECLARE_MAC_BUF(mac);
 
 	pr_debug("%s:start\n", __func__);
-	down(&wl->scan_lock);
+	mutex_lock(&wl->scan_lock);
 
 	if (wl->scan_stat != GELIC_WL_SCAN_STAT_SCANNING) {
 		/*
@@ -1727,7 +1727,7 @@ static void gelic_wl_scan_complete_event
 			    NULL);
 out:
 	complete(&wl->scan_done);
-	up(&wl->scan_lock);
+	mutex_unlock(&wl->scan_lock);
 	pr_debug("%s:end\n", __func__);
 }
 
@@ -2282,7 +2282,7 @@ static void gelic_wl_assoc_worker(struct
 	wait_for_completion(&wl->scan_done);
 
 	pr_debug("%s: scan done\n", __func__);
-	down(&wl->scan_lock);
+	mutex_lock(&wl->scan_lock);
 	if (wl->scan_stat != GELIC_WL_SCAN_STAT_GOT_LIST) {
 		gelic_wl_send_iwap_event(wl, NULL);
 		pr_info("%s: no scan list. association failed\n", __func__);
@@ -2302,7 +2302,7 @@ static void gelic_wl_assoc_worker(struct
 	if (ret)
 		pr_info("%s: association failed %d\n", __func__, ret);
 scan_lock_out:
-	up(&wl->scan_lock);
+	mutex_unlock(&wl->scan_lock);
 out:
 	up(&wl->assoc_stat_lock);
 }
@@ -2431,7 +2431,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);
-	init_MUTEX(&wl->scan_lock);
+	mutex_init(&wl->scan_lock);
 	init_MUTEX(&wl->assoc_stat_lock);
 
 	init_completion(&wl->scan_done);
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
@@ -241,7 +241,7 @@ enum gelic_wl_assoc_state {
 #define GELIC_WEP_KEYS 4
 struct gelic_wl_info {
 	/* bss list */
-	struct semaphore scan_lock;
+	struct mutex scan_lock;
 	struct list_head network_list;
 	struct list_head network_free_list;
 	struct gelic_wl_scan_info *networks;

-- 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/3] ps3: gelic: assoc_stat_lock semaphore to mutex
  2008-05-22  7:00 [PATCH 1/3] ps3: gelic: scan_lock semaphore to mutex Daniel Walker
@ 2008-05-22  7:00 ` Daniel Walker
  2008-05-22  7:00 ` [PATCH 3/3] ps3: gelic: updown_lock " Daniel Walker
       [not found] ` <20080522195404.061391772-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
  2 siblings, 0 replies; 5+ messages in thread
From: Daniel Walker @ 2008-05-22  7:00 UTC (permalink / raw)
  To: jgarzik
  Cc: netdev, matthew, rusty, mingo, linux-kernel, arjan, mokuno,
	geoffrey.levand

[-- 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;

-- 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/3] ps3: gelic: updown_lock semaphore to mutex
  2008-05-22  7:00 [PATCH 1/3] ps3: gelic: scan_lock semaphore to mutex Daniel Walker
  2008-05-22  7:00 ` [PATCH 2/3] ps3: gelic: assoc_stat_lock " Daniel Walker
@ 2008-05-22  7:00 ` Daniel Walker
  2008-05-31  2:20   ` Jeff Garzik
       [not found] ` <20080522195404.061391772-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
  2 siblings, 1 reply; 5+ messages in thread
From: Daniel Walker @ 2008-05-22  7:00 UTC (permalink / raw)
  To: jgarzik
  Cc: netdev, matthew, rusty, mingo, linux-kernel, arjan, mokuno,
	geoffrey.levand

[-- Attachment #1: ps3-gelic-net-updown_lock-semaphore-to-mutex.patch --]
[-- Type: text/plain, Size: 2197 bytes --]

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

---
 drivers/net/ps3_gelic_net.c |   10 +++++-----
 drivers/net/ps3_gelic_net.h |    2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

Index: linux-2.6.25/drivers/net/ps3_gelic_net.c
===================================================================
--- linux-2.6.25.orig/drivers/net/ps3_gelic_net.c
+++ linux-2.6.25/drivers/net/ps3_gelic_net.c
@@ -110,7 +110,7 @@ static void gelic_card_get_ether_port_st
 void gelic_card_up(struct gelic_card *card)
 {
 	pr_debug("%s: called\n", __func__);
-	down(&card->updown_lock);
+	mutex_lock(&card->updown_lock);
 	if (atomic_inc_return(&card->users) == 1) {
 		pr_debug("%s: real do\n", __func__);
 		/* enable irq */
@@ -120,7 +120,7 @@ void gelic_card_up(struct gelic_card *ca
 
 		napi_enable(&card->napi);
 	}
-	up(&card->updown_lock);
+	mutex_unlock(&card->updown_lock);
 	pr_debug("%s: done\n", __func__);
 }
 
@@ -128,7 +128,7 @@ void gelic_card_down(struct gelic_card *
 {
 	u64 mask;
 	pr_debug("%s: called\n", __func__);
-	down(&card->updown_lock);
+	mutex_lock(&card->updown_lock);
 	if (atomic_dec_if_positive(&card->users) == 0) {
 		pr_debug("%s: real do\n", __func__);
 		napi_disable(&card->napi);
@@ -146,7 +146,7 @@ void gelic_card_down(struct gelic_card *
 		/* stop tx */
 		gelic_card_disable_txdmac(card);
 	}
-	up(&card->updown_lock);
+	mutex_unlock(&card->updown_lock);
 	pr_debug("%s: done\n", __func__);
 }
 
@@ -1534,7 +1534,7 @@ static struct gelic_card *gelic_alloc_ca
 	INIT_WORK(&card->tx_timeout_task, gelic_net_tx_timeout_task);
 	init_waitqueue_head(&card->waitq);
 	atomic_set(&card->tx_timeout_task_counter, 0);
-	init_MUTEX(&card->updown_lock);
+	mutex_init(&card->updown_lock);
 	atomic_set(&card->users, 0);
 
 	return card;
Index: linux-2.6.25/drivers/net/ps3_gelic_net.h
===================================================================
--- linux-2.6.25.orig/drivers/net/ps3_gelic_net.h
+++ linux-2.6.25/drivers/net/ps3_gelic_net.h
@@ -298,7 +298,7 @@ struct gelic_card {
 	wait_queue_head_t waitq;
 
 	/* only first user should up the card */
-	struct semaphore updown_lock;
+	struct mutex updown_lock;
 	atomic_t users;
 
 	u64 ether_port_status;

-- 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] ps3: gelic: scan_lock semaphore to mutex
       [not found] ` <20080522195404.061391772-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
@ 2008-05-27  7:24   ` Masakazu Mokuno
  0 siblings, 0 replies; 5+ messages in thread
From: Masakazu Mokuno @ 2008-05-27  7:24 UTC (permalink / raw)
  To: Daniel Walker
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, jgarzik-e+AXbWqSrlAAvxtiuMwx3w,
	netdev-u79uwXL29TY76Z2rM5mHXA, matthew-Ztpu424NOJ8,
	rusty-8n+1lVoiYb80n/F98K4Iww, mingo-X9Un+BFzKDI,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, arjan-wEGCiKHe2LqWVfeAwA7xHQ,
	geoffrey.levand-mEdOJwZ7QcZBDgjK7y7TUQ,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA

Added CC: linux-wireless

On Thu, 22 May 2008 00:00:01 -0700
Daniel Walker <dwalker-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org> wrote:

> Signed-off-by: Daniel Walker <dwalker-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
> 

patches #1 - #3:

Acked-by: Masakazu Mokuno <mokuno-DfbDroY8Xu1L9jVzuh4AOg@public.gmane.org>

> ---
>  drivers/net/ps3_gelic_wireless.c |   18 +++++++++---------
>  drivers/net/ps3_gelic_wireless.h |    2 +-
>  2 files changed, 10 insertions(+), 10 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
> @@ -695,7 +695,7 @@ static int gelic_wl_get_scan(struct net_
>  	unsigned long this_time = jiffies;
>  
>  	pr_debug("%s: <-\n", __func__);
> -	if (down_interruptible(&wl->scan_lock))
> +	if (mutex_lock_interruptible(&wl->scan_lock))
>  		return -EAGAIN;
>  
>  	switch (wl->scan_stat) {
> @@ -733,7 +733,7 @@ static int gelic_wl_get_scan(struct net_
>  	wrqu->data.length = ev - extra;
>  	wrqu->data.flags = 0;
>  out:
> -	up(&wl->scan_lock);
> +	mutex_unlock(&wl->scan_lock);
>  	pr_debug("%s: -> %d %d\n", __func__, ret, wrqu->data.length);
>  	return ret;
>  }
> @@ -1554,7 +1554,7 @@ static int gelic_wl_start_scan(struct ge
>  	int ret = 0;
>  
>  	pr_debug("%s: <- always=%d\n", __func__, always_scan);
> -	if (down_interruptible(&wl->scan_lock))
> +	if (mutex_lock_interruptible(&wl->scan_lock))
>  		return -ERESTARTSYS;
>  
>  	/*
> @@ -1588,7 +1588,7 @@ static int gelic_wl_start_scan(struct ge
>  	}
>  	kfree(cmd);
>  out:
> -	up(&wl->scan_lock);
> +	mutex_unlock(&wl->scan_lock);
>  	pr_debug("%s: ->\n", __func__);
>  	return ret;
>  }
> @@ -1610,7 +1610,7 @@ static void gelic_wl_scan_complete_event
>  	DECLARE_MAC_BUF(mac);
>  
>  	pr_debug("%s:start\n", __func__);
> -	down(&wl->scan_lock);
> +	mutex_lock(&wl->scan_lock);
>  
>  	if (wl->scan_stat != GELIC_WL_SCAN_STAT_SCANNING) {
>  		/*
> @@ -1727,7 +1727,7 @@ static void gelic_wl_scan_complete_event
>  			    NULL);
>  out:
>  	complete(&wl->scan_done);
> -	up(&wl->scan_lock);
> +	mutex_unlock(&wl->scan_lock);
>  	pr_debug("%s:end\n", __func__);
>  }
>  
> @@ -2282,7 +2282,7 @@ static void gelic_wl_assoc_worker(struct
>  	wait_for_completion(&wl->scan_done);
>  
>  	pr_debug("%s: scan done\n", __func__);
> -	down(&wl->scan_lock);
> +	mutex_lock(&wl->scan_lock);
>  	if (wl->scan_stat != GELIC_WL_SCAN_STAT_GOT_LIST) {
>  		gelic_wl_send_iwap_event(wl, NULL);
>  		pr_info("%s: no scan list. association failed\n", __func__);
> @@ -2302,7 +2302,7 @@ static void gelic_wl_assoc_worker(struct
>  	if (ret)
>  		pr_info("%s: association failed %d\n", __func__, ret);
>  scan_lock_out:
> -	up(&wl->scan_lock);
> +	mutex_unlock(&wl->scan_lock);
>  out:
>  	up(&wl->assoc_stat_lock);
>  }
> @@ -2431,7 +2431,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);
> -	init_MUTEX(&wl->scan_lock);
> +	mutex_init(&wl->scan_lock);
>  	init_MUTEX(&wl->assoc_stat_lock);
>  
>  	init_completion(&wl->scan_done);
> 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
> @@ -241,7 +241,7 @@ enum gelic_wl_assoc_state {
>  #define GELIC_WEP_KEYS 4
>  struct gelic_wl_info {
>  	/* bss list */
> -	struct semaphore scan_lock;
> +	struct mutex scan_lock;
>  	struct list_head network_list;
>  	struct list_head network_free_list;
>  	struct gelic_wl_scan_info *networks;
> 
> -- 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 
Masakazu Mokuno

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/3] ps3: gelic: updown_lock semaphore to mutex
  2008-05-22  7:00 ` [PATCH 3/3] ps3: gelic: updown_lock " Daniel Walker
@ 2008-05-31  2:20   ` Jeff Garzik
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Garzik @ 2008-05-31  2:20 UTC (permalink / raw)
  To: Daniel Walker
  Cc: netdev, matthew, rusty, mingo, linux-kernel, arjan, mokuno,
	geoffrey.levand

applied 1-3



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-05-31  2:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-22  7:00 [PATCH 1/3] ps3: gelic: scan_lock semaphore to mutex Daniel Walker
2008-05-22  7:00 ` [PATCH 2/3] ps3: gelic: assoc_stat_lock " Daniel Walker
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

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).