From: Greg Kroah-Hartman Date: Fri, 4 Sep 2015 03:17:31 +0000 (-0700) Subject: staging: wilc1000: remove spinlock wrappers X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=17c4d5d541e282f05b709885578d7c5ac18e49d8;p=openwrt%2Fstaging%2Fblogic.git staging: wilc1000: remove spinlock wrappers Just call the spinlock functions directly, no need for the indirection. Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 84bdfc195c9f..c90c45907422 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -555,31 +555,6 @@ static int linux_wlan_lock_timeout(void *vp, u32 timeout) return error; } -static void linux_wlan_spin_lock(void *vp, unsigned long *flags) -{ - unsigned long lflags; - - PRINT_D(SPIN_DEBUG, "Lock spin %p\n", vp); - if (vp != NULL) { - spin_lock_irqsave((spinlock_t *)vp, lflags); - *flags = lflags; - } else { - PRINT_ER("Failed, spin lock is NULL\n"); - } -} -static void linux_wlan_spin_unlock(void *vp, unsigned long *flags) -{ - unsigned long lflags = *flags; - - PRINT_D(SPIN_DEBUG, "Unlock spin %p\n", vp); - if (vp != NULL) { - spin_unlock_irqrestore((spinlock_t *)vp, lflags); - *flags = lflags; - } else { - PRINT_ER("Failed, spin lock is NULL\n"); - } -} - static void linux_wlan_mac_indicate(int flag) { /*I have to do it that way becuase there is no mean to encapsulate device pointer @@ -1339,10 +1314,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic) nwi->os_func.os_debug = linux_wlan_dbg; nwi->os_func.os_wait = linux_wlan_lock_timeout; - /*Added by Amr - BugID_4720*/ - nwi->os_func.os_spin_lock = linux_wlan_spin_lock; - nwi->os_func.os_spin_unlock = linux_wlan_spin_unlock; - #ifdef WILC_SDIO nwi->io_func.io_type = HIF_SDIO; nwi->io_func.io_init = linux_sdio_init; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index e34ce53a2319..248f3d90cd9c 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -189,7 +189,7 @@ static struct txq_entry_t *wilc_wlan_txq_remove_from_head(void) wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan; unsigned long flags; - p->os_func.os_spin_lock(p->txq_spinlock, &flags); + spin_lock_irqsave(p->txq_spinlock, flags); if (p->txq_head) { tqe = p->txq_head; p->txq_head = tqe->next; @@ -205,7 +205,7 @@ static struct txq_entry_t *wilc_wlan_txq_remove_from_head(void) } else { tqe = NULL; } - p->os_func.os_spin_unlock(p->txq_spinlock, &flags); + spin_unlock_irqrestore(p->txq_spinlock, flags); return tqe; } @@ -214,7 +214,7 @@ static void wilc_wlan_txq_add_to_tail(struct txq_entry_t *tqe) wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan; unsigned long flags; /*Added by Amr - BugID_4720*/ - p->os_func.os_spin_lock(p->txq_spinlock, &flags); + spin_lock_irqsave(p->txq_spinlock, flags); if (p->txq_head == NULL) { tqe->next = NULL; @@ -231,7 +231,7 @@ static void wilc_wlan_txq_add_to_tail(struct txq_entry_t *tqe) PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", p->txq_entries); /*Added by Amr - BugID_4720*/ - p->os_func.os_spin_unlock(p->txq_spinlock, &flags); + spin_unlock_irqrestore(p->txq_spinlock, flags); /** * wake up TX queue @@ -249,7 +249,7 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) if (p->os_func.os_wait(p->txq_add_to_head_lock, CFG_PKTS_TIMEOUT)) return -1; - p->os_func.os_spin_lock(p->txq_spinlock, &flags); + spin_lock_irqsave(p->txq_spinlock, flags); if (p->txq_head == NULL) { tqe->next = NULL; @@ -266,7 +266,7 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", p->txq_entries); /*Added by Amr - BugID_4720*/ - p->os_func.os_spin_unlock(p->txq_spinlock, &flags); + spin_unlock_irqrestore(p->txq_spinlock, flags); up(p->txq_add_to_head_lock); @@ -368,9 +368,9 @@ static __inline int remove_TCP_related(void) wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan; unsigned long flags; - p->os_func.os_spin_lock(p->txq_spinlock, &flags); + spin_lock_irqsave(p->txq_spinlock, flags); - p->os_func.os_spin_unlock(p->txq_spinlock, &flags); + spin_unlock_irqrestore(p->txq_spinlock, flags); return 0; } @@ -384,7 +384,7 @@ static __inline int tcp_process(struct txq_entry_t *tqe) wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan; unsigned long flags; - p->os_func.os_spin_lock(p->txq_spinlock, &flags); + spin_lock_irqsave(p->txq_spinlock, flags); eth_hdr_ptr = &buffer[0]; h_proto = ntohs(*((unsigned short *)ð_hdr_ptr[12])); @@ -432,7 +432,7 @@ static __inline int tcp_process(struct txq_entry_t *tqe) } else { ret = 0; } - p->os_func.os_spin_unlock(p->txq_spinlock, &flags); + spin_unlock_irqrestore(p->txq_spinlock, flags); return ret; } @@ -444,7 +444,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void) uint32_t Dropped = 0; wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan; - p->os_func.os_spin_lock(p->txq_spinlock, &p->txq_spinlock_flags); + spin_lock_irqsave(p->txq_spinlock, p->txq_spinlock_flags); for (i = PendingAcks_arrBase; i < (PendingAcks_arrBase + Pending_Acks); i++) { if (Pending_Acks_info[i].ack_num < Acks_keep_track_info[Pending_Acks_info[i].Session_index].Bigger_Ack_num) { struct txq_entry_t *tqe; @@ -471,7 +471,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void) PendingAcks_arrBase = 0; - p->os_func.os_spin_unlock(p->txq_spinlock, &p->txq_spinlock_flags); + spin_unlock_irqrestore(p->txq_spinlock, p->txq_spinlock_flags); while (Dropped > 0) { /*consume the semaphore count of the removed packet*/ @@ -624,12 +624,12 @@ static struct txq_entry_t *wilc_wlan_txq_get_first(void) unsigned long flags; /*Added by Amr - BugID_4720*/ - p->os_func.os_spin_lock(p->txq_spinlock, &flags); + spin_lock_irqsave(p->txq_spinlock, flags); tqe = p->txq_head; /*Added by Amr - BugID_4720*/ - p->os_func.os_spin_unlock(p->txq_spinlock, &flags); + spin_unlock_irqrestore(p->txq_spinlock, flags); return tqe; @@ -640,11 +640,11 @@ static struct txq_entry_t *wilc_wlan_txq_get_next(struct txq_entry_t *tqe) wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan; unsigned long flags; /*Added by Amr - BugID_4720*/ - p->os_func.os_spin_lock(p->txq_spinlock, &flags); + spin_lock_irqsave(p->txq_spinlock, flags); tqe = tqe->next; /*Added by Amr - BugID_4720*/ - p->os_func.os_spin_unlock(p->txq_spinlock, &flags); + spin_unlock_irqrestore(p->txq_spinlock, flags); return tqe; diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index 3519b2280e20..8b8cf9ba75b4 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -87,11 +87,6 @@ typedef struct { void (*os_sleep)(uint32_t); void (*os_debug)(uint8_t *); int (*os_wait)(void *, u32); - - /*Added by Amr - BugID_4720*/ - void (*os_spin_lock)(void *, unsigned long *); - void (*os_spin_unlock)(void *, unsigned long *); - } wilc_wlan_os_func_t; typedef struct {