Commit 3623060a authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by David S. Miller

[PATCH] Use mutex instead of semaphore in the Host AP driver

The Host AP driver uses a semaphore as mutex. Use the mutex API
instead of the (binary) semaphore.
Signed-off-by: default avatarMatthias Kaehlcke <matthias.kaehlcke@gmail.com>
Acked-by: default avatarSatyam Sharma <satyam@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent d73ae55a
...@@ -825,7 +825,7 @@ static int hfa384x_get_rid(struct net_device *dev, u16 rid, void *buf, int len, ...@@ -825,7 +825,7 @@ static int hfa384x_get_rid(struct net_device *dev, u16 rid, void *buf, int len,
local->hw_downloading) local->hw_downloading)
return -ENODEV; return -ENODEV;
res = down_interruptible(&local->rid_bap_sem); res = mutex_lock_interruptible(&local->rid_bap_mtx);
if (res) if (res)
return res; return res;
...@@ -834,7 +834,7 @@ static int hfa384x_get_rid(struct net_device *dev, u16 rid, void *buf, int len, ...@@ -834,7 +834,7 @@ static int hfa384x_get_rid(struct net_device *dev, u16 rid, void *buf, int len,
printk(KERN_DEBUG "%s: hfa384x_get_rid: CMDCODE_ACCESS failed " printk(KERN_DEBUG "%s: hfa384x_get_rid: CMDCODE_ACCESS failed "
"(res=%d, rid=%04x, len=%d)\n", "(res=%d, rid=%04x, len=%d)\n",
dev->name, res, rid, len); dev->name, res, rid, len);
up(&local->rid_bap_sem); mutex_unlock(&local->rid_bap_mtx);
return res; return res;
} }
...@@ -861,7 +861,7 @@ static int hfa384x_get_rid(struct net_device *dev, u16 rid, void *buf, int len, ...@@ -861,7 +861,7 @@ static int hfa384x_get_rid(struct net_device *dev, u16 rid, void *buf, int len,
res = hfa384x_from_bap(dev, BAP0, buf, len); res = hfa384x_from_bap(dev, BAP0, buf, len);
spin_unlock_bh(&local->baplock); spin_unlock_bh(&local->baplock);
up(&local->rid_bap_sem); mutex_unlock(&local->rid_bap_mtx);
if (res) { if (res) {
if (res != -ENODATA) if (res != -ENODATA)
...@@ -902,7 +902,7 @@ static int hfa384x_set_rid(struct net_device *dev, u16 rid, void *buf, int len) ...@@ -902,7 +902,7 @@ static int hfa384x_set_rid(struct net_device *dev, u16 rid, void *buf, int len)
/* RID len in words and +1 for rec.rid */ /* RID len in words and +1 for rec.rid */
rec.len = cpu_to_le16(len / 2 + len % 2 + 1); rec.len = cpu_to_le16(len / 2 + len % 2 + 1);
res = down_interruptible(&local->rid_bap_sem); res = mutex_lock_interruptible(&local->rid_bap_mtx);
if (res) if (res)
return res; return res;
...@@ -917,12 +917,12 @@ static int hfa384x_set_rid(struct net_device *dev, u16 rid, void *buf, int len) ...@@ -917,12 +917,12 @@ static int hfa384x_set_rid(struct net_device *dev, u16 rid, void *buf, int len)
if (res) { if (res) {
printk(KERN_DEBUG "%s: hfa384x_set_rid (rid=%04x, len=%d) - " printk(KERN_DEBUG "%s: hfa384x_set_rid (rid=%04x, len=%d) - "
"failed - res=%d\n", dev->name, rid, len, res); "failed - res=%d\n", dev->name, rid, len, res);
up(&local->rid_bap_sem); mutex_unlock(&local->rid_bap_mtx);
return res; return res;
} }
res = hfa384x_cmd(dev, HFA384X_CMDCODE_ACCESS_WRITE, rid, NULL, NULL); res = hfa384x_cmd(dev, HFA384X_CMDCODE_ACCESS_WRITE, rid, NULL, NULL);
up(&local->rid_bap_sem); mutex_unlock(&local->rid_bap_mtx);
if (res) { if (res) {
printk(KERN_DEBUG "%s: hfa384x_set_rid: CMDCODE_ACCESS_WRITE " printk(KERN_DEBUG "%s: hfa384x_set_rid: CMDCODE_ACCESS_WRITE "
...@@ -3171,7 +3171,7 @@ prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx, ...@@ -3171,7 +3171,7 @@ prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx,
spin_lock_init(&local->cmdlock); spin_lock_init(&local->cmdlock);
spin_lock_init(&local->baplock); spin_lock_init(&local->baplock);
spin_lock_init(&local->lock); spin_lock_init(&local->lock);
init_MUTEX(&local->rid_bap_sem); mutex_init(&local->rid_bap_mtx);
if (card_idx < 0 || card_idx >= MAX_PARM_DEVICES) if (card_idx < 0 || card_idx >= MAX_PARM_DEVICES)
card_idx = 0; card_idx = 0;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <linux/wireless.h> #include <linux/wireless.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/mutex.h>
#include <net/iw_handler.h> #include <net/iw_handler.h>
#include "hostap_config.h" #include "hostap_config.h"
...@@ -641,7 +642,7 @@ struct local_info { ...@@ -641,7 +642,7 @@ struct local_info {
* when removing entries from the list. * when removing entries from the list.
* TX and RX paths can use read lock. */ * TX and RX paths can use read lock. */
spinlock_t cmdlock, baplock, lock; spinlock_t cmdlock, baplock, lock;
struct semaphore rid_bap_sem; struct mutex rid_bap_mtx;
u16 infofid; /* MAC buffer id for info frame */ u16 infofid; /* MAC buffer id for info frame */
/* txfid, intransmitfid, next_txtid, and next_alloc are protected by /* txfid, intransmitfid, next_txtid, and next_alloc are protected by
* txfidlock */ * txfidlock */
......
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