These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / staging / rtl8188eu / core / rtw_sta_mgt.c
index dc9d0dd..1beeac4 100644 (file)
@@ -54,14 +54,12 @@ static void _rtw_init_stainfo(struct sta_info *psta)
 
        psta->bpairwise_key_installed = false;
 
-#ifdef CONFIG_88EU_AP_MODE
        psta->nonerp_set = 0;
        psta->no_short_slot_time_set = 0;
        psta->no_short_preamble_set = 0;
        psta->no_ht_gf_set = 0;
        psta->no_ht_set = 0;
        psta->ht_20mhz_set = 0;
-#endif
 
        psta->under_exist_checking = 0;
 
@@ -145,32 +143,6 @@ inline struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int
        return (struct sta_info *)(stapriv->pstainfo_buf + offset * sizeof(struct sta_info));
 }
 
-/*  this function is used to free the memory of lock || sema for all stainfos */
-static void rtw_mfree_all_stainfo(struct sta_priv *pstapriv)
-{
-       struct list_head *plist, *phead;
-       struct sta_info *psta = NULL;
-
-
-       spin_lock_bh(&pstapriv->sta_hash_lock);
-
-       phead = get_list_head(&pstapriv->free_sta_queue);
-       plist = phead->next;
-
-       while (phead != plist) {
-               psta = container_of(plist, struct sta_info , list);
-               plist = plist->next;
-       }
-
-       spin_unlock_bh(&pstapriv->sta_hash_lock);
-
-}
-
-static void rtw_mfree_sta_priv_lock(struct sta_priv *pstapriv)
-{
-        rtw_mfree_all_stainfo(pstapriv); /* be done before free sta_hash_lock */
-}
-
 u32    _rtw_free_sta_priv(struct       sta_priv *pstapriv)
 {
        struct list_head *phead, *plist;
@@ -187,7 +159,8 @@ u32 _rtw_free_sta_priv(struct       sta_priv *pstapriv)
 
                        while (phead != plist) {
                                int i;
-                               psta = container_of(plist, struct sta_info , hash_list);
+                               psta = container_of(plist, struct sta_info,
+                                                   hash_list);
                                plist = plist->next;
 
                                for (i = 0; i < 16; i++) {
@@ -199,8 +172,6 @@ u32 _rtw_free_sta_priv(struct       sta_priv *pstapriv)
                spin_unlock_bh(&pstapriv->sta_hash_lock);
                /*===============================*/
 
-               rtw_mfree_sta_priv_lock(pstapriv);
-
                if (pstapriv->pallocated_stainfo_buf)
                        vfree(pstapriv->pallocated_stainfo_buf);
        }
@@ -259,7 +230,7 @@ struct      sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
 
                RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_,
                         ("alloc number_%d stainfo  with hwaddr = %pM\n",
-                        pstapriv->asoc_sta_count , hwaddr));
+                        pstapriv->asoc_sta_count, hwaddr));
 
                init_addba_retry_timer(pstapriv->padapter, psta);
 
@@ -293,7 +264,7 @@ exit:
 }
 
 /*  using pstapriv->sta_hash_lock to protect */
-u32    rtw_free_stainfo(struct adapter *padapter , struct sta_info *psta)
+u32    rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta)
 {
        int i;
        struct __queue *pfree_sta_queue;
@@ -303,7 +274,7 @@ u32 rtw_free_stainfo(struct adapter *padapter , struct sta_info *psta)
        struct  sta_priv *pstapriv = &padapter->stapriv;
 
 
-       if (psta == NULL)
+       if (!psta)
                goto exit;
 
        pfree_sta_queue = &pstapriv->free_sta_queue;
@@ -334,7 +305,11 @@ u32        rtw_free_stainfo(struct adapter *padapter , struct sta_info *psta)
        spin_unlock_bh(&pxmitpriv->lock);
 
        list_del_init(&psta->hash_list);
-       RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, ("\n free number_%d stainfo  with hwaddr=0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x\n", pstapriv->asoc_sta_count , psta->hwaddr[0], psta->hwaddr[1], psta->hwaddr[2], psta->hwaddr[3], psta->hwaddr[4], psta->hwaddr[5]));
+       RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_,
+                ("\n free number_%d stainfo with hwaddr=0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x\n",
+                pstapriv->asoc_sta_count, psta->hwaddr[0], psta->hwaddr[1],
+                psta->hwaddr[2], psta->hwaddr[3], psta->hwaddr[4],
+                psta->hwaddr[5]));
        pstapriv->asoc_sta_count--;
 
        /*  re-init sta_info; 20061114 */
@@ -442,12 +417,12 @@ void rtw_free_all_stainfo(struct adapter *padapter)
                plist = phead->next;
 
                while (phead != plist) {
-                       psta = container_of(plist, struct sta_info , hash_list);
+                       psta = container_of(plist, struct sta_info, hash_list);
 
                        plist = plist->next;
 
                        if (pbcmc_stainfo != psta)
-                               rtw_free_stainfo(padapter , psta);
+                               rtw_free_stainfo(padapter, psta);
                }
        }
        spin_unlock_bh(&pstapriv->sta_hash_lock);
@@ -463,7 +438,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
        u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
 
 
-       if (hwaddr == NULL)
+       if (!hwaddr)
                return NULL;
 
        if (IS_MCAST(hwaddr))
@@ -503,7 +478,7 @@ u32 rtw_init_bcmc_stainfo(struct adapter *padapter)
 
        psta = rtw_alloc_stainfo(pstapriv, bcast_addr);
 
-       if (psta == NULL) {
+       if (!psta) {
                res = _FAIL;
                RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, ("rtw_alloc_stainfo fail"));
                goto exit;