staging: wilc1000: use g_linux_wlan->txq_spinlock not the pointer of it
authorGlen Lee <glen.lee@atmel.com>
Thu, 24 Sep 2015 09:14:56 +0000 (18:14 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Sep 2015 00:39:58 +0000 (02:39 +0200)
Use spinlock variable g_linux_wlan->txq_spinlock itself instead of
g_wlan.txq_spinlock which is pointer of g_linux_wlan->txq_spinlock.
Delete os_context.txq_spin_lock, g_wlan.txq_spinlock and it's related codes.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/linux_wlan.c
drivers/staging/wilc1000/wilc_wfi_netdevice.h
drivers/staging/wilc1000/wilc_wlan.c
drivers/staging/wilc1000/wilc_wlan_if.h

index d2678a3f89610ca462f0a119ed50bd61ae032e0b..d953ffe56ca6488728dc6c6f4802738a91c80188 100644 (file)
@@ -1062,8 +1062,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic)
 
        nwi->os_context.txq_add_to_head_critical_section = (void *)&g_linux_wlan->txq_add_to_head_cs;
 
-       nwi->os_context.txq_spin_lock = (void *)&g_linux_wlan->txq_spinlock;
-
        nwi->os_context.txq_wait_event = (void *)&g_linux_wlan->txq_event;
 
 #if defined(MEMORY_STATIC)
index 47e04c2d9607b3e59200eb73d394492d8ed0e7ef..b24b9a99b890ce066f67c706ae53b13bf1fd7177 100644 (file)
@@ -215,6 +215,7 @@ struct WILC_WFI_mon_priv {
        struct net_device *real_ndev;
 };
 
+extern linux_wlan_t *g_linux_wlan;
 extern struct net_device *WILC_WFI_devs[];
 void frmw_to_linux(u8 *buff, u32 size, u32 pkt_offset);
 void linux_wlan_mac_indicate(int flag);
index 5d93c7f94106eba21060773c137826acc9e219aa..d908fc8e05ce757ddf356660b322f10bfd019df5 100644 (file)
@@ -70,7 +70,6 @@ typedef struct {
        void *txq_lock;
 
        struct semaphore *txq_add_to_head_lock;
-       void *txq_spinlock;
        unsigned long txq_spinlock_flags;
 
        struct txq_entry_t *txq_head;
@@ -179,7 +178,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;
 
-       spin_lock_irqsave(p->txq_spinlock, flags);
+       spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
        if (p->txq_head) {
                tqe = p->txq_head;
                p->txq_head = tqe->next;
@@ -194,7 +193,7 @@ static struct txq_entry_t *wilc_wlan_txq_remove_from_head(void)
        } else {
                tqe = NULL;
        }
-       spin_unlock_irqrestore(p->txq_spinlock, flags);
+       spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
        return tqe;
 }
 
@@ -202,7 +201,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;
-       spin_lock_irqsave(p->txq_spinlock, flags);
+       spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
 
        if (p->txq_head == NULL) {
                tqe->next = NULL;
@@ -218,7 +217,7 @@ static void wilc_wlan_txq_add_to_tail(struct txq_entry_t *tqe)
        p->txq_entries += 1;
        PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", p->txq_entries);
 
-       spin_unlock_irqrestore(p->txq_spinlock, flags);
+       spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
 
        /**
         *      wake up TX queue
@@ -235,7 +234,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;
 
-       spin_lock_irqsave(p->txq_spinlock, flags);
+       spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
 
        if (p->txq_head == NULL) {
                tqe->next = NULL;
@@ -251,7 +250,7 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe)
        p->txq_entries += 1;
        PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", p->txq_entries);
 
-       spin_unlock_irqrestore(p->txq_spinlock, flags);
+       spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
        up(p->txq_add_to_head_lock);
 
 
@@ -352,9 +351,9 @@ static inline int remove_TCP_related(void)
        wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
        unsigned long flags;
 
-       spin_lock_irqsave(p->txq_spinlock, flags);
+       spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
 
-       spin_unlock_irqrestore(p->txq_spinlock, flags);
+       spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
        return 0;
 }
 
@@ -368,7 +367,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;
 
-       spin_lock_irqsave(p->txq_spinlock, flags);
+       spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
 
        eth_hdr_ptr = &buffer[0];
        h_proto = ntohs(*((unsigned short *)&eth_hdr_ptr[12]));
@@ -416,7 +415,7 @@ static inline int tcp_process(struct txq_entry_t *tqe)
        } else {
                ret = 0;
        }
-       spin_unlock_irqrestore(p->txq_spinlock, flags);
+       spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
        return ret;
 }
 
@@ -428,7 +427,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)
        u32 Dropped = 0;
        wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
 
-       spin_lock_irqsave(p->txq_spinlock, p->txq_spinlock_flags);
+       spin_lock_irqsave(&g_linux_wlan->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;
@@ -455,7 +454,8 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void)
                PendingAcks_arrBase = 0;
 
 
-       spin_unlock_irqrestore(p->txq_spinlock, p->txq_spinlock_flags);
+       spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock,
+                              p->txq_spinlock_flags);
 
        while (Dropped > 0) {
                /*consume the semaphore count of the removed packet*/
@@ -576,11 +576,11 @@ static struct txq_entry_t *wilc_wlan_txq_get_first(void)
        struct txq_entry_t *tqe;
        unsigned long flags;
 
-       spin_lock_irqsave(p->txq_spinlock, flags);
+       spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
 
        tqe = p->txq_head;
 
-       spin_unlock_irqrestore(p->txq_spinlock, flags);
+       spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
 
 
        return tqe;
@@ -588,12 +588,11 @@ static struct txq_entry_t *wilc_wlan_txq_get_first(void)
 
 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;
-       spin_lock_irqsave(p->txq_spinlock, flags);
+       spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
 
        tqe = tqe->next;
-       spin_unlock_irqrestore(p->txq_spinlock, flags);
+       spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
 
 
        return tqe;
@@ -1975,8 +1974,6 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)
 
        g_wlan.txq_add_to_head_lock = inp->os_context.txq_add_to_head_critical_section;
 
-       g_wlan.txq_spinlock = inp->os_context.txq_spin_lock;
-
        g_wlan.rxq_lock = inp->os_context.rxq_critical_section;
        g_wlan.txq_wait = inp->os_context.txq_wait_event;
        g_wlan.cfg_wait = inp->os_context.cfg_wait_event;
index b6fdb8a4b09f13a8487b24f1ab6cd1035c1ceb59..db87811fa30f0278452285267946e0c424f156f2 100644 (file)
@@ -114,7 +114,6 @@ typedef struct {
        void *txq_critical_section;
 
        void *txq_add_to_head_critical_section;
-       void *txq_spin_lock;
 
        void *txq_wait_event;