Commit 5a2d9af2 authored by Daniel Walker's avatar Daniel Walker Committed by Jeff Garzik

ps3: gelic: assoc_stat_lock semaphore to mutex

Signed-off-by: default avatarDaniel Walker <dwalker@mvista.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 3700b62b
...@@ -240,12 +240,12 @@ static u32 gelic_wl_get_link(struct net_device *netdev) ...@@ -240,12 +240,12 @@ static u32 gelic_wl_get_link(struct net_device *netdev)
u32 ret; u32 ret;
pr_debug("%s: <-\n", __func__); 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) if (wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED)
ret = 1; ret = 1;
else else
ret = 0; ret = 0;
up(&wl->assoc_stat_lock); mutex_unlock(&wl->assoc_stat_lock);
pr_debug("%s: ->\n", __func__); pr_debug("%s: ->\n", __func__);
return ret; return ret;
} }
...@@ -979,7 +979,7 @@ static int gelic_wl_get_essid(struct net_device *netdev, ...@@ -979,7 +979,7 @@ static int gelic_wl_get_essid(struct net_device *netdev,
unsigned long irqflag; unsigned long irqflag;
pr_debug("%s: <- \n", __func__); pr_debug("%s: <- \n", __func__);
down(&wl->assoc_stat_lock); mutex_lock(&wl->assoc_stat_lock);
spin_lock_irqsave(&wl->lock, irqflag); spin_lock_irqsave(&wl->lock, irqflag);
if (test_bit(GELIC_WL_STAT_ESSID_SET, &wl->stat) || if (test_bit(GELIC_WL_STAT_ESSID_SET, &wl->stat) ||
wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) { wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) {
...@@ -989,7 +989,7 @@ static int gelic_wl_get_essid(struct net_device *netdev, ...@@ -989,7 +989,7 @@ static int gelic_wl_get_essid(struct net_device *netdev,
} else } else
data->essid.flags = 0; data->essid.flags = 0;
up(&wl->assoc_stat_lock); mutex_unlock(&wl->assoc_stat_lock);
spin_unlock_irqrestore(&wl->lock, irqflag); spin_unlock_irqrestore(&wl->lock, irqflag);
pr_debug("%s: -> len=%d \n", __func__, data->essid.length); pr_debug("%s: -> len=%d \n", __func__, data->essid.length);
...@@ -1170,7 +1170,7 @@ static int gelic_wl_get_ap(struct net_device *netdev, ...@@ -1170,7 +1170,7 @@ static int gelic_wl_get_ap(struct net_device *netdev,
unsigned long irqflag; unsigned long irqflag;
pr_debug("%s: <-\n", __func__); pr_debug("%s: <-\n", __func__);
down(&wl->assoc_stat_lock); mutex_lock(&wl->assoc_stat_lock);
spin_lock_irqsave(&wl->lock, irqflag); spin_lock_irqsave(&wl->lock, irqflag);
if (wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) { if (wl->assoc_stat == GELIC_WL_ASSOC_STAT_ASSOCIATED) {
data->ap_addr.sa_family = ARPHRD_ETHER; data->ap_addr.sa_family = ARPHRD_ETHER;
...@@ -1180,7 +1180,7 @@ static int gelic_wl_get_ap(struct net_device *netdev, ...@@ -1180,7 +1180,7 @@ static int gelic_wl_get_ap(struct net_device *netdev,
memset(data->ap_addr.sa_data, 0, ETH_ALEN); memset(data->ap_addr.sa_data, 0, ETH_ALEN);
spin_unlock_irqrestore(&wl->lock, irqflag); spin_unlock_irqrestore(&wl->lock, irqflag);
up(&wl->assoc_stat_lock); mutex_unlock(&wl->assoc_stat_lock);
pr_debug("%s: ->\n", __func__); pr_debug("%s: ->\n", __func__);
return 0; return 0;
} }
...@@ -2151,7 +2151,7 @@ static void gelic_wl_disconnect_event(struct gelic_wl_info *wl, ...@@ -2151,7 +2151,7 @@ static void gelic_wl_disconnect_event(struct gelic_wl_info *wl,
* As it waits with timeout, just leave assoc_done * As it waits with timeout, just leave assoc_done
* uncompleted, then it terminates with timeout * 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__); pr_debug("%s: already locked\n", __func__);
lock = 0; lock = 0;
} else { } else {
...@@ -2170,7 +2170,7 @@ static void gelic_wl_disconnect_event(struct gelic_wl_info *wl, ...@@ -2170,7 +2170,7 @@ static void gelic_wl_disconnect_event(struct gelic_wl_info *wl,
netif_carrier_off(port_to_netdev(wl_port(wl))); netif_carrier_off(port_to_netdev(wl_port(wl)));
if (lock) if (lock)
up(&wl->assoc_stat_lock); mutex_unlock(&wl->assoc_stat_lock);
} }
/* /*
* event worker * event worker
...@@ -2258,7 +2258,7 @@ static void gelic_wl_assoc_worker(struct work_struct *work) ...@@ -2258,7 +2258,7 @@ static void gelic_wl_assoc_worker(struct work_struct *work)
wl = container_of(work, struct gelic_wl_info, assoc_work.work); 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) if (wl->assoc_stat != GELIC_WL_ASSOC_STAT_DISCONN)
goto out; goto out;
...@@ -2304,7 +2304,7 @@ static void gelic_wl_assoc_worker(struct work_struct *work) ...@@ -2304,7 +2304,7 @@ static void gelic_wl_assoc_worker(struct work_struct *work)
scan_lock_out: scan_lock_out:
mutex_unlock(&wl->scan_lock); mutex_unlock(&wl->scan_lock);
out: out:
up(&wl->assoc_stat_lock); mutex_unlock(&wl->assoc_stat_lock);
} }
/* /*
* Interrupt handler * Interrupt handler
...@@ -2432,7 +2432,7 @@ static struct net_device *gelic_wl_alloc(struct gelic_card *card) ...@@ -2432,7 +2432,7 @@ static struct net_device *gelic_wl_alloc(struct gelic_card *card)
INIT_DELAYED_WORK(&wl->event_work, gelic_wl_event_worker); INIT_DELAYED_WORK(&wl->event_work, gelic_wl_event_worker);
INIT_DELAYED_WORK(&wl->assoc_work, gelic_wl_assoc_worker); INIT_DELAYED_WORK(&wl->assoc_work, gelic_wl_assoc_worker);
mutex_init(&wl->scan_lock); mutex_init(&wl->scan_lock);
init_MUTEX(&wl->assoc_stat_lock); mutex_init(&wl->assoc_stat_lock);
init_completion(&wl->scan_done); init_completion(&wl->scan_done);
/* for the case that no scan request is issued and stop() is called */ /* for the case that no scan request is issued and stop() is called */
......
...@@ -266,7 +266,7 @@ struct gelic_wl_info { ...@@ -266,7 +266,7 @@ struct gelic_wl_info {
enum gelic_wl_wpa_level wpa_level; /* wpa/wpa2 */ enum gelic_wl_wpa_level wpa_level; /* wpa/wpa2 */
/* association handling */ /* association handling */
struct semaphore assoc_stat_lock; struct mutex assoc_stat_lock;
struct delayed_work assoc_work; struct delayed_work assoc_work;
enum gelic_wl_assoc_state assoc_stat; enum gelic_wl_assoc_state assoc_stat;
struct completion assoc_done; struct completion assoc_done;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment