staging: wilc1000: remove spinlock wrappers
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Sep 2015 03:17:31 +0000 (20:17 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Sep 2015 01:24:42 +0000 (18:24 -0700)
Just call the spinlock functions directly, no need for the indirection.

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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/linux_wlan.c
drivers/staging/wilc1000/wilc_wlan.c
drivers/staging/wilc1000/wilc_wlan_if.h

index 84bdfc195c9fbfe7885d5ebd81101d2ff47fdd35..c90c45907422db74031463cf2e42d551dd5c8424 100644 (file)
@@ -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;
index e34ce53a23192220cfe645d9db3fa89f7d8a2d4b..248f3d90cd9c82b5cc0a461d226e253aea6cb06d 100644 (file)
@@ -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 *)&eth_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;
index 3519b2280e20f5916ef949d80090b0c61977b0cf..8b8cf9ba75b401175b6b6996eef1f92b7b736cae 100644 (file)
@@ -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 {