diff options
author | Dima Zavin <dima@android.com> | 2011-01-05 16:04:43 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2011-06-14 09:09:32 -0700 |
commit | f23ba5021d5c4e35f0973dd0a15aa7dceaea0293 (patch) | |
tree | 57de522ee4dcbd2c04d73966e3c05fe8f1a31c2c /drivers | |
parent | da65eba112b2bcd1f54eb41bb0960078eba1657e (diff) | |
download | kernel_samsung_tuna-f23ba5021d5c4e35f0973dd0a15aa7dceaea0293.zip kernel_samsung_tuna-f23ba5021d5c4e35f0973dd0a15aa7dceaea0293.tar.gz kernel_samsung_tuna-f23ba5021d5c4e35f0973dd0a15aa7dceaea0293.tar.bz2 |
net: wireless: bcm4329: convert sempahore mutexes to real mutexes
Change-Id: I1cf1b0bfc2167d1be535d5066951796a569788e5
Signed-off-by: Dima Zavin <dima@android.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/bcm4329/dhd_linux.c | 17 | ||||
-rw-r--r-- | drivers/net/wireless/bcm4329/linux_osl.c | 31 |
2 files changed, 25 insertions, 23 deletions
diff --git a/drivers/net/wireless/bcm4329/dhd_linux.c b/drivers/net/wireless/bcm4329/dhd_linux.c index c7ef3ed..f14f5e8 100644 --- a/drivers/net/wireless/bcm4329/dhd_linux.c +++ b/drivers/net/wireless/bcm4329/dhd_linux.c @@ -43,6 +43,7 @@ #include <linux/ethtool.h> #include <linux/fcntl.h> #include <linux/fs.h> +#include <linux/mutex.h> #include <asm/uaccess.h> #include <asm/unaligned.h> @@ -254,7 +255,7 @@ typedef struct dhd_info { /* OS/stack specifics */ dhd_if_t *iflist[DHD_MAX_IFS]; - struct semaphore proto_sem; + struct mutex proto_sem; wait_queue_head_t ioctl_resp_wait; struct timer_list timer; bool wd_timer_valid; @@ -265,7 +266,7 @@ typedef struct dhd_info { /* Thread based operation */ bool threads_only; - struct semaphore sdsem; + struct mutex sdsem; long watchdog_pid; struct semaphore watchdog_sem; struct completion watchdog_exited; @@ -2058,7 +2059,7 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) net->netdev_ops = NULL; #endif - init_MUTEX(&dhd->proto_sem); + mutex_init(&dhd->proto_sem); /* Initialize other structure content */ init_waitqueue_head(&dhd->ioctl_resp_wait); init_waitqueue_head(&dhd->ctrl_wait); @@ -2105,7 +2106,7 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) dhd->timer.function = dhd_watchdog; /* Initialize thread based operation and lock */ - init_MUTEX(&dhd->sdsem); + mutex_init(&dhd->sdsem); if ((dhd_watchdog_prio >= 0) && (dhd_dpc_prio >= 0)) { dhd->threads_only = TRUE; } @@ -2621,7 +2622,7 @@ dhd_os_proto_block(dhd_pub_t *pub) dhd_info_t *dhd = (dhd_info_t *)(pub->info); if (dhd) { - down(&dhd->proto_sem); + mutex_lock(&dhd->proto_sem); return 1; } @@ -2634,7 +2635,7 @@ dhd_os_proto_unblock(dhd_pub_t *pub) dhd_info_t *dhd = (dhd_info_t *)(pub->info); if (dhd) { - up(&dhd->proto_sem); + mutex_unlock(&dhd->proto_sem); return 1; } @@ -2773,7 +2774,7 @@ dhd_os_sdlock(dhd_pub_t *pub) dhd = (dhd_info_t *)(pub->info); if (dhd->threads_only) - down(&dhd->sdsem); + mutex_lock(&dhd->sdsem); else spin_lock_bh(&dhd->sdlock); } @@ -2786,7 +2787,7 @@ dhd_os_sdunlock(dhd_pub_t *pub) dhd = (dhd_info_t *)(pub->info); if (dhd->threads_only) - up(&dhd->sdsem); + mutex_unlock(&dhd->sdsem); else spin_unlock_bh(&dhd->sdlock); } diff --git a/drivers/net/wireless/bcm4329/linux_osl.c b/drivers/net/wireless/bcm4329/linux_osl.c index d00bd1c..980416b 100644 --- a/drivers/net/wireless/bcm4329/linux_osl.c +++ b/drivers/net/wireless/bcm4329/linux_osl.c @@ -35,6 +35,7 @@ #include <bcmutils.h> #include <linux/delay.h> #include <pcicfg.h> +#include <linux/mutex.h> #define PCI_CFG_RETRY 10 @@ -46,7 +47,7 @@ #define STATIC_BUF_SIZE (PAGE_SIZE*2) #define STATIC_BUF_TOTAL_LEN (MAX_STATIC_BUF_NUM*STATIC_BUF_SIZE) typedef struct bcm_static_buf { - struct semaphore static_sem; + struct mutex static_sem; unsigned char *buf_ptr; unsigned char buf_use[MAX_STATIC_BUF_NUM]; } bcm_static_buf_t; @@ -57,7 +58,7 @@ static bcm_static_buf_t *bcm_static_buf = 0; typedef struct bcm_static_pkt { struct sk_buff *skb_4k[MAX_STATIC_PKT_NUM]; struct sk_buff *skb_8k[MAX_STATIC_PKT_NUM]; - struct semaphore osl_pkt_sem; + struct mutex osl_pkt_sem; unsigned char pkt_use[MAX_STATIC_PKT_NUM*2]; } bcm_static_pkt_t; static bcm_static_pkt_t *bcm_static_skb = 0; @@ -199,7 +200,7 @@ osl_attach(void *pdev, uint bustype, bool pkttag) /* printk("alloc static buf at %x!\n", (unsigned int)bcm_static_buf); */ } - init_MUTEX(&bcm_static_buf->static_sem); + mutex_init(&bcm_static_buf->static_sem); bcm_static_buf->buf_ptr = (unsigned char *)bcm_static_buf + STATIC_BUF_SIZE; @@ -217,7 +218,7 @@ osl_attach(void *pdev, uint bustype, bool pkttag) for (i = 0; i < MAX_STATIC_PKT_NUM*2; i++) bcm_static_skb->pkt_use[i] = 0; - init_MUTEX(&bcm_static_skb->osl_pkt_sem); + mutex_init(&bcm_static_skb->osl_pkt_sem); } #endif return osh; @@ -304,7 +305,7 @@ osl_pktget_static(osl_t *osh, uint len) } - down(&bcm_static_skb->osl_pkt_sem); + mutex_lock(&bcm_static_skb->osl_pkt_sem); if (len <= PAGE_SIZE) { @@ -317,7 +318,7 @@ osl_pktget_static(osl_t *osh, uint len) if (i != MAX_STATIC_PKT_NUM) { bcm_static_skb->pkt_use[i] = 1; - up(&bcm_static_skb->osl_pkt_sem); + mutex_unlock(&bcm_static_skb->osl_pkt_sem); skb = bcm_static_skb->skb_4k[i]; skb->tail = skb->data + len; @@ -337,7 +338,7 @@ osl_pktget_static(osl_t *osh, uint len) if (i != MAX_STATIC_PKT_NUM) { bcm_static_skb->pkt_use[i+MAX_STATIC_PKT_NUM] = 1; - up(&bcm_static_skb->osl_pkt_sem); + mutex_unlock(&bcm_static_skb->osl_pkt_sem); skb = bcm_static_skb->skb_8k[i]; skb->tail = skb->data + len; skb->len = len; @@ -347,7 +348,7 @@ osl_pktget_static(osl_t *osh, uint len) - up(&bcm_static_skb->osl_pkt_sem); + mutex_unlock(&bcm_static_skb->osl_pkt_sem); printk("all static pkt in use!\n"); return osl_pktget(osh, len); } @@ -362,9 +363,9 @@ osl_pktfree_static(osl_t *osh, void *p, bool send) { if (p == bcm_static_skb->skb_4k[i]) { - down(&bcm_static_skb->osl_pkt_sem); + mutex_lock(&bcm_static_skb->osl_pkt_sem); bcm_static_skb->pkt_use[i] = 0; - up(&bcm_static_skb->osl_pkt_sem); + mutex_unlock(&bcm_static_skb->osl_pkt_sem); return; @@ -466,7 +467,7 @@ osl_malloc(osl_t *osh, uint size) int i = 0; if ((size >= PAGE_SIZE)&&(size <= STATIC_BUF_SIZE)) { - down(&bcm_static_buf->static_sem); + mutex_lock(&bcm_static_buf->static_sem); for (i = 0; i < MAX_STATIC_BUF_NUM; i++) { @@ -476,13 +477,13 @@ osl_malloc(osl_t *osh, uint size) if (i == MAX_STATIC_BUF_NUM) { - up(&bcm_static_buf->static_sem); + mutex_unlock(&bcm_static_buf->static_sem); printk("all static buff in use!\n"); goto original; } bcm_static_buf->buf_use[i] = 1; - up(&bcm_static_buf->static_sem); + mutex_unlock(&bcm_static_buf->static_sem); bzero(bcm_static_buf->buf_ptr+STATIC_BUF_SIZE*i, size); if (osh) @@ -518,9 +519,9 @@ osl_mfree(osl_t *osh, void *addr, uint size) buf_idx = ((unsigned char *)addr - bcm_static_buf->buf_ptr)/STATIC_BUF_SIZE; - down(&bcm_static_buf->static_sem); + mutex_lock(&bcm_static_buf->static_sem); bcm_static_buf->buf_use[buf_idx] = 0; - up(&bcm_static_buf->static_sem); + mutex_unlock(&bcm_static_buf->static_sem); if (osh) { ASSERT(osh->magic == OS_HANDLE_MAGIC); |