diff options
Diffstat (limited to 'drivers/staging/rtl8723bs/core/rtw_sta_mgt.c')
-rw-r--r-- | drivers/staging/rtl8723bs/core/rtw_sta_mgt.c | 75 |
1 files changed, 27 insertions, 48 deletions
diff --git a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c index e3f56c6cc882..f96dd0b40e04 100644 --- a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c @@ -133,7 +133,7 @@ void kfree_all_stainfo(struct sta_priv *pstapriv) plist = get_next(phead); while (phead != plist) { - psta = LIST_CONTAINOR(plist, struct sta_info, list); + psta = container_of(plist, struct sta_info, list); plist = get_next(plist); } @@ -154,7 +154,6 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) int index; if (pstapriv) { - /*delete all reordering_ctrl_timer */ spin_lock_bh(&pstapriv->sta_hash_lock); for (index = 0; index < NUM_STA; index++) { @@ -163,7 +162,8 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) while (phead != plist) { int i; - psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); + + psta = container_of(plist, struct sta_info, hash_list); plist = get_next(plist); for (i = 0; i < 16 ; i++) { @@ -177,9 +177,7 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) kfree_sta_priv_lock(pstapriv); - if (pstapriv->pallocated_stainfo_buf) - vfree(pstapriv->pallocated_stainfo_buf); - + vfree(pstapriv->pallocated_stainfo_buf); } return _SUCCESS; } @@ -204,7 +202,7 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) spin_unlock_bh(&(pstapriv->sta_hash_lock)); return NULL; } else { - psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list); + psta = container_of(get_next(&pfree_sta_queue->queue), struct sta_info, list); list_del_init(&(psta->list)); @@ -241,22 +239,18 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) /* In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable. */ /* So, we initialize the tid_rxseq variable as the 0xffff. */ - for (i = 0; i < 16; i++) { + for (i = 0; i < 16; i++) memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i], &wRxSeqInitialValue, 2); - } - RT_TRACE( - _module_rtl871x_sta_mgt_c_, - _drv_info_, ( - "alloc number_%d stainfo with hwaddr = %x %x %x %x %x %x \n", - pstapriv->asoc_sta_count, - hwaddr[0], - hwaddr[1], - hwaddr[2], - hwaddr[3], - hwaddr[4], - hwaddr[5] - ) + RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_, + ("alloc number_%d stainfo with hwaddr = %x %x %x %x %x %x \n", + pstapriv->asoc_sta_count, + hwaddr[0], + hwaddr[1], + hwaddr[2], + hwaddr[3], + hwaddr[4], + hwaddr[5]) ); init_addba_retry_timer(pstapriv->padapter, psta); @@ -283,7 +277,6 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) rtw_init_recv_timer(preorder_ctrl); } - /* init for DM */ psta->rssi_stat.UndecoratedSmoothedPWDB = (-1); psta->rssi_stat.UndecoratedSmoothedCCK = (-1); @@ -293,12 +286,10 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) spin_unlock_bh(&(pstapriv->sta_hash_lock)); /* alloc mac id for non-bc/mc station, */ rtw_alloc_macid(pstapriv->padapter, psta); - } exit: - return psta; } @@ -316,14 +307,12 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta) if (!psta) goto exit; - spin_lock_bh(&psta->lock); psta->state &= ~_FW_LINKED; spin_unlock_bh(&psta->lock); pfree_sta_queue = &pstapriv->free_sta_queue; - pstaxmitpriv = &psta->sta_xmitpriv; /* list_del_init(&psta->sleep_list); */ @@ -374,18 +363,15 @@ 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--; @@ -406,7 +392,6 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta) del_timer_sync(&preorder_ctrl->reordering_ctrl_timer); - ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; spin_lock_bh(&ppending_recvframe_queue->lock); @@ -425,7 +410,6 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta) } spin_unlock_bh(&ppending_recvframe_queue->lock); - } if (!(psta->state & WIFI_AP_STATE)) @@ -495,13 +479,12 @@ void rtw_free_all_stainfo(struct adapter *padapter) plist = get_next(phead); while (phead != plist) { - psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); + psta = container_of(plist, struct sta_info, hash_list); plist = get_next(plist); if (pbcmc_stainfo != psta) rtw_free_stainfo(padapter, psta); - } } @@ -532,10 +515,8 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) phead = &(pstapriv->sta_hash[index]); plist = get_next(phead); - while (phead != plist) { - - psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); + psta = container_of(plist, struct sta_info, hash_list); if ((!memcmp(psta->hwaddr, addr, ETH_ALEN))) /* if found the matched address */ @@ -551,7 +532,6 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) u32 rtw_init_bcmc_stainfo(struct adapter *padapter) { - struct sta_info *psta; u32 res = _SUCCESS; NDIS_802_11_MAC_ADDRESS bcast_addr = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; @@ -596,7 +576,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) phead = get_list_head(pacl_node_q); plist = get_next(phead); while (phead != plist) { - paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list); + paclnode = container_of(plist, struct rtw_wlan_acl_node, list); plist = get_next(plist); if (!memcmp(paclnode->addr, mac_addr, ETH_ALEN)) @@ -604,7 +584,6 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) match = true; break; } - } spin_unlock_bh(&(pacl_node_q->lock)); |