aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>2007-07-30 01:40:04 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:49:36 -0400
commit3623060abbf1cdd7f292645bea31d024e21792ef (patch)
treebb2ee9191ad506a714e12801f729cbbd535e1386 /drivers/net
parentd73ae55ad46be6a0a11b9b71f9910c73c1b9dbb7 (diff)
[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: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Acked-by: Satyam Sharma <satyam@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/hostap/hostap_hw.c14
-rw-r--r--drivers/net/wireless/hostap/hostap_wlan.h3
2 files changed, 9 insertions, 8 deletions
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index 959887b70ca7..d3dacbceabb3 100644
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -825,7 +825,7 @@ static int hfa384x_get_rid(struct net_device *dev, u16 rid, void *buf, int len,
825 local->hw_downloading) 825 local->hw_downloading)
826 return -ENODEV; 826 return -ENODEV;
827 827
828 res = down_interruptible(&local->rid_bap_sem); 828 res = mutex_lock_interruptible(&local->rid_bap_mtx);
829 if (res) 829 if (res)
830 return res; 830 return res;
831 831
@@ -834,7 +834,7 @@ static int hfa384x_get_rid(struct net_device *dev, u16 rid, void *buf, int len,
834 printk(KERN_DEBUG "%s: hfa384x_get_rid: CMDCODE_ACCESS failed " 834 printk(KERN_DEBUG "%s: hfa384x_get_rid: CMDCODE_ACCESS failed "
835 "(res=%d, rid=%04x, len=%d)\n", 835 "(res=%d, rid=%04x, len=%d)\n",
836 dev->name, res, rid, len); 836 dev->name, res, rid, len);
837 up(&local->rid_bap_sem); 837 mutex_unlock(&local->rid_bap_mtx);
838 return res; 838 return res;
839 } 839 }
840 840
@@ -861,7 +861,7 @@ static int hfa384x_get_rid(struct net_device *dev, u16 rid, void *buf, int len,
861 res = hfa384x_from_bap(dev, BAP0, buf, len); 861 res = hfa384x_from_bap(dev, BAP0, buf, len);
862 862
863 spin_unlock_bh(&local->baplock); 863 spin_unlock_bh(&local->baplock);
864 up(&local->rid_bap_sem); 864 mutex_unlock(&local->rid_bap_mtx);
865 865
866 if (res) { 866 if (res) {
867 if (res != -ENODATA) 867 if (res != -ENODATA)
@@ -902,7 +902,7 @@ static int hfa384x_set_rid(struct net_device *dev, u16 rid, void *buf, int len)
902 /* RID len in words and +1 for rec.rid */ 902 /* RID len in words and +1 for rec.rid */
903 rec.len = cpu_to_le16(len / 2 + len % 2 + 1); 903 rec.len = cpu_to_le16(len / 2 + len % 2 + 1);
904 904
905 res = down_interruptible(&local->rid_bap_sem); 905 res = mutex_lock_interruptible(&local->rid_bap_mtx);
906 if (res) 906 if (res)
907 return res; 907 return res;
908 908
@@ -917,12 +917,12 @@ static int hfa384x_set_rid(struct net_device *dev, u16 rid, void *buf, int len)
917 if (res) { 917 if (res) {
918 printk(KERN_DEBUG "%s: hfa384x_set_rid (rid=%04x, len=%d) - " 918 printk(KERN_DEBUG "%s: hfa384x_set_rid (rid=%04x, len=%d) - "
919 "failed - res=%d\n", dev->name, rid, len, res); 919 "failed - res=%d\n", dev->name, rid, len, res);
920 up(&local->rid_bap_sem); 920 mutex_unlock(&local->rid_bap_mtx);
921 return res; 921 return res;
922 } 922 }
923 923
924 res = hfa384x_cmd(dev, HFA384X_CMDCODE_ACCESS_WRITE, rid, NULL, NULL); 924 res = hfa384x_cmd(dev, HFA384X_CMDCODE_ACCESS_WRITE, rid, NULL, NULL);
925 up(&local->rid_bap_sem); 925 mutex_unlock(&local->rid_bap_mtx);
926 926
927 if (res) { 927 if (res) {
928 printk(KERN_DEBUG "%s: hfa384x_set_rid: CMDCODE_ACCESS_WRITE " 928 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 spin_lock_init(&local->cmdlock); 3171 spin_lock_init(&local->cmdlock);
3172 spin_lock_init(&local->baplock); 3172 spin_lock_init(&local->baplock);
3173 spin_lock_init(&local->lock); 3173 spin_lock_init(&local->lock);
3174 init_MUTEX(&local->rid_bap_sem); 3174 mutex_init(&local->rid_bap_mtx);
3175 3175
3176 if (card_idx < 0 || card_idx >= MAX_PARM_DEVICES) 3176 if (card_idx < 0 || card_idx >= MAX_PARM_DEVICES)
3177 card_idx = 0; 3177 card_idx = 0;
diff --git a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h
index 87a54aa6f4dd..a42325c145b4 100644
--- a/drivers/net/wireless/hostap/hostap_wlan.h
+++ b/drivers/net/wireless/hostap/hostap_wlan.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/wireless.h> 4#include <linux/wireless.h>
5#include <linux/netdevice.h> 5#include <linux/netdevice.h>
6#include <linux/mutex.h>
6#include <net/iw_handler.h> 7#include <net/iw_handler.h>
7 8
8#include "hostap_config.h" 9#include "hostap_config.h"
@@ -641,7 +642,7 @@ struct local_info {
641 * when removing entries from the list. 642 * when removing entries from the list.
642 * TX and RX paths can use read lock. */ 643 * TX and RX paths can use read lock. */
643 spinlock_t cmdlock, baplock, lock; 644 spinlock_t cmdlock, baplock, lock;
644 struct semaphore rid_bap_sem; 645 struct mutex rid_bap_mtx;
645 u16 infofid; /* MAC buffer id for info frame */ 646 u16 infofid; /* MAC buffer id for info frame */
646 /* txfid, intransmitfid, next_txtid, and next_alloc are protected by 647 /* txfid, intransmitfid, next_txtid, and next_alloc are protected by
647 * txfidlock */ 648 * txfidlock */