mutex_destroy((struct mutex *)plock);
}
-static void linux_wlan_lock_mutex(void *vp)
-{
- PRINT_D(LOCK_DBG, "Locking mutex %p\n", vp);
- if (vp != NULL) {
- /*
- * if(mutex_is_locked((struct mutex*)vp))
- * {
- * //PRINT_ER("Mutex already locked - %p \n",vp);
- * }
- */
- mutex_lock((struct mutex *)vp);
-
- } else {
- PRINT_ER("Failed, mutex is NULL\n");
- }
-}
-
-static void linux_wlan_unlock_mutex(void *vp)
-{
- PRINT_D(LOCK_DBG, "Unlocking mutex %p\n", vp);
- if (vp != NULL) {
-
- if (mutex_is_locked((struct mutex *)vp)) {
- mutex_unlock((struct mutex *)vp);
- } else {
- /* PRINT_ER("Mutex already unlocked - %p\n",vp); */
- }
-
- } else {
- PRINT_ER("Failed, mutex is NULL\n");
- }
-}
-
/*Added by Amr - BugID_4720*/
static void linux_wlan_init_spin_lock(char *lockName, void *plock, int count)
{
#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
#else
- linux_wlan_lock_mutex((void *)&g_linux_wlan->hif_cs);
+ mutex_lock(&g_linux_wlan->hif_cs);
disable_sdio_interrupt();
- linux_wlan_unlock_mutex((void *)&g_linux_wlan->hif_cs);
+ mutex_unlock(&g_linux_wlan->hif_cs);
#endif
#endif
#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
- linux_wlan_lock_mutex((void *)&g_linux_wlan->hif_cs);
+ mutex_lock(&g_linux_wlan->hif_cs);
disable_sdio_interrupt();
- linux_wlan_unlock_mutex((void *)&g_linux_wlan->hif_cs);
+ mutex_unlock(&g_linux_wlan->hif_cs);
#endif
#endif
nwi->os_func.os_unlock = linux_wlan_unlock;
nwi->os_func.os_wait = linux_wlan_lock_timeout;
nwi->os_func.os_signal = linux_wlan_unlock;
- nwi->os_func.os_enter_cs = linux_wlan_lock_mutex;
- nwi->os_func.os_leave_cs = linux_wlan_unlock_mutex;
/*Added by Amr - BugID_4720*/
nwi->os_func.os_spin_lock = linux_wlan_spin_lock;
* host interface functions
**/
wilc_hif_func_t hif_func;
- void *hif_lock;
+ struct mutex *hif_lock;
/**
* configuration interface functions
/**
* RX queue
**/
- void *rxq_lock;
+ struct mutex *rxq_lock;
struct rxq_entry_t *rxq_head;
struct rxq_entry_t *rxq_tail;
int rxq_entries;
INLINE void acquire_bus(BUS_ACQUIRE_T acquire)
{
- g_wlan.os_func.os_enter_cs(g_wlan.hif_lock);
+ mutex_lock(g_wlan.hif_lock);
#ifndef WILC_OPTIMIZE_SLEEP_INT
if (genuChipPSstate != CHIP_WAKEDUP)
#endif
if (release == RELEASE_ALLOW_SLEEP)
chip_allow_sleep();
#endif
- g_wlan.os_func.os_leave_cs(g_wlan.hif_lock);
+ mutex_unlock(g_wlan.hif_lock);
}
/********************************************
*
if (p->quit)
return 0;
- p->os_func.os_enter_cs(p->rxq_lock);
+ mutex_lock(p->rxq_lock);
if (p->rxq_head == NULL) {
PRINT_D(RX_DBG, "Add to Queue head\n");
rqe->next = NULL;
}
p->rxq_entries += 1;
PRINT_D(RX_DBG, "Number of queue entries: %d\n", p->rxq_entries);
- p->os_func.os_leave_cs(p->rxq_lock);
+ mutex_unlock(p->rxq_lock);
return p->rxq_entries;
}
if (p->rxq_head) {
struct rxq_entry_t *rqe;
- p->os_func.os_enter_cs(p->rxq_lock);
+ mutex_lock(p->rxq_lock);
rqe = p->rxq_head;
p->rxq_head = p->rxq_head->next;
p->rxq_entries -= 1;
PRINT_D(RX_DBG, "RXQ entries decreased\n");
- p->os_func.os_leave_cs(p->rxq_lock);
+ mutex_unlock(p->rxq_lock);
return rqe;
}
PRINT_D(RX_DBG, "Nothing to get from Q\n");
u32 reg;
/*Reset WILC_CHANGING_VIR_IF register to allow adding futrue keys to CE H/W*/
- (&g_wlan)->os_func.os_enter_cs((&g_wlan)->hif_lock);
+ mutex_lock((&g_wlan)->hif_lock);
ret = (&g_wlan)->hif_func.hif_read_reg(WILC_CHANGING_VIR_IF, ®);
if (!ret) {
PRINT_ER("Error while Reading reg WILC_CHANGING_VIR_IF\n");
if (!ret) {
PRINT_ER("Error while writing reg WILC_CHANGING_VIR_IF\n");
}
- (&g_wlan)->os_func.os_leave_cs((&g_wlan)->hif_lock);
+ mutex_unlock((&g_wlan)->hif_lock);
return ret;
}
void (*os_unlock)(void *);
int (*os_wait)(void *, u32);
void (*os_signal)(void *);
- void (*os_enter_cs)(void *);
- void (*os_leave_cs)(void *);
/*Added by Amr - BugID_4720*/
void (*os_spin_lock)(void *, unsigned long *);
typedef struct {
void *os_private;
- void *hif_critical_section;
+ struct mutex *hif_critical_section;
uint32_t tx_buffer_size;
void *txq_critical_section;