Commit 5e150b52 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

staging: wilc1000: remove mutex_lock/unlock wrappers



Just call the functions directly.  Also fix the variable types to be
correct, not void *, so we have a semblance of type safety happening
now.

Cc: Johnny Kim <johnny.kim@atmel.com>
Cc: Rachel Kim <rachel.kim@atmel.com>
Cc: Dean Lee <dean.lee@atmel.com>
Cc: Chris Park <chris.park@atmel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c2e4c0f1
Loading
Loading
Loading
Loading
+4 −39
Original line number Diff line number Diff line
@@ -601,39 +601,6 @@ static void linux_wlan_deinit_mutex(void *plock)
	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)
{
@@ -1297,9 +1264,9 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic)
		  #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

@@ -1337,9 +1304,9 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic)
  #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

@@ -1461,8 +1428,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic)
	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;
+10 −10
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ typedef struct {
	 *      host interface functions
	 **/
	wilc_hif_func_t hif_func;
	void *hif_lock;
	struct mutex *hif_lock;

	/**
	 *      configuration interface functions
@@ -89,7 +89,7 @@ typedef struct {
	/**
	 *      RX queue
	 **/
	void *rxq_lock;
	struct mutex *rxq_lock;
	struct rxq_entry_t *rxq_head;
	struct rxq_entry_t *rxq_tail;
	int rxq_entries;
@@ -135,7 +135,7 @@ static CHIP_PS_STATE_T genuChipPSstate = CHIP_WAKEDUP;
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
@@ -151,7 +151,7 @@ INLINE void release_bus(BUS_RELEASE_T release)
	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);
}
/********************************************
 *
@@ -659,7 +659,7 @@ static int wilc_wlan_rxq_add(struct rxq_entry_t *rqe)
	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;
@@ -673,7 +673,7 @@ static int wilc_wlan_rxq_add(struct rxq_entry_t *rqe)
	}
	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;
}

@@ -685,12 +685,12 @@ static struct rxq_entry_t *wilc_wlan_rxq_remove(void)
	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");
@@ -2253,7 +2253,7 @@ u16 Set_machw_change_vir_if(bool bValue)
	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, &reg);
	if (!ret) {
		PRINT_ER("Error while Reading reg WILC_CHANGING_VIR_IF\n");
@@ -2269,7 +2269,7 @@ u16 Set_machw_change_vir_if(bool bValue)
	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;
}
+1 −3
Original line number Diff line number Diff line
@@ -90,8 +90,6 @@ typedef struct {
	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 *);
@@ -137,7 +135,7 @@ typedef struct {
typedef struct {
	void *os_private;

	void *hif_critical_section;
	struct mutex *hif_critical_section;

	uint32_t tx_buffer_size;
	void *txq_critical_section;