#include <linux/ethtool.h>
#include <linux/fcntl.h>
#include <linux/fs.h>
+#include <linux/mutex.h>
#include <asm/uaccess.h>
#include <asm/unaligned.h>
/* 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;
/* Thread based operation */
bool threads_only;
- struct semaphore sdsem;
+ struct mutex sdsem;
long watchdog_pid;
struct semaphore watchdog_sem;
struct completion watchdog_exited;
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);
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;
}
dhd_info_t *dhd = (dhd_info_t *)(pub->info);
if (dhd) {
- down(&dhd->proto_sem);
+ mutex_lock(&dhd->proto_sem);
return 1;
}
dhd_info_t *dhd = (dhd_info_t *)(pub->info);
if (dhd) {
- up(&dhd->proto_sem);
+ mutex_unlock(&dhd->proto_sem);
return 1;
}
dhd = (dhd_info_t *)(pub->info);
if (dhd->threads_only)
- down(&dhd->sdsem);
+ mutex_lock(&dhd->sdsem);
else
spin_lock_bh(&dhd->sdlock);
}
dhd = (dhd_info_t *)(pub->info);
if (dhd->threads_only)
- up(&dhd->sdsem);
+ mutex_unlock(&dhd->sdsem);
else
spin_unlock_bh(&dhd->sdlock);
}
#include <bcmutils.h>
#include <linux/delay.h>
#include <pcicfg.h>
+#include <linux/mutex.h>
#define PCI_CFG_RETRY 10
#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;
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;
/* 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;
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;
}
- down(&bcm_static_skb->osl_pkt_sem);
+ mutex_lock(&bcm_static_skb->osl_pkt_sem);
if (len <= PAGE_SIZE)
{
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;
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;
- 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);
}
{
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;
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++)
{
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)
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);