Use list_for_each_entry*() instead of list_for_each*() to simplify
the code. Fix coding style by the way.
Signed-off-by: Geliang Tang <[email protected]>
---
drivers/staging/rtl8723au/core/rtw_ap.c | 166 ++++++++--------------
drivers/staging/rtl8723au/core/rtw_mlme.c | 38 ++---
drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 13 +-
drivers/staging/rtl8723au/core/rtw_recv.c | 43 ++----
drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 34 ++---
drivers/staging/rtl8723au/core/rtw_xmit.c | 84 ++++-------
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 22 +--
drivers/staging/rtl8723au/os_dep/usb_ops_linux.c | 9 +-
8 files changed, 140 insertions(+), 269 deletions(-)
diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c
index 1aa9b26..66315f9 100644
--- a/drivers/staging/rtl8723au/core/rtw_ap.c
+++ b/drivers/staging/rtl8723au/core/rtw_ap.c
@@ -171,24 +171,20 @@ static u8 chk_sta_is_alive(struct sta_info *psta)
return ret;
}
-void expire_timeout_chk23a(struct rtw_adapter *padapter)
+void expire_timeout_chk23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
u8 updated = 0;
- struct sta_info *psta;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
u8 chk_alive_num = 0;
struct sta_info *chk_alive_list[NUM_STA];
int i;
spin_lock_bh(&pstapriv->auth_list_lock);
-
phead = &pstapriv->auth_list;
-
/* check auth_queue */
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, auth_list);
-
+ list_for_each_entry_safe(psta, ptmp, phead, auth_list) {
if (psta->expire_to > 0) {
psta->expire_to--;
if (psta->expire_to == 0) {
@@ -206,19 +202,13 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
spin_lock_bh(&pstapriv->auth_list_lock);
}
}
-
}
-
spin_unlock_bh(&pstapriv->auth_list_lock);
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
/* check asoc_queue */
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
-
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
if (chk_sta_is_alive(psta) || !psta->expire_to) {
psta->expire_to = pstapriv->expire_to;
psta->keep_alive_trycnt = 0;
@@ -283,7 +273,6 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
}
}
}
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
if (chk_alive_num) {
@@ -299,51 +288,55 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
SelectChannel23a(padapter, pmlmeext->cur_channel);
}
- /* issue null data to check sta alive */
- for (i = 0; i < chk_alive_num; i++) {
+ /* issue null data to check sta alive */
+ for (i = 0; i < chk_alive_num; i++) {
- int ret = _FAIL;
+ int ret = _FAIL;
- psta = chk_alive_list[i];
- if (!(psta->state & _FW_LINKED))
- continue;
+ psta = chk_alive_list[i];
+ if (!(psta->state & _FW_LINKED))
+ continue;
- if (psta->state & WIFI_SLEEP_STATE)
- ret = issue_nulldata23a(padapter, psta->hwaddr, 0, 1, 50);
- else
- ret = issue_nulldata23a(padapter, psta->hwaddr, 0, 3, 50);
+ if (psta->state & WIFI_SLEEP_STATE)
+ ret = issue_nulldata23a(padapter, psta->hwaddr,
+ 0, 1, 50);
+ else
+ ret = issue_nulldata23a(padapter, psta->hwaddr,
+ 0, 3, 50);
+
+ psta->keep_alive_trycnt++;
+ if (ret == _SUCCESS) {
+ DBG_8723A("asoc check, sta(%pM) is alive\n",
+ psta->hwaddr);
+ psta->expire_to = pstapriv->expire_to;
+ psta->keep_alive_trycnt = 0;
+ continue;
+ } else if (psta->keep_alive_trycnt <= 3) {
+ DBG_8723A("ack check for asoc expire, keep_alive_trycnt = %d\n",
+ psta->keep_alive_trycnt);
+ psta->expire_to = 1;
+ continue;
+ }
- psta->keep_alive_trycnt++;
- if (ret == _SUCCESS) {
- DBG_8723A("asoc check, sta(%pM) is alive\n",
- psta->hwaddr);
- psta->expire_to = pstapriv->expire_to;
psta->keep_alive_trycnt = 0;
- continue;
- } else if (psta->keep_alive_trycnt <= 3) {
- DBG_8723A("ack check for asoc expire, keep_alive_trycnt =%d\n", psta->keep_alive_trycnt);
- psta->expire_to = 1;
- continue;
- }
- psta->keep_alive_trycnt = 0;
-
- DBG_8723A("asoc expire %pM, state = 0x%x\n",
- psta->hwaddr, psta->state);
- spin_lock_bh(&pstapriv->asoc_list_lock);
- if (!list_empty(&psta->asoc_list)) {
- list_del_init(&psta->asoc_list);
- pstapriv->asoc_list_cnt--;
- updated = ap_free_sta23a(padapter, psta, false, WLAN_REASON_DEAUTH_LEAVING);
+ DBG_8723A("asoc expire %pM, state = 0x%x\n",
+ psta->hwaddr, psta->state);
+ spin_lock_bh(&pstapriv->asoc_list_lock);
+ if (!list_empty(&psta->asoc_list)) {
+ list_del_init(&psta->asoc_list);
+ pstapriv->asoc_list_cnt--;
+ updated = ap_free_sta23a(padapter, psta, false,
+ WLAN_REASON_DEAUTH_LEAVING);
+ }
+ spin_unlock_bh(&pstapriv->asoc_list_lock);
}
- spin_unlock_bh(&pstapriv->asoc_list_lock);
+ /* back to original operation channel */
+ if (backup_oper_channel > 0)
+ SelectChannel23a(padapter, backup_oper_channel);
}
- if (backup_oper_channel > 0) /* back to original operation channel */
- SelectChannel23a(padapter, backup_oper_channel);
-}
-
associated_clients_update23a(padapter, updated);
}
@@ -1059,7 +1052,7 @@ void rtw_set_macaddr_acl23a(struct rtw_adapter *padapter, int mode)
int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
{
- struct list_head *plist, *phead;
+ struct list_head *phead;
u8 added = false;
int i, ret = 0;
struct rtw_wlan_acl_node *paclnode;
@@ -1073,12 +1066,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
return -1;
spin_lock_bh(&pacl_node_q->lock);
-
phead = get_list_head(pacl_node_q);
-
- list_for_each(plist, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
-
+ list_for_each_entry(paclnode, phead, list) {
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid == true) {
added = true;
@@ -1087,7 +1076,6 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
}
}
}
-
spin_unlock_bh(&pacl_node_q->lock);
if (added)
@@ -1121,8 +1109,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
{
- struct list_head *plist, *phead, *ptmp;
- struct rtw_wlan_acl_node *paclnode;
+ struct list_head *phead;
+ struct rtw_wlan_acl_node *paclnode, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
struct rtw_queue *pacl_node_q = &pacl_list->acl_node_q;
@@ -1130,12 +1118,8 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
DBG_8723A("%s(acl_num =%d) = %pM\n", __func__, pacl_list->num, addr);
spin_lock_bh(&pacl_node_q->lock);
-
phead = get_list_head(pacl_node_q);
-
- list_for_each_safe(plist, ptmp, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
-
+ list_for_each_entry_safe(paclnode, ptmp, phead, list) {
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid) {
paclnode->valid = false;
@@ -1146,7 +1130,6 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
}
}
}
-
spin_unlock_bh(&pacl_node_q->lock);
DBG_8723A("%s, acl_num =%d\n", __func__, pacl_list->num);
@@ -1354,20 +1337,14 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated)
{
/* update associated stations cap. */
if (updated == true) {
- struct list_head *phead, *plist, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
-
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
VCS_update23a(padapter, psta);
- }
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
}
}
@@ -1627,7 +1604,7 @@ u8 ap_free_sta23a(struct rtw_adapter *padapter, struct sta_info *psta, bool acti
int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_offset)
{
- struct list_head *phead, *plist;
+ struct list_head *phead;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@@ -1642,10 +1619,7 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
-
- list_for_each(plist, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
-
+ list_for_each_entry(psta, phead, asoc_list) {
issue_action_spct_ch_switch23a(padapter, psta->hwaddr, new_ch, ch_offset);
psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2);
}
@@ -1658,8 +1632,8 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of
int rtw_sta_flush23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
@@ -1675,10 +1649,7 @@ int rtw_sta_flush23a(struct rtw_adapter *padapter)
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
-
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
-
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
/* Remove sta from asoc_list */
list_del_init(&psta->asoc_list);
pstapriv->asoc_list_cnt--;
@@ -1744,9 +1715,9 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
struct mlme_priv *mlmepriv = &padapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct sta_priv *pstapriv = &padapter->stapriv;
- struct sta_info *psta;
+ struct sta_info *psta, *ptmp;
struct security_priv *psecuritypriv = &padapter->securitypriv;
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
u8 chk_alive_num = 0;
struct sta_info *chk_alive_list[NUM_STA];
int i;
@@ -1775,15 +1746,9 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
}
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
-
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
chk_alive_list[chk_alive_num++] = psta;
- }
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
for (i = 0; i < chk_alive_num; i++) {
@@ -1841,8 +1806,8 @@ void start_ap_mode23a(struct rtw_adapter *padapter)
void stop_ap_mode23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
- struct rtw_wlan_acl_node *paclnode;
+ struct list_head *phead;
+ struct rtw_wlan_acl_node *paclnode, *ptmp;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -1864,15 +1829,10 @@ void stop_ap_mode23a(struct rtw_adapter *padapter)
/* for ACL */
spin_lock_bh(&pacl_node_q->lock);
phead = get_list_head(pacl_node_q);
-
- list_for_each_safe(plist, ptmp, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
-
+ list_for_each_entry_safe(paclnode, ptmp, phead, list) {
if (paclnode->valid == true) {
paclnode->valid = false;
-
list_del_init(&paclnode->list);
-
pacl_list->num--;
}
}
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 3c09ea9..3adda55 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -171,21 +171,15 @@ exit:
void rtw_free_network_queue23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
- struct wlan_network *pnetwork;
+ struct list_head *phead;
+ struct wlan_network *pnetwork, *ptmp;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct rtw_queue *scanned_queue = &pmlmepriv->scanned_queue;
spin_lock_bh(&scanned_queue->lock);
-
phead = get_list_head(scanned_queue);
-
- list_for_each_safe(plist, ptmp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
-
+ list_for_each_entry_safe(pnetwork, ptmp, phead, list)
_rtw_free_network23a(pmlmepriv, pnetwork);
- }
-
spin_unlock_bh(&scanned_queue->lock);
}
@@ -329,15 +323,12 @@ int is_same_network23a(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst)
struct wlan_network *
rtw_get_oldest_wlan_network23a(struct rtw_queue *scanned_queue)
{
- struct list_head *plist, *phead;
+ struct list_head *phead;
struct wlan_network *pwlan;
struct wlan_network *oldest = NULL;
phead = get_list_head(scanned_queue);
-
- list_for_each(plist, phead) {
- pwlan = container_of(plist, struct wlan_network, list);
-
+ list_for_each_entry(pwlan, phead, list) {
if (pwlan->fixed != true) {
if (!oldest || time_after(oldest->last_scanned,
pwlan->last_scanned))
@@ -445,7 +436,6 @@ static void rtw_update_scanned_network(struct rtw_adapter *adapter,
spin_lock_bh(&queue->lock);
phead = get_list_head(queue);
-
list_for_each(plist, phead) {
pnetwork = container_of(plist, struct wlan_network, list);
@@ -710,21 +700,17 @@ rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf)
static void free_scanqueue(struct mlme_priv *pmlmepriv)
{
- struct wlan_network *pnetwork;
+ struct wlan_network *pnetwork, *ptemp;
struct rtw_queue *scan_queue = &pmlmepriv->scanned_queue;
- struct list_head *plist, *phead, *ptemp;
+ struct list_head *phead;
RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, "+free_scanqueue\n");
spin_lock_bh(&scan_queue->lock);
-
phead = get_list_head(scan_queue);
-
- list_for_each_safe(plist, ptemp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
+ list_for_each_entry_safe(pnetwork, ptemp, phead, list) {
pnetwork->fixed = false;
_rtw_free_network23a(pmlmepriv, pnetwork);
}
-
spin_unlock_bh(&scan_queue->lock);
}
@@ -1625,15 +1611,13 @@ exit:
static struct wlan_network *
rtw_select_candidate_from_queue(struct mlme_priv *pmlmepriv)
{
- struct wlan_network *pnetwork, *candidate = NULL;
+ struct wlan_network *pnetwork, *ptmp, *candidate = NULL;
struct rtw_queue *queue = &pmlmepriv->scanned_queue;
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
phead = get_list_head(queue);
-
- list_for_each_safe(plist, ptmp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
+ list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
if (!pnetwork) {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
"%s: return _FAIL:(pnetwork == NULL)\n",
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index d28f29a..cc99a96 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -6082,8 +6082,8 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
#ifdef CONFIG_8723AU_AP_MODE
else { /* tx bc/mc frames after update TIM */
struct sta_info *psta_bmc;
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe, *tmp;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct sta_priv *pstapriv = &padapter->stapriv;
@@ -6096,14 +6096,8 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
msleep(10);/* 10ms, ATIM(HIQ) Windows */
/* spin_lock_bh(&psta_bmc->sleep_q.lock); */
spin_lock_bh(&pxmitpriv->lock);
-
phead = get_list_head(&psta_bmc->sleep_q);
-
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist,
- struct xmit_frame,
- list);
-
+ list_for_each_entry_safe(pxmitframe, tmp, phead, list) {
list_del_init(&pxmitframe->list);
psta_bmc->sleepq_len--;
@@ -6119,7 +6113,6 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
rtl8723au_hal_xmitframe_enqueue(padapter,
pxmitframe);
}
-
/* spin_unlock_bh(&psta_bmc->sleep_q.lock); */
spin_unlock_bh(&pxmitpriv->lock);
}
diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
index 404b618..de1226e 100644
--- a/drivers/staging/rtl8723au/core/rtw_recv.c
+++ b/drivers/staging/rtl8723au/core/rtw_recv.c
@@ -85,16 +85,16 @@ int _rtw_init_recv_priv23a(struct recv_priv *precvpriv,
return res;
}
-void _rtw_free_recv_priv23a (struct recv_priv *precvpriv)
+void _rtw_free_recv_priv23a(struct recv_priv *precvpriv)
{
struct rtw_adapter *padapter = precvpriv->adapter;
- struct recv_frame *precvframe;
- struct list_head *plist, *ptmp;
+ struct recv_frame *precvframe, *ptmp;
rtw_free_uc_swdec_pending_queue23a(padapter);
- list_for_each_safe(plist, ptmp, &precvpriv->free_recv_queue.queue) {
- precvframe = container_of(plist, struct recv_frame, list);
+ list_for_each_entry_safe(precvframe, ptmp,
+ &precvpriv->free_recv_queue.queue,
+ list) {
list_del_init(&precvframe->list);
kfree(precvframe);
}
@@ -195,19 +195,13 @@ using spinlock to protect
static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue)
{
- struct recv_frame *hdr;
- struct list_head *plist, *phead, *ptmp;
+ struct recv_frame *hdr, *ptmp;
+ struct list_head *phead;
spin_lock(&pframequeue->lock);
-
phead = get_list_head(pframequeue);
- plist = phead->next;
-
- list_for_each_safe(plist, ptmp, phead) {
- hdr = container_of(plist, struct recv_frame, list);
+ list_for_each_entry_safe(hdr, ptmp, phead, list)
rtw_free_recvframe23a(hdr);
- }
-
spin_unlock(&pframequeue->lock);
}
@@ -1567,16 +1561,14 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
struct rtw_queue *defrag_q)
{
- struct list_head *plist, *phead, *ptmp;
- u8 *data, wlanhdr_offset;
- u8 curfragnum;
- struct recv_frame *pnfhdr;
+ struct list_head *plist, *phead;
+ u8 wlanhdr_offset;
+ u8 curfragnum;
+ struct recv_frame *pnfhdr, *ptmp;
struct recv_frame *prframe, *pnextrframe;
- struct rtw_queue *pfree_recv_queue;
+ struct rtw_queue *pfree_recv_queue;
struct sk_buff *skb;
-
-
curfragnum = 0;
pfree_recv_queue = &adapter->recvpriv.free_recv_queue;
@@ -1597,12 +1589,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
curfragnum++;
- phead = get_list_head(defrag_q);
-
- data = prframe->pkt->data;
-
- list_for_each_safe(plist, ptmp, phead) {
- pnfhdr = container_of(plist, struct recv_frame, list);
+ list_for_each_entry_safe(pnfhdr, ptmp, phead, list) {
pnextrframe = (struct recv_frame *)pnfhdr;
/* check the fragment sequence (2nd ~n fragment frame) */
@@ -1644,8 +1631,6 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_,
"Performance defrag!!!!!\n");
-
-
return prframe;
}
diff --git a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
index b06bff7..f1200e3 100644
--- a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
@@ -83,8 +83,8 @@ int _rtw_init_sta_priv23a(struct sta_priv *pstapriv)
int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
{
- struct list_head *phead, *plist, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct recv_reorder_ctrl *preorder_ctrl;
int index;
@@ -93,12 +93,9 @@ int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
spin_lock_bh(&pstapriv->sta_hash_lock);
for (index = 0; index < NUM_STA; index++) {
phead = &pstapriv->sta_hash[index];
-
- list_for_each_safe(plist, ptmp, phead) {
+ list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
int i;
- psta = container_of(plist, struct sta_info,
- hash_list);
for (i = 0; i < 16 ; i++) {
preorder_ctrl = &psta->recvreorder_ctrl[i];
del_timer_sync(&preorder_ctrl->reordering_ctrl_timer);
@@ -325,8 +322,8 @@ exit:
/* free all stainfo which in sta_hash[all] */
void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
{
- struct list_head *plist, *phead, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct sta_info *pbcmc_stainfo = rtw_get_bcmc_stainfo23a(padapter);
s32 index;
@@ -335,13 +332,9 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
return;
spin_lock_bh(&pstapriv->sta_hash_lock);
-
for (index = 0; index < NUM_STA; index++) {
phead = &pstapriv->sta_hash[index];
-
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, hash_list);
-
+ list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
if (pbcmc_stainfo != psta)
rtw_free_stainfo23a(padapter, psta);
}
@@ -352,7 +345,7 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
/* any station allocated can be searched by hash list */
struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
{
- struct list_head *plist, *phead;
+ struct list_head *phead;
struct sta_info *psta = NULL;
u32 index;
const u8 *addr;
@@ -368,12 +361,8 @@ struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
index = wifi_mac_hash(addr);
spin_lock_bh(&pstapriv->sta_hash_lock);
-
phead = &pstapriv->sta_hash[index];
-
- list_for_each(plist, phead) {
- psta = container_of(plist, struct sta_info, hash_list);
-
+ list_for_each_entry(psta, phead, hash_list) {
/* if found the matched address */
if (ether_addr_equal(psta->hwaddr, addr))
break;
@@ -418,7 +407,7 @@ bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
{
bool res = true;
#ifdef CONFIG_8723AU_AP_MODE
- struct list_head *plist, *phead;
+ struct list_head *phead;
struct rtw_wlan_acl_node *paclnode;
bool match = false;
struct sta_priv *pstapriv = &padapter->stapriv;
@@ -427,10 +416,7 @@ bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
spin_lock_bh(&pacl_node_q->lock);
phead = get_list_head(pacl_node_q);
-
- list_for_each(plist, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
-
+ list_for_each_entry(paclnode, phead, list) {
if (ether_addr_equal(paclnode->addr, mac_addr)) {
if (paclnode->valid) {
match = true;
diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c
index a4b6bb6..fc55120 100644
--- a/drivers/staging/rtl8723au/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723au/core/rtw_xmit.c
@@ -193,39 +193,38 @@ fail:
goto exit;
}
-void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv)
+void _rtw_free_xmit_priv23a(struct xmit_priv *pxmitpriv)
{
struct rtw_adapter *padapter = pxmitpriv->adapter;
- struct xmit_frame *pxframe;
- struct xmit_buf *pxmitbuf;
- struct list_head *plist, *ptmp;
+ struct xmit_frame *pxframe, *ptmp;
+ struct xmit_buf *pxmitbuf, *ptmp2;
- list_for_each_safe(plist, ptmp, &pxmitpriv->free_xmit_queue.queue) {
- pxframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxframe, ptmp,
+ &pxmitpriv->free_xmit_queue.queue, list) {
list_del_init(&pxframe->list);
rtw_os_xmit_complete23a(padapter, pxframe);
kfree(pxframe);
}
- list_for_each_safe(plist, ptmp, &pxmitpriv->xmitbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry_safe(pxmitbuf, ptmp2,
+ &pxmitpriv->xmitbuf_list, list2) {
list_del_init(&pxmitbuf->list2);
rtw_os_xmit_resource_free23a(padapter, pxmitbuf);
kfree(pxmitbuf);
}
/* free xframe_ext queue, the same count as extbuf */
- list_for_each_safe(plist, ptmp,
- &pxmitpriv->free_xframe_ext_queue.queue) {
- pxframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxframe, ptmp,
+ &pxmitpriv->free_xframe_ext_queue.queue,
+ list) {
list_del_init(&pxframe->list);
rtw_os_xmit_complete23a(padapter, pxframe);
kfree(pxframe);
}
/* free xmit extension buff */
- list_for_each_safe(plist, ptmp, &pxmitpriv->xmitextbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry_safe(pxmitbuf, ptmp2,
+ &pxmitpriv->xmitextbuf_list, list2) {
list_del_init(&pxmitbuf->list2);
rtw_os_xmit_resource_free23a(padapter, pxmitbuf);
kfree(pxmitbuf);
@@ -1563,18 +1562,13 @@ exit:
void rtw_free_xmitframe_queue23a(struct xmit_priv *pxmitpriv,
struct rtw_queue *pframequeue)
{
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe, *ptmp;
spin_lock_bh(&pframequeue->lock);
-
phead = get_list_head(pframequeue);
-
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
-
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list)
rtw_free_xmitframe23a(pxmitpriv, pxmitframe);
- }
spin_unlock_bh(&pframequeue->lock);
}
@@ -1612,9 +1606,9 @@ struct xmit_frame *
rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i,
int entry)
{
- struct list_head *sta_plist, *sta_phead, *ptmp;
+ struct list_head *sta_phead;
struct hw_xmit *phwxmit;
- struct tx_servq *ptxservq = NULL;
+ struct tx_servq *ptxservq = NULL, *ptmp;
struct rtw_queue *pframe_queue = NULL;
struct xmit_frame *pxmitframe = NULL;
struct rtw_adapter *padapter = pxmitpriv->adapter;
@@ -1638,11 +1632,8 @@ rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i,
phwxmit = phwxmit_i + inx[i];
sta_phead = get_list_head(phwxmit->sta_queue);
-
- list_for_each_safe(sta_plist, ptmp, sta_phead) {
- ptxservq = container_of(sta_plist, struct tx_servq,
- tx_pending);
-
+ list_for_each_entry_safe(ptxservq, ptmp, sta_phead,
+ tx_pending) {
pframe_queue = &ptxservq->sta_pending;
pxmitframe = dequeue_one_xmitframe(pxmitpriv, phwxmit, ptxservq, pframe_queue);
@@ -2052,18 +2043,15 @@ dequeue_xmitframes_to_sleeping_queue(struct rtw_adapter *padapter,
struct rtw_queue *pframequeue)
{
int ret;
- struct list_head *plist, *phead, *ptmp;
+ struct list_head *phead;
u8 ac_index;
struct tx_servq *ptxservq;
struct pkt_attrib *pattrib;
- struct xmit_frame *pxmitframe;
+ struct xmit_frame *pxmitframe, *ptmp;
struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
phead = get_list_head(pframequeue);
-
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
-
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
ret = xmitframe_enqueue_for_sleeping_sta23a(padapter, pxmitframe);
if (ret == true) {
@@ -2124,17 +2112,14 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
{
u8 update_mask = 0, wmmps_ac = 0;
struct sta_info *psta_bmc;
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe = NULL;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe = NULL, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
spin_lock_bh(&pxmitpriv->lock);
-
phead = get_list_head(&psta->sleep_q);
-
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
list_del_init(&pxmitframe->list);
switch (pxmitframe->attrib.priority) {
@@ -2194,7 +2179,6 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
pstapriv->sta_dz_bitmap &= ~CHKBIT(psta->aid);
}
-
/* spin_unlock_bh(&psta->sleep_q.lock); */
spin_unlock_bh(&pxmitpriv->lock);
@@ -2206,13 +2190,8 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
if ((pstapriv->sta_dz_bitmap&0xfffe) == 0x0) {
/* no any sta in ps mode */
spin_lock_bh(&pxmitpriv->lock);
-
phead = get_list_head(&psta_bmc->sleep_q);
-
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame,
- list);
-
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
list_del_init(&pxmitframe->list);
psta_bmc->sleepq_len--;
@@ -2232,7 +2211,6 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
/* update_BCNTIM(padapter); */
update_mask |= BIT(1);
}
-
/* spin_unlock_bh(&psta_bmc->sleep_q.lock); */
spin_unlock_bh(&pxmitpriv->lock);
}
@@ -2245,19 +2223,15 @@ void xmit_delivery_enabled_frames23a(struct rtw_adapter *padapter,
struct sta_info *psta)
{
u8 wmmps_ac = 0;
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
/* spin_lock_bh(&psta->sleep_q.lock); */
spin_lock_bh(&pxmitpriv->lock);
-
phead = get_list_head(&psta->sleep_q);
-
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
-
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
switch (pxmitframe->attrib.priority) {
case 1:
case 2:
diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 0ae2180..908b84c 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -1270,18 +1270,14 @@ void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv,
void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
{
- struct list_head *plist, *phead, *ptmp;
+ struct list_head *phead;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct rtw_queue *queue = &pmlmepriv->scanned_queue;
- struct wlan_network *pnetwork;
+ struct wlan_network *pnetwork, *ptmp;
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
-
phead = get_list_head(queue);
-
- list_for_each_safe(plist, ptmp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
-
+ list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
/* report network only if the current channel set
contains the channel to which this network belongs */
if (rtw_ch_set_search_ch23a
@@ -1289,7 +1285,6 @@ void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
pnetwork->network.DSConfig) >= 0)
rtw_cfg80211_inform_bss(padapter, pnetwork);
}
-
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
/* call this after other things have been done */
@@ -2850,9 +2845,9 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
{
const u8 *mac = params->mac;
int ret = 0;
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
u8 updated = 0;
- struct sta_info *psta;
+ struct sta_info *psta, *ptmp;
struct rtw_adapter *padapter = netdev_priv(ndev);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct sta_priv *pstapriv = &padapter->stapriv;
@@ -2881,13 +2876,9 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
return -EINVAL;
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
/* check asoc_queue */
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
-
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
if (ether_addr_equal(mac, psta->hwaddr)) {
if (psta->dot8021xalg == 1 &&
psta->bpairwise_key_installed == false) {
@@ -2912,7 +2903,6 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
}
}
}
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
associated_clients_update23a(padapter, updated);
diff --git a/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c b/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
index 0cdaef0..cf4a506 100644
--- a/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
@@ -210,22 +210,21 @@ exit:
void rtl8723au_write_port_cancel(struct rtw_adapter *padapter)
{
struct xmit_buf *pxmitbuf;
- struct list_head *plist;
int j;
DBG_8723A("%s\n", __func__);
padapter->bWritePortCancel = true;
- list_for_each(plist, &padapter->xmitpriv.xmitbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry(pxmitbuf, &padapter->xmitpriv.xmitbuf_list,
+ list2) {
for (j = 0; j < 8; j++) {
if (pxmitbuf->pxmit_urb[j])
usb_kill_urb(pxmitbuf->pxmit_urb[j]);
}
}
- list_for_each(plist, &padapter->xmitpriv.xmitextbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry(pxmitbuf, &padapter->xmitpriv.xmitextbuf_list,
+ list2) {
for (j = 0; j < 8; j++) {
if (pxmitbuf->pxmit_urb[j])
usb_kill_urb(pxmitbuf->pxmit_urb[j]);
--
2.5.0
Geliang Tang <[email protected]> writes:
> Use list_for_each_entry*() instead of list_for_each*() to simplify
> the code. Fix coding style by the way.
>
> Signed-off-by: Geliang Tang <[email protected]>
> ---
> drivers/staging/rtl8723au/core/rtw_ap.c | 166 ++++++++--------------
> drivers/staging/rtl8723au/core/rtw_mlme.c | 38 ++---
> drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 13 +-
> drivers/staging/rtl8723au/core/rtw_recv.c | 43 ++----
> drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 34 ++---
> drivers/staging/rtl8723au/core/rtw_xmit.c | 84 ++++-------
> drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 22 +--
> drivers/staging/rtl8723au/os_dep/usb_ops_linux.c | 9 +-
> 8 files changed, 140 insertions(+), 269 deletions(-)
In principle this is fine, but you need to stick to doing one thing per
patch. Do the list_for_each_entry() in one patch, and the formatting
issues in another.
Jes
> diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c
> index 1aa9b26..66315f9 100644
> --- a/drivers/staging/rtl8723au/core/rtw_ap.c
> +++ b/drivers/staging/rtl8723au/core/rtw_ap.c
> @@ -171,24 +171,20 @@ static u8 chk_sta_is_alive(struct sta_info *psta)
> return ret;
> }
>
> -void expire_timeout_chk23a(struct rtw_adapter *padapter)
> +void expire_timeout_chk23a(struct rtw_adapter *padapter)
> {
> - struct list_head *phead, *plist, *ptmp;
> + struct list_head *phead;
> u8 updated = 0;
> - struct sta_info *psta;
> + struct sta_info *psta, *ptmp;
> struct sta_priv *pstapriv = &padapter->stapriv;
> u8 chk_alive_num = 0;
> struct sta_info *chk_alive_list[NUM_STA];
> int i;
>
> spin_lock_bh(&pstapriv->auth_list_lock);
> -
> phead = &pstapriv->auth_list;
> -
> /* check auth_queue */
> - list_for_each_safe(plist, ptmp, phead) {
> - psta = container_of(plist, struct sta_info, auth_list);
> -
> + list_for_each_entry_safe(psta, ptmp, phead, auth_list) {
> if (psta->expire_to > 0) {
> psta->expire_to--;
> if (psta->expire_to == 0) {
> @@ -206,19 +202,13 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
> spin_lock_bh(&pstapriv->auth_list_lock);
> }
> }
> -
> }
> -
> spin_unlock_bh(&pstapriv->auth_list_lock);
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> -
> phead = &pstapriv->asoc_list;
> -
> /* check asoc_queue */
> - list_for_each_safe(plist, ptmp, phead) {
> - psta = container_of(plist, struct sta_info, asoc_list);
> -
> + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
> if (chk_sta_is_alive(psta) || !psta->expire_to) {
> psta->expire_to = pstapriv->expire_to;
> psta->keep_alive_trycnt = 0;
> @@ -283,7 +273,6 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
> }
> }
> }
> -
> spin_unlock_bh(&pstapriv->asoc_list_lock);
>
> if (chk_alive_num) {
> @@ -299,51 +288,55 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
> SelectChannel23a(padapter, pmlmeext->cur_channel);
> }
>
> - /* issue null data to check sta alive */
> - for (i = 0; i < chk_alive_num; i++) {
> + /* issue null data to check sta alive */
> + for (i = 0; i < chk_alive_num; i++) {
>
> - int ret = _FAIL;
> + int ret = _FAIL;
>
> - psta = chk_alive_list[i];
> - if (!(psta->state & _FW_LINKED))
> - continue;
> + psta = chk_alive_list[i];
> + if (!(psta->state & _FW_LINKED))
> + continue;
>
> - if (psta->state & WIFI_SLEEP_STATE)
> - ret = issue_nulldata23a(padapter, psta->hwaddr, 0, 1, 50);
> - else
> - ret = issue_nulldata23a(padapter, psta->hwaddr, 0, 3, 50);
> + if (psta->state & WIFI_SLEEP_STATE)
> + ret = issue_nulldata23a(padapter, psta->hwaddr,
> + 0, 1, 50);
> + else
> + ret = issue_nulldata23a(padapter, psta->hwaddr,
> + 0, 3, 50);
> +
> + psta->keep_alive_trycnt++;
> + if (ret == _SUCCESS) {
> + DBG_8723A("asoc check, sta(%pM) is alive\n",
> + psta->hwaddr);
> + psta->expire_to = pstapriv->expire_to;
> + psta->keep_alive_trycnt = 0;
> + continue;
> + } else if (psta->keep_alive_trycnt <= 3) {
> + DBG_8723A("ack check for asoc expire, keep_alive_trycnt = %d\n",
> + psta->keep_alive_trycnt);
> + psta->expire_to = 1;
> + continue;
> + }
>
> - psta->keep_alive_trycnt++;
> - if (ret == _SUCCESS) {
> - DBG_8723A("asoc check, sta(%pM) is alive\n",
> - psta->hwaddr);
> - psta->expire_to = pstapriv->expire_to;
> psta->keep_alive_trycnt = 0;
> - continue;
> - } else if (psta->keep_alive_trycnt <= 3) {
> - DBG_8723A("ack check for asoc expire, keep_alive_trycnt =%d\n", psta->keep_alive_trycnt);
> - psta->expire_to = 1;
> - continue;
> - }
>
> - psta->keep_alive_trycnt = 0;
> -
> - DBG_8723A("asoc expire %pM, state = 0x%x\n",
> - psta->hwaddr, psta->state);
> - spin_lock_bh(&pstapriv->asoc_list_lock);
> - if (!list_empty(&psta->asoc_list)) {
> - list_del_init(&psta->asoc_list);
> - pstapriv->asoc_list_cnt--;
> - updated = ap_free_sta23a(padapter, psta, false, WLAN_REASON_DEAUTH_LEAVING);
> + DBG_8723A("asoc expire %pM, state = 0x%x\n",
> + psta->hwaddr, psta->state);
> + spin_lock_bh(&pstapriv->asoc_list_lock);
> + if (!list_empty(&psta->asoc_list)) {
> + list_del_init(&psta->asoc_list);
> + pstapriv->asoc_list_cnt--;
> + updated = ap_free_sta23a(padapter, psta, false,
> + WLAN_REASON_DEAUTH_LEAVING);
> + }
> + spin_unlock_bh(&pstapriv->asoc_list_lock);
> }
> - spin_unlock_bh(&pstapriv->asoc_list_lock);
>
> + /* back to original operation channel */
> + if (backup_oper_channel > 0)
> + SelectChannel23a(padapter, backup_oper_channel);
> }
>
> - if (backup_oper_channel > 0) /* back to original operation channel */
> - SelectChannel23a(padapter, backup_oper_channel);
> -}
> -
> associated_clients_update23a(padapter, updated);
> }
>
> @@ -1059,7 +1052,7 @@ void rtw_set_macaddr_acl23a(struct rtw_adapter *padapter, int mode)
>
> int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
> {
> - struct list_head *plist, *phead;
> + struct list_head *phead;
> u8 added = false;
> int i, ret = 0;
> struct rtw_wlan_acl_node *paclnode;
> @@ -1073,12 +1066,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
> return -1;
>
> spin_lock_bh(&pacl_node_q->lock);
> -
> phead = get_list_head(pacl_node_q);
> -
> - list_for_each(plist, phead) {
> - paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
> -
> + list_for_each_entry(paclnode, phead, list) {
> if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
> if (paclnode->valid == true) {
> added = true;
> @@ -1087,7 +1076,6 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
> }
> }
> }
> -
> spin_unlock_bh(&pacl_node_q->lock);
>
> if (added)
> @@ -1121,8 +1109,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
>
> int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
> {
> - struct list_head *plist, *phead, *ptmp;
> - struct rtw_wlan_acl_node *paclnode;
> + struct list_head *phead;
> + struct rtw_wlan_acl_node *paclnode, *ptmp;
> struct sta_priv *pstapriv = &padapter->stapriv;
> struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
> struct rtw_queue *pacl_node_q = &pacl_list->acl_node_q;
> @@ -1130,12 +1118,8 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
> DBG_8723A("%s(acl_num =%d) = %pM\n", __func__, pacl_list->num, addr);
>
> spin_lock_bh(&pacl_node_q->lock);
> -
> phead = get_list_head(pacl_node_q);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
> -
> + list_for_each_entry_safe(paclnode, ptmp, phead, list) {
> if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
> if (paclnode->valid) {
> paclnode->valid = false;
> @@ -1146,7 +1130,6 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
> }
> }
> }
> -
> spin_unlock_bh(&pacl_node_q->lock);
>
> DBG_8723A("%s, acl_num =%d\n", __func__, pacl_list->num);
> @@ -1354,20 +1337,14 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated)
> {
> /* update associated stations cap. */
> if (updated == true) {
> - struct list_head *phead, *plist, *ptmp;
> - struct sta_info *psta;
> + struct list_head *phead;
> + struct sta_info *psta, *ptmp;
> struct sta_priv *pstapriv = &padapter->stapriv;
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> -
> phead = &pstapriv->asoc_list;
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - psta = container_of(plist, struct sta_info, asoc_list);
> -
> + list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
> VCS_update23a(padapter, psta);
> - }
> -
> spin_unlock_bh(&pstapriv->asoc_list_lock);
> }
> }
> @@ -1627,7 +1604,7 @@ u8 ap_free_sta23a(struct rtw_adapter *padapter, struct sta_info *psta, bool acti
>
> int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_offset)
> {
> - struct list_head *phead, *plist;
> + struct list_head *phead;
> struct sta_info *psta = NULL;
> struct sta_priv *pstapriv = &padapter->stapriv;
> struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
> @@ -1642,10 +1619,7 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> phead = &pstapriv->asoc_list;
> -
> - list_for_each(plist, phead) {
> - psta = container_of(plist, struct sta_info, asoc_list);
> -
> + list_for_each_entry(psta, phead, asoc_list) {
> issue_action_spct_ch_switch23a(padapter, psta->hwaddr, new_ch, ch_offset);
> psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2);
> }
> @@ -1658,8 +1632,8 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of
>
> int rtw_sta_flush23a(struct rtw_adapter *padapter)
> {
> - struct list_head *phead, *plist, *ptmp;
> - struct sta_info *psta;
> + struct list_head *phead;
> + struct sta_info *psta, *ptmp;
> struct sta_priv *pstapriv = &padapter->stapriv;
> struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
> struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
> @@ -1675,10 +1649,7 @@ int rtw_sta_flush23a(struct rtw_adapter *padapter)
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> phead = &pstapriv->asoc_list;
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - psta = container_of(plist, struct sta_info, asoc_list);
> -
> + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
> /* Remove sta from asoc_list */
> list_del_init(&psta->asoc_list);
> pstapriv->asoc_list_cnt--;
> @@ -1744,9 +1715,9 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
> struct mlme_priv *mlmepriv = &padapter->mlmepriv;
> struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
> struct sta_priv *pstapriv = &padapter->stapriv;
> - struct sta_info *psta;
> + struct sta_info *psta, *ptmp;
> struct security_priv *psecuritypriv = &padapter->securitypriv;
> - struct list_head *phead, *plist, *ptmp;
> + struct list_head *phead;
> u8 chk_alive_num = 0;
> struct sta_info *chk_alive_list[NUM_STA];
> int i;
> @@ -1775,15 +1746,9 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
> }
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> -
> phead = &pstapriv->asoc_list;
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - psta = container_of(plist, struct sta_info, asoc_list);
> -
> + list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
> chk_alive_list[chk_alive_num++] = psta;
> - }
> -
> spin_unlock_bh(&pstapriv->asoc_list_lock);
>
> for (i = 0; i < chk_alive_num; i++) {
> @@ -1841,8 +1806,8 @@ void start_ap_mode23a(struct rtw_adapter *padapter)
>
> void stop_ap_mode23a(struct rtw_adapter *padapter)
> {
> - struct list_head *phead, *plist, *ptmp;
> - struct rtw_wlan_acl_node *paclnode;
> + struct list_head *phead;
> + struct rtw_wlan_acl_node *paclnode, *ptmp;
> struct sta_info *psta = NULL;
> struct sta_priv *pstapriv = &padapter->stapriv;
> struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
> @@ -1864,15 +1829,10 @@ void stop_ap_mode23a(struct rtw_adapter *padapter)
> /* for ACL */
> spin_lock_bh(&pacl_node_q->lock);
> phead = get_list_head(pacl_node_q);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
> -
> + list_for_each_entry_safe(paclnode, ptmp, phead, list) {
> if (paclnode->valid == true) {
> paclnode->valid = false;
> -
> list_del_init(&paclnode->list);
> -
> pacl_list->num--;
> }
> }
> diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c
> index 3c09ea9..3adda55 100644
> --- a/drivers/staging/rtl8723au/core/rtw_mlme.c
> +++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
> @@ -171,21 +171,15 @@ exit:
>
> void rtw_free_network_queue23a(struct rtw_adapter *padapter)
> {
> - struct list_head *phead, *plist, *ptmp;
> - struct wlan_network *pnetwork;
> + struct list_head *phead;
> + struct wlan_network *pnetwork, *ptmp;
> struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
> struct rtw_queue *scanned_queue = &pmlmepriv->scanned_queue;
>
> spin_lock_bh(&scanned_queue->lock);
> -
> phead = get_list_head(scanned_queue);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pnetwork = container_of(plist, struct wlan_network, list);
> -
> + list_for_each_entry_safe(pnetwork, ptmp, phead, list)
> _rtw_free_network23a(pmlmepriv, pnetwork);
> - }
> -
> spin_unlock_bh(&scanned_queue->lock);
> }
>
> @@ -329,15 +323,12 @@ int is_same_network23a(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst)
> struct wlan_network *
> rtw_get_oldest_wlan_network23a(struct rtw_queue *scanned_queue)
> {
> - struct list_head *plist, *phead;
> + struct list_head *phead;
> struct wlan_network *pwlan;
> struct wlan_network *oldest = NULL;
>
> phead = get_list_head(scanned_queue);
> -
> - list_for_each(plist, phead) {
> - pwlan = container_of(plist, struct wlan_network, list);
> -
> + list_for_each_entry(pwlan, phead, list) {
> if (pwlan->fixed != true) {
> if (!oldest || time_after(oldest->last_scanned,
> pwlan->last_scanned))
> @@ -445,7 +436,6 @@ static void rtw_update_scanned_network(struct rtw_adapter *adapter,
>
> spin_lock_bh(&queue->lock);
> phead = get_list_head(queue);
> -
> list_for_each(plist, phead) {
> pnetwork = container_of(plist, struct wlan_network, list);
>
> @@ -710,21 +700,17 @@ rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf)
>
> static void free_scanqueue(struct mlme_priv *pmlmepriv)
> {
> - struct wlan_network *pnetwork;
> + struct wlan_network *pnetwork, *ptemp;
> struct rtw_queue *scan_queue = &pmlmepriv->scanned_queue;
> - struct list_head *plist, *phead, *ptemp;
> + struct list_head *phead;
>
> RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, "+free_scanqueue\n");
> spin_lock_bh(&scan_queue->lock);
> -
> phead = get_list_head(scan_queue);
> -
> - list_for_each_safe(plist, ptemp, phead) {
> - pnetwork = container_of(plist, struct wlan_network, list);
> + list_for_each_entry_safe(pnetwork, ptemp, phead, list) {
> pnetwork->fixed = false;
> _rtw_free_network23a(pmlmepriv, pnetwork);
> }
> -
> spin_unlock_bh(&scan_queue->lock);
> }
>
> @@ -1625,15 +1611,13 @@ exit:
> static struct wlan_network *
> rtw_select_candidate_from_queue(struct mlme_priv *pmlmepriv)
> {
> - struct wlan_network *pnetwork, *candidate = NULL;
> + struct wlan_network *pnetwork, *ptmp, *candidate = NULL;
> struct rtw_queue *queue = &pmlmepriv->scanned_queue;
> - struct list_head *phead, *plist, *ptmp;
> + struct list_head *phead;
>
> spin_lock_bh(&pmlmepriv->scanned_queue.lock);
> phead = get_list_head(queue);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pnetwork = container_of(plist, struct wlan_network, list);
> + list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
> if (!pnetwork) {
> RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
> "%s: return _FAIL:(pnetwork == NULL)\n",
> diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
> index d28f29a..cc99a96 100644
> --- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
> +++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
> @@ -6082,8 +6082,8 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
> #ifdef CONFIG_8723AU_AP_MODE
> else { /* tx bc/mc frames after update TIM */
> struct sta_info *psta_bmc;
> - struct list_head *plist, *phead, *ptmp;
> - struct xmit_frame *pxmitframe;
> + struct list_head *phead;
> + struct xmit_frame *pxmitframe, *tmp;
> struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
> struct sta_priv *pstapriv = &padapter->stapriv;
>
> @@ -6096,14 +6096,8 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
> msleep(10);/* 10ms, ATIM(HIQ) Windows */
> /* spin_lock_bh(&psta_bmc->sleep_q.lock); */
> spin_lock_bh(&pxmitpriv->lock);
> -
> phead = get_list_head(&psta_bmc->sleep_q);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pxmitframe = container_of(plist,
> - struct xmit_frame,
> - list);
> -
> + list_for_each_entry_safe(pxmitframe, tmp, phead, list) {
> list_del_init(&pxmitframe->list);
>
> psta_bmc->sleepq_len--;
> @@ -6119,7 +6113,6 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
> rtl8723au_hal_xmitframe_enqueue(padapter,
> pxmitframe);
> }
> -
> /* spin_unlock_bh(&psta_bmc->sleep_q.lock); */
> spin_unlock_bh(&pxmitpriv->lock);
> }
> diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
> index 404b618..de1226e 100644
> --- a/drivers/staging/rtl8723au/core/rtw_recv.c
> +++ b/drivers/staging/rtl8723au/core/rtw_recv.c
> @@ -85,16 +85,16 @@ int _rtw_init_recv_priv23a(struct recv_priv *precvpriv,
> return res;
> }
>
> -void _rtw_free_recv_priv23a (struct recv_priv *precvpriv)
> +void _rtw_free_recv_priv23a(struct recv_priv *precvpriv)
> {
> struct rtw_adapter *padapter = precvpriv->adapter;
> - struct recv_frame *precvframe;
> - struct list_head *plist, *ptmp;
> + struct recv_frame *precvframe, *ptmp;
>
> rtw_free_uc_swdec_pending_queue23a(padapter);
>
> - list_for_each_safe(plist, ptmp, &precvpriv->free_recv_queue.queue) {
> - precvframe = container_of(plist, struct recv_frame, list);
> + list_for_each_entry_safe(precvframe, ptmp,
> + &precvpriv->free_recv_queue.queue,
> + list) {
> list_del_init(&precvframe->list);
> kfree(precvframe);
> }
> @@ -195,19 +195,13 @@ using spinlock to protect
>
> static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue)
> {
> - struct recv_frame *hdr;
> - struct list_head *plist, *phead, *ptmp;
> + struct recv_frame *hdr, *ptmp;
> + struct list_head *phead;
>
> spin_lock(&pframequeue->lock);
> -
> phead = get_list_head(pframequeue);
> - plist = phead->next;
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - hdr = container_of(plist, struct recv_frame, list);
> + list_for_each_entry_safe(hdr, ptmp, phead, list)
> rtw_free_recvframe23a(hdr);
> - }
> -
> spin_unlock(&pframequeue->lock);
> }
>
> @@ -1567,16 +1561,14 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
> struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
> struct rtw_queue *defrag_q)
> {
> - struct list_head *plist, *phead, *ptmp;
> - u8 *data, wlanhdr_offset;
> - u8 curfragnum;
> - struct recv_frame *pnfhdr;
> + struct list_head *plist, *phead;
> + u8 wlanhdr_offset;
> + u8 curfragnum;
> + struct recv_frame *pnfhdr, *ptmp;
> struct recv_frame *prframe, *pnextrframe;
> - struct rtw_queue *pfree_recv_queue;
> + struct rtw_queue *pfree_recv_queue;
> struct sk_buff *skb;
>
> -
> -
> curfragnum = 0;
> pfree_recv_queue = &adapter->recvpriv.free_recv_queue;
>
> @@ -1597,12 +1589,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
>
> curfragnum++;
>
> - phead = get_list_head(defrag_q);
> -
> - data = prframe->pkt->data;
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pnfhdr = container_of(plist, struct recv_frame, list);
> + list_for_each_entry_safe(pnfhdr, ptmp, phead, list) {
> pnextrframe = (struct recv_frame *)pnfhdr;
> /* check the fragment sequence (2nd ~n fragment frame) */
>
> @@ -1644,8 +1631,6 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
> RT_TRACE(_module_rtl871x_recv_c_, _drv_info_,
> "Performance defrag!!!!!\n");
>
> -
> -
> return prframe;
> }
>
> diff --git a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
> index b06bff7..f1200e3 100644
> --- a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
> +++ b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
> @@ -83,8 +83,8 @@ int _rtw_init_sta_priv23a(struct sta_priv *pstapriv)
>
> int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
> {
> - struct list_head *phead, *plist, *ptmp;
> - struct sta_info *psta;
> + struct list_head *phead;
> + struct sta_info *psta, *ptmp;
> struct recv_reorder_ctrl *preorder_ctrl;
> int index;
>
> @@ -93,12 +93,9 @@ int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
> spin_lock_bh(&pstapriv->sta_hash_lock);
> for (index = 0; index < NUM_STA; index++) {
> phead = &pstapriv->sta_hash[index];
> -
> - list_for_each_safe(plist, ptmp, phead) {
> + list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
> int i;
>
> - psta = container_of(plist, struct sta_info,
> - hash_list);
> for (i = 0; i < 16 ; i++) {
> preorder_ctrl = &psta->recvreorder_ctrl[i];
> del_timer_sync(&preorder_ctrl->reordering_ctrl_timer);
> @@ -325,8 +322,8 @@ exit:
> /* free all stainfo which in sta_hash[all] */
> void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
> {
> - struct list_head *plist, *phead, *ptmp;
> - struct sta_info *psta;
> + struct list_head *phead;
> + struct sta_info *psta, *ptmp;
> struct sta_priv *pstapriv = &padapter->stapriv;
> struct sta_info *pbcmc_stainfo = rtw_get_bcmc_stainfo23a(padapter);
> s32 index;
> @@ -335,13 +332,9 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
> return;
>
> spin_lock_bh(&pstapriv->sta_hash_lock);
> -
> for (index = 0; index < NUM_STA; index++) {
> phead = &pstapriv->sta_hash[index];
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - psta = container_of(plist, struct sta_info, hash_list);
> -
> + list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
> if (pbcmc_stainfo != psta)
> rtw_free_stainfo23a(padapter, psta);
> }
> @@ -352,7 +345,7 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
> /* any station allocated can be searched by hash list */
> struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
> {
> - struct list_head *plist, *phead;
> + struct list_head *phead;
> struct sta_info *psta = NULL;
> u32 index;
> const u8 *addr;
> @@ -368,12 +361,8 @@ struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
> index = wifi_mac_hash(addr);
>
> spin_lock_bh(&pstapriv->sta_hash_lock);
> -
> phead = &pstapriv->sta_hash[index];
> -
> - list_for_each(plist, phead) {
> - psta = container_of(plist, struct sta_info, hash_list);
> -
> + list_for_each_entry(psta, phead, hash_list) {
> /* if found the matched address */
> if (ether_addr_equal(psta->hwaddr, addr))
> break;
> @@ -418,7 +407,7 @@ bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
> {
> bool res = true;
> #ifdef CONFIG_8723AU_AP_MODE
> - struct list_head *plist, *phead;
> + struct list_head *phead;
> struct rtw_wlan_acl_node *paclnode;
> bool match = false;
> struct sta_priv *pstapriv = &padapter->stapriv;
> @@ -427,10 +416,7 @@ bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
>
> spin_lock_bh(&pacl_node_q->lock);
> phead = get_list_head(pacl_node_q);
> -
> - list_for_each(plist, phead) {
> - paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
> -
> + list_for_each_entry(paclnode, phead, list) {
> if (ether_addr_equal(paclnode->addr, mac_addr)) {
> if (paclnode->valid) {
> match = true;
> diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c
> index a4b6bb6..fc55120 100644
> --- a/drivers/staging/rtl8723au/core/rtw_xmit.c
> +++ b/drivers/staging/rtl8723au/core/rtw_xmit.c
> @@ -193,39 +193,38 @@ fail:
> goto exit;
> }
>
> -void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv)
> +void _rtw_free_xmit_priv23a(struct xmit_priv *pxmitpriv)
> {
> struct rtw_adapter *padapter = pxmitpriv->adapter;
> - struct xmit_frame *pxframe;
> - struct xmit_buf *pxmitbuf;
> - struct list_head *plist, *ptmp;
> + struct xmit_frame *pxframe, *ptmp;
> + struct xmit_buf *pxmitbuf, *ptmp2;
>
> - list_for_each_safe(plist, ptmp, &pxmitpriv->free_xmit_queue.queue) {
> - pxframe = container_of(plist, struct xmit_frame, list);
> + list_for_each_entry_safe(pxframe, ptmp,
> + &pxmitpriv->free_xmit_queue.queue, list) {
> list_del_init(&pxframe->list);
> rtw_os_xmit_complete23a(padapter, pxframe);
> kfree(pxframe);
> }
>
> - list_for_each_safe(plist, ptmp, &pxmitpriv->xmitbuf_list) {
> - pxmitbuf = container_of(plist, struct xmit_buf, list2);
> + list_for_each_entry_safe(pxmitbuf, ptmp2,
> + &pxmitpriv->xmitbuf_list, list2) {
> list_del_init(&pxmitbuf->list2);
> rtw_os_xmit_resource_free23a(padapter, pxmitbuf);
> kfree(pxmitbuf);
> }
>
> /* free xframe_ext queue, the same count as extbuf */
> - list_for_each_safe(plist, ptmp,
> - &pxmitpriv->free_xframe_ext_queue.queue) {
> - pxframe = container_of(plist, struct xmit_frame, list);
> + list_for_each_entry_safe(pxframe, ptmp,
> + &pxmitpriv->free_xframe_ext_queue.queue,
> + list) {
> list_del_init(&pxframe->list);
> rtw_os_xmit_complete23a(padapter, pxframe);
> kfree(pxframe);
> }
>
> /* free xmit extension buff */
> - list_for_each_safe(plist, ptmp, &pxmitpriv->xmitextbuf_list) {
> - pxmitbuf = container_of(plist, struct xmit_buf, list2);
> + list_for_each_entry_safe(pxmitbuf, ptmp2,
> + &pxmitpriv->xmitextbuf_list, list2) {
> list_del_init(&pxmitbuf->list2);
> rtw_os_xmit_resource_free23a(padapter, pxmitbuf);
> kfree(pxmitbuf);
> @@ -1563,18 +1562,13 @@ exit:
> void rtw_free_xmitframe_queue23a(struct xmit_priv *pxmitpriv,
> struct rtw_queue *pframequeue)
> {
> - struct list_head *plist, *phead, *ptmp;
> - struct xmit_frame *pxmitframe;
> + struct list_head *phead;
> + struct xmit_frame *pxmitframe, *ptmp;
>
> spin_lock_bh(&pframequeue->lock);
> -
> phead = get_list_head(pframequeue);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pxmitframe = container_of(plist, struct xmit_frame, list);
> -
> + list_for_each_entry_safe(pxmitframe, ptmp, phead, list)
> rtw_free_xmitframe23a(pxmitpriv, pxmitframe);
> - }
> spin_unlock_bh(&pframequeue->lock);
>
> }
> @@ -1612,9 +1606,9 @@ struct xmit_frame *
> rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i,
> int entry)
> {
> - struct list_head *sta_plist, *sta_phead, *ptmp;
> + struct list_head *sta_phead;
> struct hw_xmit *phwxmit;
> - struct tx_servq *ptxservq = NULL;
> + struct tx_servq *ptxservq = NULL, *ptmp;
> struct rtw_queue *pframe_queue = NULL;
> struct xmit_frame *pxmitframe = NULL;
> struct rtw_adapter *padapter = pxmitpriv->adapter;
> @@ -1638,11 +1632,8 @@ rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i,
> phwxmit = phwxmit_i + inx[i];
>
> sta_phead = get_list_head(phwxmit->sta_queue);
> -
> - list_for_each_safe(sta_plist, ptmp, sta_phead) {
> - ptxservq = container_of(sta_plist, struct tx_servq,
> - tx_pending);
> -
> + list_for_each_entry_safe(ptxservq, ptmp, sta_phead,
> + tx_pending) {
> pframe_queue = &ptxservq->sta_pending;
>
> pxmitframe = dequeue_one_xmitframe(pxmitpriv, phwxmit, ptxservq, pframe_queue);
> @@ -2052,18 +2043,15 @@ dequeue_xmitframes_to_sleeping_queue(struct rtw_adapter *padapter,
> struct rtw_queue *pframequeue)
> {
> int ret;
> - struct list_head *plist, *phead, *ptmp;
> + struct list_head *phead;
> u8 ac_index;
> struct tx_servq *ptxservq;
> struct pkt_attrib *pattrib;
> - struct xmit_frame *pxmitframe;
> + struct xmit_frame *pxmitframe, *ptmp;
> struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
>
> phead = get_list_head(pframequeue);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pxmitframe = container_of(plist, struct xmit_frame, list);
> -
> + list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
> ret = xmitframe_enqueue_for_sleeping_sta23a(padapter, pxmitframe);
>
> if (ret == true) {
> @@ -2124,17 +2112,14 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
> {
> u8 update_mask = 0, wmmps_ac = 0;
> struct sta_info *psta_bmc;
> - struct list_head *plist, *phead, *ptmp;
> - struct xmit_frame *pxmitframe = NULL;
> + struct list_head *phead;
> + struct xmit_frame *pxmitframe = NULL, *ptmp;
> struct sta_priv *pstapriv = &padapter->stapriv;
> struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
>
> spin_lock_bh(&pxmitpriv->lock);
> -
> phead = get_list_head(&psta->sleep_q);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pxmitframe = container_of(plist, struct xmit_frame, list);
> + list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
> list_del_init(&pxmitframe->list);
>
> switch (pxmitframe->attrib.priority) {
> @@ -2194,7 +2179,6 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
>
> pstapriv->sta_dz_bitmap &= ~CHKBIT(psta->aid);
> }
> -
> /* spin_unlock_bh(&psta->sleep_q.lock); */
> spin_unlock_bh(&pxmitpriv->lock);
>
> @@ -2206,13 +2190,8 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
> if ((pstapriv->sta_dz_bitmap&0xfffe) == 0x0) {
> /* no any sta in ps mode */
> spin_lock_bh(&pxmitpriv->lock);
> -
> phead = get_list_head(&psta_bmc->sleep_q);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pxmitframe = container_of(plist, struct xmit_frame,
> - list);
> -
> + list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
> list_del_init(&pxmitframe->list);
>
> psta_bmc->sleepq_len--;
> @@ -2232,7 +2211,6 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
> /* update_BCNTIM(padapter); */
> update_mask |= BIT(1);
> }
> -
> /* spin_unlock_bh(&psta_bmc->sleep_q.lock); */
> spin_unlock_bh(&pxmitpriv->lock);
> }
> @@ -2245,19 +2223,15 @@ void xmit_delivery_enabled_frames23a(struct rtw_adapter *padapter,
> struct sta_info *psta)
> {
> u8 wmmps_ac = 0;
> - struct list_head *plist, *phead, *ptmp;
> - struct xmit_frame *pxmitframe;
> + struct list_head *phead;
> + struct xmit_frame *pxmitframe, *ptmp;
> struct sta_priv *pstapriv = &padapter->stapriv;
> struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
>
> /* spin_lock_bh(&psta->sleep_q.lock); */
> spin_lock_bh(&pxmitpriv->lock);
> -
> phead = get_list_head(&psta->sleep_q);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pxmitframe = container_of(plist, struct xmit_frame, list);
> -
> + list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
> switch (pxmitframe->attrib.priority) {
> case 1:
> case 2:
> diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
> index 0ae2180..908b84c 100644
> --- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
> +++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
> @@ -1270,18 +1270,14 @@ void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv,
>
> void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
> {
> - struct list_head *plist, *phead, *ptmp;
> + struct list_head *phead;
> struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
> struct rtw_queue *queue = &pmlmepriv->scanned_queue;
> - struct wlan_network *pnetwork;
> + struct wlan_network *pnetwork, *ptmp;
>
> spin_lock_bh(&pmlmepriv->scanned_queue.lock);
> -
> phead = get_list_head(queue);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pnetwork = container_of(plist, struct wlan_network, list);
> -
> + list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
> /* report network only if the current channel set
> contains the channel to which this network belongs */
> if (rtw_ch_set_search_ch23a
> @@ -1289,7 +1285,6 @@ void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
> pnetwork->network.DSConfig) >= 0)
> rtw_cfg80211_inform_bss(padapter, pnetwork);
> }
> -
> spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
>
> /* call this after other things have been done */
> @@ -2850,9 +2845,9 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
> {
> const u8 *mac = params->mac;
> int ret = 0;
> - struct list_head *phead, *plist, *ptmp;
> + struct list_head *phead;
> u8 updated = 0;
> - struct sta_info *psta;
> + struct sta_info *psta, *ptmp;
> struct rtw_adapter *padapter = netdev_priv(ndev);
> struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
> struct sta_priv *pstapriv = &padapter->stapriv;
> @@ -2881,13 +2876,9 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
> return -EINVAL;
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> -
> phead = &pstapriv->asoc_list;
> -
> /* check asoc_queue */
> - list_for_each_safe(plist, ptmp, phead) {
> - psta = container_of(plist, struct sta_info, asoc_list);
> -
> + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
> if (ether_addr_equal(mac, psta->hwaddr)) {
> if (psta->dot8021xalg == 1 &&
> psta->bpairwise_key_installed == false) {
> @@ -2912,7 +2903,6 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
> }
> }
> }
> -
> spin_unlock_bh(&pstapriv->asoc_list_lock);
>
> associated_clients_update23a(padapter, updated);
> diff --git a/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c b/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
> index 0cdaef0..cf4a506 100644
> --- a/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
> +++ b/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
> @@ -210,22 +210,21 @@ exit:
> void rtl8723au_write_port_cancel(struct rtw_adapter *padapter)
> {
> struct xmit_buf *pxmitbuf;
> - struct list_head *plist;
> int j;
>
> DBG_8723A("%s\n", __func__);
>
> padapter->bWritePortCancel = true;
>
> - list_for_each(plist, &padapter->xmitpriv.xmitbuf_list) {
> - pxmitbuf = container_of(plist, struct xmit_buf, list2);
> + list_for_each_entry(pxmitbuf, &padapter->xmitpriv.xmitbuf_list,
> + list2) {
> for (j = 0; j < 8; j++) {
> if (pxmitbuf->pxmit_urb[j])
> usb_kill_urb(pxmitbuf->pxmit_urb[j]);
> }
> }
> - list_for_each(plist, &padapter->xmitpriv.xmitextbuf_list) {
> - pxmitbuf = container_of(plist, struct xmit_buf, list2);
> + list_for_each_entry(pxmitbuf, &padapter->xmitpriv.xmitextbuf_list,
> + list2) {
> for (j = 0; j < 8; j++) {
> if (pxmitbuf->pxmit_urb[j])
> usb_kill_urb(pxmitbuf->pxmit_urb[j]);
This patch cleans whitespaces and blank lines involved with
previous two patchs in this patch set.
Signed-off-by: Geliang Tang <[email protected]>
---
drivers/staging/rtl8723au/core/rtw_ap.c | 33 +----------------------
drivers/staging/rtl8723au/core/rtw_mlme.c | 10 -------
drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 3 +--
drivers/staging/rtl8723au/core/rtw_recv.c | 15 +++--------
drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 11 +-------
drivers/staging/rtl8723au/core/rtw_xmit.c | 26 ++++--------------
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 8 ------
7 files changed, 12 insertions(+), 94 deletions(-)
diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c
index 4ab3631..ce4b589 100644
--- a/drivers/staging/rtl8723au/core/rtw_ap.c
+++ b/drivers/staging/rtl8723au/core/rtw_ap.c
@@ -171,7 +171,7 @@ static u8 chk_sta_is_alive(struct sta_info *psta)
return ret;
}
-void expire_timeout_chk23a(struct rtw_adapter *padapter)
+void expire_timeout_chk23a(struct rtw_adapter *padapter)
{
struct list_head *phead;
u8 updated = 0;
@@ -182,12 +182,9 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
int i;
spin_lock_bh(&pstapriv->auth_list_lock);
-
phead = &pstapriv->auth_list;
-
/* check auth_queue */
list_for_each_entry_safe(psta, ptmp, phead, auth_list) {
-
if (psta->expire_to > 0) {
psta->expire_to--;
if (psta->expire_to == 0) {
@@ -205,18 +202,13 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
spin_lock_bh(&pstapriv->auth_list_lock);
}
}
-
}
-
spin_unlock_bh(&pstapriv->auth_list_lock);
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
/* check asoc_queue */
list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
-
if (chk_sta_is_alive(psta) || !psta->expire_to) {
psta->expire_to = pstapriv->expire_to;
psta->keep_alive_trycnt = 0;
@@ -281,7 +273,6 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
}
}
}
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
if (chk_alive_num) {
@@ -1071,11 +1062,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
return -1;
spin_lock_bh(&pacl_node_q->lock);
-
phead = get_list_head(pacl_node_q);
-
list_for_each_entry(paclnode, phead, list) {
-
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid == true) {
added = true;
@@ -1084,7 +1072,6 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
}
}
}
-
spin_unlock_bh(&pacl_node_q->lock);
if (added)
@@ -1127,11 +1114,8 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
DBG_8723A("%s(acl_num =%d) = %pM\n", __func__, pacl_list->num, addr);
spin_lock_bh(&pacl_node_q->lock);
-
phead = get_list_head(pacl_node_q);
-
list_for_each_entry_safe(paclnode, ptmp, phead, list) {
-
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid) {
paclnode->valid = false;
@@ -1142,7 +1126,6 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
}
}
}
-
spin_unlock_bh(&pacl_node_q->lock);
DBG_8723A("%s, acl_num =%d\n", __func__, pacl_list->num);
@@ -1355,12 +1338,9 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated)
struct sta_priv *pstapriv = &padapter->stapriv;
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
VCS_update23a(padapter, psta);
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
}
}
@@ -1635,9 +1615,7 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
-
list_for_each_entry(psta, phead, asoc_list) {
-
issue_action_spct_ch_switch23a(padapter, psta->hwaddr, new_ch, ch_offset);
psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2);
}
@@ -1667,9 +1645,7 @@ int rtw_sta_flush23a(struct rtw_adapter *padapter)
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
-
list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
-
/* Remove sta from asoc_list */
list_del_init(&psta->asoc_list);
pstapriv->asoc_list_cnt--;
@@ -1766,12 +1742,9 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
}
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
chk_alive_list[chk_alive_num++] = psta;
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
for (i = 0; i < chk_alive_num; i++) {
@@ -1852,14 +1825,10 @@ void stop_ap_mode23a(struct rtw_adapter *padapter)
/* for ACL */
spin_lock_bh(&pacl_node_q->lock);
phead = get_list_head(pacl_node_q);
-
list_for_each_entry_safe(paclnode, ptmp, phead, list) {
-
if (paclnode->valid == true) {
paclnode->valid = false;
-
list_del_init(&paclnode->list);
-
pacl_list->num--;
}
}
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c
index b807376..3adda55 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -177,12 +177,9 @@ void rtw_free_network_queue23a(struct rtw_adapter *padapter)
struct rtw_queue *scanned_queue = &pmlmepriv->scanned_queue;
spin_lock_bh(&scanned_queue->lock);
-
phead = get_list_head(scanned_queue);
-
list_for_each_entry_safe(pnetwork, ptmp, phead, list)
_rtw_free_network23a(pmlmepriv, pnetwork);
-
spin_unlock_bh(&scanned_queue->lock);
}
@@ -331,9 +328,7 @@ rtw_get_oldest_wlan_network23a(struct rtw_queue *scanned_queue)
struct wlan_network *oldest = NULL;
phead = get_list_head(scanned_queue);
-
list_for_each_entry(pwlan, phead, list) {
-
if (pwlan->fixed != true) {
if (!oldest || time_after(oldest->last_scanned,
pwlan->last_scanned))
@@ -441,7 +436,6 @@ static void rtw_update_scanned_network(struct rtw_adapter *adapter,
spin_lock_bh(&queue->lock);
phead = get_list_head(queue);
-
list_for_each(plist, phead) {
pnetwork = container_of(plist, struct wlan_network, list);
@@ -712,14 +706,11 @@ static void free_scanqueue(struct mlme_priv *pmlmepriv)
RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, "+free_scanqueue\n");
spin_lock_bh(&scan_queue->lock);
-
phead = get_list_head(scan_queue);
-
list_for_each_entry_safe(pnetwork, ptemp, phead, list) {
pnetwork->fixed = false;
_rtw_free_network23a(pmlmepriv, pnetwork);
}
-
spin_unlock_bh(&scan_queue->lock);
}
@@ -1626,7 +1617,6 @@ rtw_select_candidate_from_queue(struct mlme_priv *pmlmepriv)
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
phead = get_list_head(queue);
-
list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
if (!pnetwork) {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index 9322363c..f4fff38 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -6064,7 +6064,7 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
struct list_head *phead;
struct xmit_frame *pxmitframe, *ptmp;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
- struct sta_priv *pstapriv = &padapter->stapriv;
+ struct sta_priv *pstapriv = &padapter->stapriv;
/* for BC/MC Frames */
psta_bmc = rtw_get_bcmc_stainfo23a(padapter);
@@ -6096,7 +6096,6 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
rtl8723au_hal_xmitframe_enqueue(padapter,
pxmitframe);
}
-
/* spin_unlock_bh(&psta_bmc->sleep_q.lock); */
spin_unlock_bh(&pxmitpriv->lock);
}
diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
index d1e0f65..0a7741c 100644
--- a/drivers/staging/rtl8723au/core/rtw_recv.c
+++ b/drivers/staging/rtl8723au/core/rtw_recv.c
@@ -85,7 +85,7 @@ int _rtw_init_recv_priv23a(struct recv_priv *precvpriv,
return res;
}
-void _rtw_free_recv_priv23a (struct recv_priv *precvpriv)
+void _rtw_free_recv_priv23a(struct recv_priv *precvpriv)
{
struct rtw_adapter *padapter = precvpriv->adapter;
struct recv_frame *precvframe, *ptmp;
@@ -198,12 +198,9 @@ static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue)
struct list_head *phead;
spin_lock(&pframequeue->lock);
-
phead = get_list_head(pframequeue);
-
list_for_each_entry_safe(hdr, ptmp, phead, list)
rtw_free_recvframe23a(hdr);
-
spin_unlock(&pframequeue->lock);
}
@@ -1546,15 +1543,13 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
struct rtw_queue *defrag_q)
{
struct list_head *plist, *phead;
- u8 wlanhdr_offset;
- u8 curfragnum;
+ u8 wlanhdr_offset;
+ u8 curfragnum;
struct recv_frame *pnfhdr, *ptmp;
struct recv_frame *prframe, *pnextrframe;
- struct rtw_queue *pfree_recv_queue;
+ struct rtw_queue *pfree_recv_queue;
struct sk_buff *skb;
-
-
curfragnum = 0;
pfree_recv_queue = &adapter->recvpriv.free_recv_queue;
@@ -1617,8 +1612,6 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_,
"Performance defrag!!!!!\n");
-
-
return prframe;
}
diff --git a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
index 232f245..22d857b 100644
--- a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
@@ -93,7 +93,6 @@ int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
spin_lock_bh(&pstapriv->sta_hash_lock);
for (index = 0; index < NUM_STA; index++) {
phead = &pstapriv->sta_hash[index];
-
list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
int i;
@@ -333,12 +332,9 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
return;
spin_lock_bh(&pstapriv->sta_hash_lock);
-
for (index = 0; index < NUM_STA; index++) {
phead = &pstapriv->sta_hash[index];
-
list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
-
if (pbcmc_stainfo != psta)
rtw_free_stainfo23a(padapter, psta);
}
@@ -351,7 +347,7 @@ struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
{
struct list_head *phead;
struct sta_info *psta = NULL;
- u32 index;
+ u32 index;
const u8 *addr;
if (hwaddr == NULL)
@@ -365,11 +361,8 @@ struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
index = wifi_mac_hash(addr);
spin_lock_bh(&pstapriv->sta_hash_lock);
-
phead = &pstapriv->sta_hash[index];
-
list_for_each_entry(psta, phead, hash_list) {
-
/* if found the matched address */
if (ether_addr_equal(psta->hwaddr, addr))
break;
@@ -423,9 +416,7 @@ bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
spin_lock_bh(&pacl_node_q->lock);
phead = get_list_head(pacl_node_q);
-
list_for_each_entry(paclnode, phead, list) {
-
if (ether_addr_equal(paclnode->addr, mac_addr)) {
if (paclnode->valid) {
match = true;
diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c
index f88d670..b82b182 100644
--- a/drivers/staging/rtl8723au/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723au/core/rtw_xmit.c
@@ -193,7 +193,7 @@ fail:
goto exit;
}
-void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv)
+void _rtw_free_xmit_priv23a(struct xmit_priv *pxmitpriv)
{
struct rtw_adapter *padapter = pxmitpriv->adapter;
struct xmit_frame *pxframe, *ptmp;
@@ -1566,9 +1566,7 @@ void rtw_free_xmitframe_queue23a(struct xmit_priv *pxmitpriv,
struct xmit_frame *pxmitframe, *ptmp;
spin_lock_bh(&pframequeue->lock);
-
phead = get_list_head(pframequeue);
-
list_for_each_entry_safe(pxmitframe, ptmp, phead, list)
rtw_free_xmitframe23a(pxmitpriv, pxmitframe);
spin_unlock_bh(&pframequeue->lock);
@@ -1634,10 +1632,8 @@ rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i,
phwxmit = phwxmit_i + inx[i];
sta_phead = get_list_head(phwxmit->sta_queue);
-
list_for_each_entry_safe(ptxservq, ptmp, sta_phead,
tx_pending) {
-
pframe_queue = &ptxservq->sta_pending;
pxmitframe = dequeue_one_xmitframe(pxmitpriv, phwxmit, ptxservq, pframe_queue);
@@ -2048,16 +2044,14 @@ dequeue_xmitframes_to_sleeping_queue(struct rtw_adapter *padapter,
{
int ret;
struct list_head *phead;
- u8 ac_index;
+ u8 ac_index;
struct tx_servq *ptxservq;
- struct pkt_attrib *pattrib;
- struct xmit_frame *pxmitframe, *ptmp;
- struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
+ struct pkt_attrib *pattrib;
+ struct xmit_frame *pxmitframe, *ptmp;
+ struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
phead = get_list_head(pframequeue);
-
list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
-
ret = xmitframe_enqueue_for_sleeping_sta23a(padapter, pxmitframe);
if (ret == true) {
@@ -2124,9 +2118,7 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
spin_lock_bh(&pxmitpriv->lock);
-
phead = get_list_head(&psta->sleep_q);
-
list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
list_del_init(&pxmitframe->list);
@@ -2187,7 +2179,6 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
pstapriv->sta_dz_bitmap &= ~CHKBIT(psta->aid);
}
-
/* spin_unlock_bh(&psta->sleep_q.lock); */
spin_unlock_bh(&pxmitpriv->lock);
@@ -2199,11 +2190,8 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
if ((pstapriv->sta_dz_bitmap&0xfffe) == 0x0) {
/* no any sta in ps mode */
spin_lock_bh(&pxmitpriv->lock);
-
phead = get_list_head(&psta_bmc->sleep_q);
-
list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
-
list_del_init(&pxmitframe->list);
psta_bmc->sleepq_len--;
@@ -2223,7 +2211,6 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
/* update_BCNTIM(padapter); */
update_mask |= BIT(1);
}
-
/* spin_unlock_bh(&psta_bmc->sleep_q.lock); */
spin_unlock_bh(&pxmitpriv->lock);
}
@@ -2243,11 +2230,8 @@ void xmit_delivery_enabled_frames23a(struct rtw_adapter *padapter,
/* spin_lock_bh(&psta->sleep_q.lock); */
spin_lock_bh(&pxmitpriv->lock);
-
phead = get_list_head(&psta->sleep_q);
-
list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
-
switch (pxmitframe->attrib.priority) {
case 1:
case 2:
diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 26cb279..908b84c 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -1276,11 +1276,8 @@ void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
struct wlan_network *pnetwork, *ptmp;
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
-
phead = get_list_head(queue);
-
list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
-
/* report network only if the current channel set
contains the channel to which this network belongs */
if (rtw_ch_set_search_ch23a
@@ -1288,7 +1285,6 @@ void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
pnetwork->network.DSConfig) >= 0)
rtw_cfg80211_inform_bss(padapter, pnetwork);
}
-
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
/* call this after other things have been done */
@@ -2880,12 +2876,9 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
return -EINVAL;
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
/* check asoc_queue */
list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
-
if (ether_addr_equal(mac, psta->hwaddr)) {
if (psta->dot8021xalg == 1 &&
psta->bpairwise_key_installed == false) {
@@ -2910,7 +2903,6 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
}
}
}
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
associated_clients_update23a(padapter, updated);
--
2.5.0
Hi Geliang,
On Sun, Feb 7, 2016 at 2:30 PM, Geliang Tang <[email protected]> wrote:
> This patch cleans whitespaces and blank lines surrounding
> list_for_each_entry*().
It does a lot more than this, including:
- Removing some unnecessary brackets
- Whitespace changes well away from the list_for_each_entry*() calls
You need to either specify all of these in the changelog or split it
up into multiple patches.
Thanks,
Julian Calaby
>
> Signed-off-by: Geliang Tang <[email protected]>
> ---
> Changes in v3:
> - split it into three patches.
> Changes in v2:
> - drop the coding style fixing in v1.
> ---
> drivers/staging/rtl8723au/core/rtw_ap.c | 41 ++---------------------
> drivers/staging/rtl8723au/core/rtw_mlme.c | 14 +-------
> drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 3 +-
> drivers/staging/rtl8723au/core/rtw_recv.c | 18 +++-------
> drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 11 +-----
> drivers/staging/rtl8723au/core/rtw_xmit.c | 30 ++++-------------
> drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 8 -----
> 7 files changed, 17 insertions(+), 108 deletions(-)
>
> diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c
> index 4bcd617..ce4b589 100644
> --- a/drivers/staging/rtl8723au/core/rtw_ap.c
> +++ b/drivers/staging/rtl8723au/core/rtw_ap.c
> @@ -171,7 +171,7 @@ static u8 chk_sta_is_alive(struct sta_info *psta)
> return ret;
> }
>
> -void expire_timeout_chk23a(struct rtw_adapter *padapter)
> +void expire_timeout_chk23a(struct rtw_adapter *padapter)
> {
> struct list_head *phead;
> u8 updated = 0;
> @@ -182,12 +182,9 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
> int i;
>
> spin_lock_bh(&pstapriv->auth_list_lock);
> -
> phead = &pstapriv->auth_list;
> -
> /* check auth_queue */
> list_for_each_entry_safe(psta, ptmp, phead, auth_list) {
> -
> if (psta->expire_to > 0) {
> psta->expire_to--;
> if (psta->expire_to == 0) {
> @@ -205,18 +202,13 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
> spin_lock_bh(&pstapriv->auth_list_lock);
> }
> }
> -
> }
> -
> spin_unlock_bh(&pstapriv->auth_list_lock);
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> -
> phead = &pstapriv->asoc_list;
> -
> /* check asoc_queue */
> list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
> -
> if (chk_sta_is_alive(psta) || !psta->expire_to) {
> psta->expire_to = pstapriv->expire_to;
> psta->keep_alive_trycnt = 0;
> @@ -281,7 +273,6 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
> }
> }
> }
> -
> spin_unlock_bh(&pstapriv->asoc_list_lock);
>
> if (chk_alive_num) {
> @@ -1071,11 +1062,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
> return -1;
>
> spin_lock_bh(&pacl_node_q->lock);
> -
> phead = get_list_head(pacl_node_q);
> -
> list_for_each_entry(paclnode, phead, list) {
> -
> if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
> if (paclnode->valid == true) {
> added = true;
> @@ -1084,7 +1072,6 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
> }
> }
> }
> -
> spin_unlock_bh(&pacl_node_q->lock);
>
> if (added)
> @@ -1127,11 +1114,8 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
> DBG_8723A("%s(acl_num =%d) = %pM\n", __func__, pacl_list->num, addr);
>
> spin_lock_bh(&pacl_node_q->lock);
> -
> phead = get_list_head(pacl_node_q);
> -
> list_for_each_entry_safe(paclnode, ptmp, phead, list) {
> -
> if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
> if (paclnode->valid) {
> paclnode->valid = false;
> @@ -1142,7 +1126,6 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
> }
> }
> }
> -
> spin_unlock_bh(&pacl_node_q->lock);
>
> DBG_8723A("%s, acl_num =%d\n", __func__, pacl_list->num);
> @@ -1355,14 +1338,9 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated)
> struct sta_priv *pstapriv = &padapter->stapriv;
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> -
> phead = &pstapriv->asoc_list;
> -
> - list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
> -
> + list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
> VCS_update23a(padapter, psta);
> - }
> -
> spin_unlock_bh(&pstapriv->asoc_list_lock);
> }
> }
> @@ -1637,9 +1615,7 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> phead = &pstapriv->asoc_list;
> -
> list_for_each_entry(psta, phead, asoc_list) {
> -
> issue_action_spct_ch_switch23a(padapter, psta->hwaddr, new_ch, ch_offset);
> psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2);
> }
> @@ -1669,9 +1645,7 @@ int rtw_sta_flush23a(struct rtw_adapter *padapter)
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> phead = &pstapriv->asoc_list;
> -
> list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
> -
> /* Remove sta from asoc_list */
> list_del_init(&psta->asoc_list);
> pstapriv->asoc_list_cnt--;
> @@ -1768,14 +1742,9 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
> }
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> -
> phead = &pstapriv->asoc_list;
> -
> - list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
> -
> + list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
> chk_alive_list[chk_alive_num++] = psta;
> - }
> -
> spin_unlock_bh(&pstapriv->asoc_list_lock);
>
> for (i = 0; i < chk_alive_num; i++) {
> @@ -1856,14 +1825,10 @@ void stop_ap_mode23a(struct rtw_adapter *padapter)
> /* for ACL */
> spin_lock_bh(&pacl_node_q->lock);
> phead = get_list_head(pacl_node_q);
> -
> list_for_each_entry_safe(paclnode, ptmp, phead, list) {
> -
> if (paclnode->valid == true) {
> paclnode->valid = false;
> -
> list_del_init(&paclnode->list);
> -
> pacl_list->num--;
> }
> }
> diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c
> index 6cc1f33..3adda55 100644
> --- a/drivers/staging/rtl8723au/core/rtw_mlme.c
> +++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
> @@ -177,14 +177,9 @@ void rtw_free_network_queue23a(struct rtw_adapter *padapter)
> struct rtw_queue *scanned_queue = &pmlmepriv->scanned_queue;
>
> spin_lock_bh(&scanned_queue->lock);
> -
> phead = get_list_head(scanned_queue);
> -
> - list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
> -
> + list_for_each_entry_safe(pnetwork, ptmp, phead, list)
> _rtw_free_network23a(pmlmepriv, pnetwork);
> - }
> -
> spin_unlock_bh(&scanned_queue->lock);
> }
>
> @@ -333,9 +328,7 @@ rtw_get_oldest_wlan_network23a(struct rtw_queue *scanned_queue)
> struct wlan_network *oldest = NULL;
>
> phead = get_list_head(scanned_queue);
> -
> list_for_each_entry(pwlan, phead, list) {
> -
> if (pwlan->fixed != true) {
> if (!oldest || time_after(oldest->last_scanned,
> pwlan->last_scanned))
> @@ -443,7 +436,6 @@ static void rtw_update_scanned_network(struct rtw_adapter *adapter,
>
> spin_lock_bh(&queue->lock);
> phead = get_list_head(queue);
> -
> list_for_each(plist, phead) {
> pnetwork = container_of(plist, struct wlan_network, list);
>
> @@ -714,14 +706,11 @@ static void free_scanqueue(struct mlme_priv *pmlmepriv)
>
> RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, "+free_scanqueue\n");
> spin_lock_bh(&scan_queue->lock);
> -
> phead = get_list_head(scan_queue);
> -
> list_for_each_entry_safe(pnetwork, ptemp, phead, list) {
> pnetwork->fixed = false;
> _rtw_free_network23a(pmlmepriv, pnetwork);
> }
> -
> spin_unlock_bh(&scan_queue->lock);
> }
>
> @@ -1628,7 +1617,6 @@ rtw_select_candidate_from_queue(struct mlme_priv *pmlmepriv)
>
> spin_lock_bh(&pmlmepriv->scanned_queue.lock);
> phead = get_list_head(queue);
> -
> list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
> if (!pnetwork) {
> RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
> diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
> index 1b94031..61fbd10 100644
> --- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
> +++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
> @@ -6085,7 +6085,7 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
> struct list_head *phead;
> struct xmit_frame *pxmitframe, *ptmp;
> struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
> - struct sta_priv *pstapriv = &padapter->stapriv;
> + struct sta_priv *pstapriv = &padapter->stapriv;
>
> /* for BC/MC Frames */
> psta_bmc = rtw_get_bcmc_stainfo23a(padapter);
> @@ -6117,7 +6117,6 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
> rtl8723au_hal_xmitframe_enqueue(padapter,
> pxmitframe);
> }
> -
> /* spin_unlock_bh(&psta_bmc->sleep_q.lock); */
> spin_unlock_bh(&pxmitpriv->lock);
> }
> diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
> index b36bc6b..de1226e 100644
> --- a/drivers/staging/rtl8723au/core/rtw_recv.c
> +++ b/drivers/staging/rtl8723au/core/rtw_recv.c
> @@ -85,7 +85,7 @@ int _rtw_init_recv_priv23a(struct recv_priv *precvpriv,
> return res;
> }
>
> -void _rtw_free_recv_priv23a (struct recv_priv *precvpriv)
> +void _rtw_free_recv_priv23a(struct recv_priv *precvpriv)
> {
> struct rtw_adapter *padapter = precvpriv->adapter;
> struct recv_frame *precvframe, *ptmp;
> @@ -199,13 +199,9 @@ static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue)
> struct list_head *phead;
>
> spin_lock(&pframequeue->lock);
> -
> phead = get_list_head(pframequeue);
> -
> - list_for_each_entry_safe(hdr, ptmp, phead, list) {
> + list_for_each_entry_safe(hdr, ptmp, phead, list)
> rtw_free_recvframe23a(hdr);
> - }
> -
> spin_unlock(&pframequeue->lock);
> }
>
> @@ -1566,15 +1562,13 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
> struct rtw_queue *defrag_q)
> {
> struct list_head *plist, *phead;
> - u8 wlanhdr_offset;
> - u8 curfragnum;
> + u8 wlanhdr_offset;
> + u8 curfragnum;
> struct recv_frame *pnfhdr, *ptmp;
> struct recv_frame *prframe, *pnextrframe;
> - struct rtw_queue *pfree_recv_queue;
> + struct rtw_queue *pfree_recv_queue;
> struct sk_buff *skb;
>
> -
> -
> curfragnum = 0;
> pfree_recv_queue = &adapter->recvpriv.free_recv_queue;
>
> @@ -1637,8 +1631,6 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
> RT_TRACE(_module_rtl871x_recv_c_, _drv_info_,
> "Performance defrag!!!!!\n");
>
> -
> -
> return prframe;
> }
>
> diff --git a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
> index 232f245..22d857b 100644
> --- a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
> +++ b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
> @@ -93,7 +93,6 @@ int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
> spin_lock_bh(&pstapriv->sta_hash_lock);
> for (index = 0; index < NUM_STA; index++) {
> phead = &pstapriv->sta_hash[index];
> -
> list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
> int i;
>
> @@ -333,12 +332,9 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
> return;
>
> spin_lock_bh(&pstapriv->sta_hash_lock);
> -
> for (index = 0; index < NUM_STA; index++) {
> phead = &pstapriv->sta_hash[index];
> -
> list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
> -
> if (pbcmc_stainfo != psta)
> rtw_free_stainfo23a(padapter, psta);
> }
> @@ -351,7 +347,7 @@ struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
> {
> struct list_head *phead;
> struct sta_info *psta = NULL;
> - u32 index;
> + u32 index;
> const u8 *addr;
>
> if (hwaddr == NULL)
> @@ -365,11 +361,8 @@ struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
> index = wifi_mac_hash(addr);
>
> spin_lock_bh(&pstapriv->sta_hash_lock);
> -
> phead = &pstapriv->sta_hash[index];
> -
> list_for_each_entry(psta, phead, hash_list) {
> -
> /* if found the matched address */
> if (ether_addr_equal(psta->hwaddr, addr))
> break;
> @@ -423,9 +416,7 @@ bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
>
> spin_lock_bh(&pacl_node_q->lock);
> phead = get_list_head(pacl_node_q);
> -
> list_for_each_entry(paclnode, phead, list) {
> -
> if (ether_addr_equal(paclnode->addr, mac_addr)) {
> if (paclnode->valid) {
> match = true;
> diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c
> index 668806b..b82b182 100644
> --- a/drivers/staging/rtl8723au/core/rtw_xmit.c
> +++ b/drivers/staging/rtl8723au/core/rtw_xmit.c
> @@ -193,7 +193,7 @@ fail:
> goto exit;
> }
>
> -void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv)
> +void _rtw_free_xmit_priv23a(struct xmit_priv *pxmitpriv)
> {
> struct rtw_adapter *padapter = pxmitpriv->adapter;
> struct xmit_frame *pxframe, *ptmp;
> @@ -1566,13 +1566,9 @@ void rtw_free_xmitframe_queue23a(struct xmit_priv *pxmitpriv,
> struct xmit_frame *pxmitframe, *ptmp;
>
> spin_lock_bh(&pframequeue->lock);
> -
> phead = get_list_head(pframequeue);
> -
> - list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
> -
> + list_for_each_entry_safe(pxmitframe, ptmp, phead, list)
> rtw_free_xmitframe23a(pxmitpriv, pxmitframe);
> - }
> spin_unlock_bh(&pframequeue->lock);
>
> }
> @@ -1636,10 +1632,8 @@ rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i,
> phwxmit = phwxmit_i + inx[i];
>
> sta_phead = get_list_head(phwxmit->sta_queue);
> -
> list_for_each_entry_safe(ptxservq, ptmp, sta_phead,
> tx_pending) {
> -
> pframe_queue = &ptxservq->sta_pending;
>
> pxmitframe = dequeue_one_xmitframe(pxmitpriv, phwxmit, ptxservq, pframe_queue);
> @@ -2050,16 +2044,14 @@ dequeue_xmitframes_to_sleeping_queue(struct rtw_adapter *padapter,
> {
> int ret;
> struct list_head *phead;
> - u8 ac_index;
> + u8 ac_index;
> struct tx_servq *ptxservq;
> - struct pkt_attrib *pattrib;
> - struct xmit_frame *pxmitframe, *ptmp;
> - struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
> + struct pkt_attrib *pattrib;
> + struct xmit_frame *pxmitframe, *ptmp;
> + struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
>
> phead = get_list_head(pframequeue);
> -
> list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
> -
> ret = xmitframe_enqueue_for_sleeping_sta23a(padapter, pxmitframe);
>
> if (ret == true) {
> @@ -2126,9 +2118,7 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
> struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
>
> spin_lock_bh(&pxmitpriv->lock);
> -
> phead = get_list_head(&psta->sleep_q);
> -
> list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
> list_del_init(&pxmitframe->list);
>
> @@ -2189,7 +2179,6 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
>
> pstapriv->sta_dz_bitmap &= ~CHKBIT(psta->aid);
> }
> -
> /* spin_unlock_bh(&psta->sleep_q.lock); */
> spin_unlock_bh(&pxmitpriv->lock);
>
> @@ -2201,11 +2190,8 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
> if ((pstapriv->sta_dz_bitmap&0xfffe) == 0x0) {
> /* no any sta in ps mode */
> spin_lock_bh(&pxmitpriv->lock);
> -
> phead = get_list_head(&psta_bmc->sleep_q);
> -
> list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
> -
> list_del_init(&pxmitframe->list);
>
> psta_bmc->sleepq_len--;
> @@ -2225,7 +2211,6 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
> /* update_BCNTIM(padapter); */
> update_mask |= BIT(1);
> }
> -
> /* spin_unlock_bh(&psta_bmc->sleep_q.lock); */
> spin_unlock_bh(&pxmitpriv->lock);
> }
> @@ -2245,11 +2230,8 @@ void xmit_delivery_enabled_frames23a(struct rtw_adapter *padapter,
>
> /* spin_lock_bh(&psta->sleep_q.lock); */
> spin_lock_bh(&pxmitpriv->lock);
> -
> phead = get_list_head(&psta->sleep_q);
> -
> list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
> -
> switch (pxmitframe->attrib.priority) {
> case 1:
> case 2:
> diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
> index 26cb279..908b84c 100644
> --- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
> +++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
> @@ -1276,11 +1276,8 @@ void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
> struct wlan_network *pnetwork, *ptmp;
>
> spin_lock_bh(&pmlmepriv->scanned_queue.lock);
> -
> phead = get_list_head(queue);
> -
> list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
> -
> /* report network only if the current channel set
> contains the channel to which this network belongs */
> if (rtw_ch_set_search_ch23a
> @@ -1288,7 +1285,6 @@ void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
> pnetwork->network.DSConfig) >= 0)
> rtw_cfg80211_inform_bss(padapter, pnetwork);
> }
> -
> spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
>
> /* call this after other things have been done */
> @@ -2880,12 +2876,9 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
> return -EINVAL;
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> -
> phead = &pstapriv->asoc_list;
> -
> /* check asoc_queue */
> list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
> -
> if (ether_addr_equal(mac, psta->hwaddr)) {
> if (psta->dot8021xalg == 1 &&
> psta->bpairwise_key_installed == false) {
> @@ -2910,7 +2903,6 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
> }
> }
> }
> -
> spin_unlock_bh(&pstapriv->asoc_list_lock);
>
> associated_clients_update23a(padapter, updated);
> --
> 2.5.0
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Julian Calaby
Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/
Geliang Tang <[email protected]> writes:
> Use list_for_each_entry*() instead of list_for_each*() to simplify
> the code.
>
> Signed-off-by: Geliang Tang <[email protected]>
> ---
> Changes in v2:
> - drop the coding style fixing in v1.
> ---
> drivers/staging/rtl8723au/core/rtw_ap.c | 92 ++++++-----------------
> drivers/staging/rtl8723au/core/rtw_mlme.c | 38 +++-------
> drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 15 +---
> drivers/staging/rtl8723au/core/rtw_recv.c | 43 ++++-------
> drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 36 +++------
> drivers/staging/rtl8723au/core/rtw_xmit.c | 90 ++++++++--------------
> drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 22 ++----
> drivers/staging/rtl8723au/os_dep/usb_ops_linux.c | 9 +--
> 8 files changed, 106 insertions(+), 239 deletions(-)
You still include too much whitespace and blank line cleaning with the
actual code changes. Please split this into two patches, one that
changes the code, and one that does the whitespace cleanups.
Jes
>
> diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c
> index 1aa9b26..ce4b589 100644
> --- a/drivers/staging/rtl8723au/core/rtw_ap.c
> +++ b/drivers/staging/rtl8723au/core/rtw_ap.c
> @@ -171,24 +171,20 @@ static u8 chk_sta_is_alive(struct sta_info *psta)
> return ret;
> }
>
> -void expire_timeout_chk23a(struct rtw_adapter *padapter)
> +void expire_timeout_chk23a(struct rtw_adapter *padapter)
> {
> - struct list_head *phead, *plist, *ptmp;
> + struct list_head *phead;
> u8 updated = 0;
> - struct sta_info *psta;
> + struct sta_info *psta, *ptmp;
> struct sta_priv *pstapriv = &padapter->stapriv;
> u8 chk_alive_num = 0;
> struct sta_info *chk_alive_list[NUM_STA];
> int i;
>
> spin_lock_bh(&pstapriv->auth_list_lock);
> -
> phead = &pstapriv->auth_list;
> -
> /* check auth_queue */
> - list_for_each_safe(plist, ptmp, phead) {
> - psta = container_of(plist, struct sta_info, auth_list);
> -
> + list_for_each_entry_safe(psta, ptmp, phead, auth_list) {
> if (psta->expire_to > 0) {
> psta->expire_to--;
> if (psta->expire_to == 0) {
> @@ -206,19 +202,13 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
> spin_lock_bh(&pstapriv->auth_list_lock);
> }
> }
> -
> }
> -
> spin_unlock_bh(&pstapriv->auth_list_lock);
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> -
> phead = &pstapriv->asoc_list;
> -
> /* check asoc_queue */
> - list_for_each_safe(plist, ptmp, phead) {
> - psta = container_of(plist, struct sta_info, asoc_list);
> -
> + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
> if (chk_sta_is_alive(psta) || !psta->expire_to) {
> psta->expire_to = pstapriv->expire_to;
> psta->keep_alive_trycnt = 0;
> @@ -283,7 +273,6 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
> }
> }
> }
> -
> spin_unlock_bh(&pstapriv->asoc_list_lock);
>
> if (chk_alive_num) {
> @@ -1059,7 +1048,7 @@ void rtw_set_macaddr_acl23a(struct rtw_adapter *padapter, int mode)
>
> int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
> {
> - struct list_head *plist, *phead;
> + struct list_head *phead;
> u8 added = false;
> int i, ret = 0;
> struct rtw_wlan_acl_node *paclnode;
> @@ -1073,12 +1062,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
> return -1;
>
> spin_lock_bh(&pacl_node_q->lock);
> -
> phead = get_list_head(pacl_node_q);
> -
> - list_for_each(plist, phead) {
> - paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
> -
> + list_for_each_entry(paclnode, phead, list) {
> if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
> if (paclnode->valid == true) {
> added = true;
> @@ -1087,7 +1072,6 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
> }
> }
> }
> -
> spin_unlock_bh(&pacl_node_q->lock);
>
> if (added)
> @@ -1121,8 +1105,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
>
> int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
> {
> - struct list_head *plist, *phead, *ptmp;
> - struct rtw_wlan_acl_node *paclnode;
> + struct list_head *phead;
> + struct rtw_wlan_acl_node *paclnode, *ptmp;
> struct sta_priv *pstapriv = &padapter->stapriv;
> struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
> struct rtw_queue *pacl_node_q = &pacl_list->acl_node_q;
> @@ -1130,12 +1114,8 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
> DBG_8723A("%s(acl_num =%d) = %pM\n", __func__, pacl_list->num, addr);
>
> spin_lock_bh(&pacl_node_q->lock);
> -
> phead = get_list_head(pacl_node_q);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
> -
> + list_for_each_entry_safe(paclnode, ptmp, phead, list) {
> if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
> if (paclnode->valid) {
> paclnode->valid = false;
> @@ -1146,7 +1126,6 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
> }
> }
> }
> -
> spin_unlock_bh(&pacl_node_q->lock);
>
> DBG_8723A("%s, acl_num =%d\n", __func__, pacl_list->num);
> @@ -1354,20 +1333,14 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated)
> {
> /* update associated stations cap. */
> if (updated == true) {
> - struct list_head *phead, *plist, *ptmp;
> - struct sta_info *psta;
> + struct list_head *phead;
> + struct sta_info *psta, *ptmp;
> struct sta_priv *pstapriv = &padapter->stapriv;
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> -
> phead = &pstapriv->asoc_list;
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - psta = container_of(plist, struct sta_info, asoc_list);
> -
> + list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
> VCS_update23a(padapter, psta);
> - }
> -
> spin_unlock_bh(&pstapriv->asoc_list_lock);
> }
> }
> @@ -1627,7 +1600,7 @@ u8 ap_free_sta23a(struct rtw_adapter *padapter, struct sta_info *psta, bool acti
>
> int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_offset)
> {
> - struct list_head *phead, *plist;
> + struct list_head *phead;
> struct sta_info *psta = NULL;
> struct sta_priv *pstapriv = &padapter->stapriv;
> struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
> @@ -1642,10 +1615,7 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> phead = &pstapriv->asoc_list;
> -
> - list_for_each(plist, phead) {
> - psta = container_of(plist, struct sta_info, asoc_list);
> -
> + list_for_each_entry(psta, phead, asoc_list) {
> issue_action_spct_ch_switch23a(padapter, psta->hwaddr, new_ch, ch_offset);
> psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2);
> }
> @@ -1658,8 +1628,8 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of
>
> int rtw_sta_flush23a(struct rtw_adapter *padapter)
> {
> - struct list_head *phead, *plist, *ptmp;
> - struct sta_info *psta;
> + struct list_head *phead;
> + struct sta_info *psta, *ptmp;
> struct sta_priv *pstapriv = &padapter->stapriv;
> struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
> struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
> @@ -1675,10 +1645,7 @@ int rtw_sta_flush23a(struct rtw_adapter *padapter)
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> phead = &pstapriv->asoc_list;
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - psta = container_of(plist, struct sta_info, asoc_list);
> -
> + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
> /* Remove sta from asoc_list */
> list_del_init(&psta->asoc_list);
> pstapriv->asoc_list_cnt--;
> @@ -1744,9 +1711,9 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
> struct mlme_priv *mlmepriv = &padapter->mlmepriv;
> struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
> struct sta_priv *pstapriv = &padapter->stapriv;
> - struct sta_info *psta;
> + struct sta_info *psta, *ptmp;
> struct security_priv *psecuritypriv = &padapter->securitypriv;
> - struct list_head *phead, *plist, *ptmp;
> + struct list_head *phead;
> u8 chk_alive_num = 0;
> struct sta_info *chk_alive_list[NUM_STA];
> int i;
> @@ -1775,15 +1742,9 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
> }
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> -
> phead = &pstapriv->asoc_list;
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - psta = container_of(plist, struct sta_info, asoc_list);
> -
> + list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
> chk_alive_list[chk_alive_num++] = psta;
> - }
> -
> spin_unlock_bh(&pstapriv->asoc_list_lock);
>
> for (i = 0; i < chk_alive_num; i++) {
> @@ -1841,8 +1802,8 @@ void start_ap_mode23a(struct rtw_adapter *padapter)
>
> void stop_ap_mode23a(struct rtw_adapter *padapter)
> {
> - struct list_head *phead, *plist, *ptmp;
> - struct rtw_wlan_acl_node *paclnode;
> + struct list_head *phead;
> + struct rtw_wlan_acl_node *paclnode, *ptmp;
> struct sta_info *psta = NULL;
> struct sta_priv *pstapriv = &padapter->stapriv;
> struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
> @@ -1864,15 +1825,10 @@ void stop_ap_mode23a(struct rtw_adapter *padapter)
> /* for ACL */
> spin_lock_bh(&pacl_node_q->lock);
> phead = get_list_head(pacl_node_q);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
> -
> + list_for_each_entry_safe(paclnode, ptmp, phead, list) {
> if (paclnode->valid == true) {
> paclnode->valid = false;
> -
> list_del_init(&paclnode->list);
> -
> pacl_list->num--;
> }
> }
> diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c
> index 3c09ea9..3adda55 100644
> --- a/drivers/staging/rtl8723au/core/rtw_mlme.c
> +++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
> @@ -171,21 +171,15 @@ exit:
>
> void rtw_free_network_queue23a(struct rtw_adapter *padapter)
> {
> - struct list_head *phead, *plist, *ptmp;
> - struct wlan_network *pnetwork;
> + struct list_head *phead;
> + struct wlan_network *pnetwork, *ptmp;
> struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
> struct rtw_queue *scanned_queue = &pmlmepriv->scanned_queue;
>
> spin_lock_bh(&scanned_queue->lock);
> -
> phead = get_list_head(scanned_queue);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pnetwork = container_of(plist, struct wlan_network, list);
> -
> + list_for_each_entry_safe(pnetwork, ptmp, phead, list)
> _rtw_free_network23a(pmlmepriv, pnetwork);
> - }
> -
> spin_unlock_bh(&scanned_queue->lock);
> }
>
> @@ -329,15 +323,12 @@ int is_same_network23a(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst)
> struct wlan_network *
> rtw_get_oldest_wlan_network23a(struct rtw_queue *scanned_queue)
> {
> - struct list_head *plist, *phead;
> + struct list_head *phead;
> struct wlan_network *pwlan;
> struct wlan_network *oldest = NULL;
>
> phead = get_list_head(scanned_queue);
> -
> - list_for_each(plist, phead) {
> - pwlan = container_of(plist, struct wlan_network, list);
> -
> + list_for_each_entry(pwlan, phead, list) {
> if (pwlan->fixed != true) {
> if (!oldest || time_after(oldest->last_scanned,
> pwlan->last_scanned))
> @@ -445,7 +436,6 @@ static void rtw_update_scanned_network(struct rtw_adapter *adapter,
>
> spin_lock_bh(&queue->lock);
> phead = get_list_head(queue);
> -
> list_for_each(plist, phead) {
> pnetwork = container_of(plist, struct wlan_network, list);
>
> @@ -710,21 +700,17 @@ rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf)
>
> static void free_scanqueue(struct mlme_priv *pmlmepriv)
> {
> - struct wlan_network *pnetwork;
> + struct wlan_network *pnetwork, *ptemp;
> struct rtw_queue *scan_queue = &pmlmepriv->scanned_queue;
> - struct list_head *plist, *phead, *ptemp;
> + struct list_head *phead;
>
> RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, "+free_scanqueue\n");
> spin_lock_bh(&scan_queue->lock);
> -
> phead = get_list_head(scan_queue);
> -
> - list_for_each_safe(plist, ptemp, phead) {
> - pnetwork = container_of(plist, struct wlan_network, list);
> + list_for_each_entry_safe(pnetwork, ptemp, phead, list) {
> pnetwork->fixed = false;
> _rtw_free_network23a(pmlmepriv, pnetwork);
> }
> -
> spin_unlock_bh(&scan_queue->lock);
> }
>
> @@ -1625,15 +1611,13 @@ exit:
> static struct wlan_network *
> rtw_select_candidate_from_queue(struct mlme_priv *pmlmepriv)
> {
> - struct wlan_network *pnetwork, *candidate = NULL;
> + struct wlan_network *pnetwork, *ptmp, *candidate = NULL;
> struct rtw_queue *queue = &pmlmepriv->scanned_queue;
> - struct list_head *phead, *plist, *ptmp;
> + struct list_head *phead;
>
> spin_lock_bh(&pmlmepriv->scanned_queue.lock);
> phead = get_list_head(queue);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pnetwork = container_of(plist, struct wlan_network, list);
> + list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
> if (!pnetwork) {
> RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
> "%s: return _FAIL:(pnetwork == NULL)\n",
> diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
> index d28f29a..c392d22 100644
> --- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
> +++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
> @@ -6082,10 +6082,10 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
> #ifdef CONFIG_8723AU_AP_MODE
> else { /* tx bc/mc frames after update TIM */
> struct sta_info *psta_bmc;
> - struct list_head *plist, *phead, *ptmp;
> - struct xmit_frame *pxmitframe;
> + struct list_head *phead;
> + struct xmit_frame *pxmitframe, *tmp;
> struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
> - struct sta_priv *pstapriv = &padapter->stapriv;
> + struct sta_priv *pstapriv = &padapter->stapriv;
>
> /* for BC/MC Frames */
> psta_bmc = rtw_get_bcmc_stainfo23a(padapter);
> @@ -6096,14 +6096,8 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
> msleep(10);/* 10ms, ATIM(HIQ) Windows */
> /* spin_lock_bh(&psta_bmc->sleep_q.lock); */
> spin_lock_bh(&pxmitpriv->lock);
> -
> phead = get_list_head(&psta_bmc->sleep_q);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pxmitframe = container_of(plist,
> - struct xmit_frame,
> - list);
> -
> + list_for_each_entry_safe(pxmitframe, tmp, phead, list) {
> list_del_init(&pxmitframe->list);
>
> psta_bmc->sleepq_len--;
> @@ -6119,7 +6113,6 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
> rtl8723au_hal_xmitframe_enqueue(padapter,
> pxmitframe);
> }
> -
> /* spin_unlock_bh(&psta_bmc->sleep_q.lock); */
> spin_unlock_bh(&pxmitpriv->lock);
> }
> diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
> index 404b618..de1226e 100644
> --- a/drivers/staging/rtl8723au/core/rtw_recv.c
> +++ b/drivers/staging/rtl8723au/core/rtw_recv.c
> @@ -85,16 +85,16 @@ int _rtw_init_recv_priv23a(struct recv_priv *precvpriv,
> return res;
> }
>
> -void _rtw_free_recv_priv23a (struct recv_priv *precvpriv)
> +void _rtw_free_recv_priv23a(struct recv_priv *precvpriv)
> {
> struct rtw_adapter *padapter = precvpriv->adapter;
> - struct recv_frame *precvframe;
> - struct list_head *plist, *ptmp;
> + struct recv_frame *precvframe, *ptmp;
>
> rtw_free_uc_swdec_pending_queue23a(padapter);
>
> - list_for_each_safe(plist, ptmp, &precvpriv->free_recv_queue.queue) {
> - precvframe = container_of(plist, struct recv_frame, list);
> + list_for_each_entry_safe(precvframe, ptmp,
> + &precvpriv->free_recv_queue.queue,
> + list) {
> list_del_init(&precvframe->list);
> kfree(precvframe);
> }
> @@ -195,19 +195,13 @@ using spinlock to protect
>
> static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue)
> {
> - struct recv_frame *hdr;
> - struct list_head *plist, *phead, *ptmp;
> + struct recv_frame *hdr, *ptmp;
> + struct list_head *phead;
>
> spin_lock(&pframequeue->lock);
> -
> phead = get_list_head(pframequeue);
> - plist = phead->next;
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - hdr = container_of(plist, struct recv_frame, list);
> + list_for_each_entry_safe(hdr, ptmp, phead, list)
> rtw_free_recvframe23a(hdr);
> - }
> -
> spin_unlock(&pframequeue->lock);
> }
>
> @@ -1567,16 +1561,14 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
> struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
> struct rtw_queue *defrag_q)
> {
> - struct list_head *plist, *phead, *ptmp;
> - u8 *data, wlanhdr_offset;
> - u8 curfragnum;
> - struct recv_frame *pnfhdr;
> + struct list_head *plist, *phead;
> + u8 wlanhdr_offset;
> + u8 curfragnum;
> + struct recv_frame *pnfhdr, *ptmp;
> struct recv_frame *prframe, *pnextrframe;
> - struct rtw_queue *pfree_recv_queue;
> + struct rtw_queue *pfree_recv_queue;
> struct sk_buff *skb;
>
> -
> -
> curfragnum = 0;
> pfree_recv_queue = &adapter->recvpriv.free_recv_queue;
>
> @@ -1597,12 +1589,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
>
> curfragnum++;
>
> - phead = get_list_head(defrag_q);
> -
> - data = prframe->pkt->data;
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pnfhdr = container_of(plist, struct recv_frame, list);
> + list_for_each_entry_safe(pnfhdr, ptmp, phead, list) {
> pnextrframe = (struct recv_frame *)pnfhdr;
> /* check the fragment sequence (2nd ~n fragment frame) */
>
> @@ -1644,8 +1631,6 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
> RT_TRACE(_module_rtl871x_recv_c_, _drv_info_,
> "Performance defrag!!!!!\n");
>
> -
> -
> return prframe;
> }
>
> diff --git a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
> index b06bff7..22d857b 100644
> --- a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
> +++ b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
> @@ -83,8 +83,8 @@ int _rtw_init_sta_priv23a(struct sta_priv *pstapriv)
>
> int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
> {
> - struct list_head *phead, *plist, *ptmp;
> - struct sta_info *psta;
> + struct list_head *phead;
> + struct sta_info *psta, *ptmp;
> struct recv_reorder_ctrl *preorder_ctrl;
> int index;
>
> @@ -93,12 +93,9 @@ int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
> spin_lock_bh(&pstapriv->sta_hash_lock);
> for (index = 0; index < NUM_STA; index++) {
> phead = &pstapriv->sta_hash[index];
> -
> - list_for_each_safe(plist, ptmp, phead) {
> + list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
> int i;
>
> - psta = container_of(plist, struct sta_info,
> - hash_list);
> for (i = 0; i < 16 ; i++) {
> preorder_ctrl = &psta->recvreorder_ctrl[i];
> del_timer_sync(&preorder_ctrl->reordering_ctrl_timer);
> @@ -325,8 +322,8 @@ exit:
> /* free all stainfo which in sta_hash[all] */
> void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
> {
> - struct list_head *plist, *phead, *ptmp;
> - struct sta_info *psta;
> + struct list_head *phead;
> + struct sta_info *psta, *ptmp;
> struct sta_priv *pstapriv = &padapter->stapriv;
> struct sta_info *pbcmc_stainfo = rtw_get_bcmc_stainfo23a(padapter);
> s32 index;
> @@ -335,13 +332,9 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
> return;
>
> spin_lock_bh(&pstapriv->sta_hash_lock);
> -
> for (index = 0; index < NUM_STA; index++) {
> phead = &pstapriv->sta_hash[index];
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - psta = container_of(plist, struct sta_info, hash_list);
> -
> + list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
> if (pbcmc_stainfo != psta)
> rtw_free_stainfo23a(padapter, psta);
> }
> @@ -352,9 +345,9 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
> /* any station allocated can be searched by hash list */
> struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
> {
> - struct list_head *plist, *phead;
> + struct list_head *phead;
> struct sta_info *psta = NULL;
> - u32 index;
> + u32 index;
> const u8 *addr;
>
> if (hwaddr == NULL)
> @@ -368,12 +361,8 @@ struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
> index = wifi_mac_hash(addr);
>
> spin_lock_bh(&pstapriv->sta_hash_lock);
> -
> phead = &pstapriv->sta_hash[index];
> -
> - list_for_each(plist, phead) {
> - psta = container_of(plist, struct sta_info, hash_list);
> -
> + list_for_each_entry(psta, phead, hash_list) {
> /* if found the matched address */
> if (ether_addr_equal(psta->hwaddr, addr))
> break;
> @@ -418,7 +407,7 @@ bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
> {
> bool res = true;
> #ifdef CONFIG_8723AU_AP_MODE
> - struct list_head *plist, *phead;
> + struct list_head *phead;
> struct rtw_wlan_acl_node *paclnode;
> bool match = false;
> struct sta_priv *pstapriv = &padapter->stapriv;
> @@ -427,10 +416,7 @@ bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
>
> spin_lock_bh(&pacl_node_q->lock);
> phead = get_list_head(pacl_node_q);
> -
> - list_for_each(plist, phead) {
> - paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
> -
> + list_for_each_entry(paclnode, phead, list) {
> if (ether_addr_equal(paclnode->addr, mac_addr)) {
> if (paclnode->valid) {
> match = true;
> diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c
> index a4b6bb6..b82b182 100644
> --- a/drivers/staging/rtl8723au/core/rtw_xmit.c
> +++ b/drivers/staging/rtl8723au/core/rtw_xmit.c
> @@ -193,39 +193,38 @@ fail:
> goto exit;
> }
>
> -void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv)
> +void _rtw_free_xmit_priv23a(struct xmit_priv *pxmitpriv)
> {
> struct rtw_adapter *padapter = pxmitpriv->adapter;
> - struct xmit_frame *pxframe;
> - struct xmit_buf *pxmitbuf;
> - struct list_head *plist, *ptmp;
> + struct xmit_frame *pxframe, *ptmp;
> + struct xmit_buf *pxmitbuf, *ptmp2;
>
> - list_for_each_safe(plist, ptmp, &pxmitpriv->free_xmit_queue.queue) {
> - pxframe = container_of(plist, struct xmit_frame, list);
> + list_for_each_entry_safe(pxframe, ptmp,
> + &pxmitpriv->free_xmit_queue.queue, list) {
> list_del_init(&pxframe->list);
> rtw_os_xmit_complete23a(padapter, pxframe);
> kfree(pxframe);
> }
>
> - list_for_each_safe(plist, ptmp, &pxmitpriv->xmitbuf_list) {
> - pxmitbuf = container_of(plist, struct xmit_buf, list2);
> + list_for_each_entry_safe(pxmitbuf, ptmp2,
> + &pxmitpriv->xmitbuf_list, list2) {
> list_del_init(&pxmitbuf->list2);
> rtw_os_xmit_resource_free23a(padapter, pxmitbuf);
> kfree(pxmitbuf);
> }
>
> /* free xframe_ext queue, the same count as extbuf */
> - list_for_each_safe(plist, ptmp,
> - &pxmitpriv->free_xframe_ext_queue.queue) {
> - pxframe = container_of(plist, struct xmit_frame, list);
> + list_for_each_entry_safe(pxframe, ptmp,
> + &pxmitpriv->free_xframe_ext_queue.queue,
> + list) {
> list_del_init(&pxframe->list);
> rtw_os_xmit_complete23a(padapter, pxframe);
> kfree(pxframe);
> }
>
> /* free xmit extension buff */
> - list_for_each_safe(plist, ptmp, &pxmitpriv->xmitextbuf_list) {
> - pxmitbuf = container_of(plist, struct xmit_buf, list2);
> + list_for_each_entry_safe(pxmitbuf, ptmp2,
> + &pxmitpriv->xmitextbuf_list, list2) {
> list_del_init(&pxmitbuf->list2);
> rtw_os_xmit_resource_free23a(padapter, pxmitbuf);
> kfree(pxmitbuf);
> @@ -1563,18 +1562,13 @@ exit:
> void rtw_free_xmitframe_queue23a(struct xmit_priv *pxmitpriv,
> struct rtw_queue *pframequeue)
> {
> - struct list_head *plist, *phead, *ptmp;
> - struct xmit_frame *pxmitframe;
> + struct list_head *phead;
> + struct xmit_frame *pxmitframe, *ptmp;
>
> spin_lock_bh(&pframequeue->lock);
> -
> phead = get_list_head(pframequeue);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pxmitframe = container_of(plist, struct xmit_frame, list);
> -
> + list_for_each_entry_safe(pxmitframe, ptmp, phead, list)
> rtw_free_xmitframe23a(pxmitpriv, pxmitframe);
> - }
> spin_unlock_bh(&pframequeue->lock);
>
> }
> @@ -1612,9 +1606,9 @@ struct xmit_frame *
> rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i,
> int entry)
> {
> - struct list_head *sta_plist, *sta_phead, *ptmp;
> + struct list_head *sta_phead;
> struct hw_xmit *phwxmit;
> - struct tx_servq *ptxservq = NULL;
> + struct tx_servq *ptxservq = NULL, *ptmp;
> struct rtw_queue *pframe_queue = NULL;
> struct xmit_frame *pxmitframe = NULL;
> struct rtw_adapter *padapter = pxmitpriv->adapter;
> @@ -1638,11 +1632,8 @@ rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i,
> phwxmit = phwxmit_i + inx[i];
>
> sta_phead = get_list_head(phwxmit->sta_queue);
> -
> - list_for_each_safe(sta_plist, ptmp, sta_phead) {
> - ptxservq = container_of(sta_plist, struct tx_servq,
> - tx_pending);
> -
> + list_for_each_entry_safe(ptxservq, ptmp, sta_phead,
> + tx_pending) {
> pframe_queue = &ptxservq->sta_pending;
>
> pxmitframe = dequeue_one_xmitframe(pxmitpriv, phwxmit, ptxservq, pframe_queue);
> @@ -2052,18 +2043,15 @@ dequeue_xmitframes_to_sleeping_queue(struct rtw_adapter *padapter,
> struct rtw_queue *pframequeue)
> {
> int ret;
> - struct list_head *plist, *phead, *ptmp;
> - u8 ac_index;
> + struct list_head *phead;
> + u8 ac_index;
> struct tx_servq *ptxservq;
> - struct pkt_attrib *pattrib;
> - struct xmit_frame *pxmitframe;
> - struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
> + struct pkt_attrib *pattrib;
> + struct xmit_frame *pxmitframe, *ptmp;
> + struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
>
> phead = get_list_head(pframequeue);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pxmitframe = container_of(plist, struct xmit_frame, list);
> -
> + list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
> ret = xmitframe_enqueue_for_sleeping_sta23a(padapter, pxmitframe);
>
> if (ret == true) {
> @@ -2124,17 +2112,14 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
> {
> u8 update_mask = 0, wmmps_ac = 0;
> struct sta_info *psta_bmc;
> - struct list_head *plist, *phead, *ptmp;
> - struct xmit_frame *pxmitframe = NULL;
> + struct list_head *phead;
> + struct xmit_frame *pxmitframe = NULL, *ptmp;
> struct sta_priv *pstapriv = &padapter->stapriv;
> struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
>
> spin_lock_bh(&pxmitpriv->lock);
> -
> phead = get_list_head(&psta->sleep_q);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pxmitframe = container_of(plist, struct xmit_frame, list);
> + list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
> list_del_init(&pxmitframe->list);
>
> switch (pxmitframe->attrib.priority) {
> @@ -2194,7 +2179,6 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
>
> pstapriv->sta_dz_bitmap &= ~CHKBIT(psta->aid);
> }
> -
> /* spin_unlock_bh(&psta->sleep_q.lock); */
> spin_unlock_bh(&pxmitpriv->lock);
>
> @@ -2206,13 +2190,8 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
> if ((pstapriv->sta_dz_bitmap&0xfffe) == 0x0) {
> /* no any sta in ps mode */
> spin_lock_bh(&pxmitpriv->lock);
> -
> phead = get_list_head(&psta_bmc->sleep_q);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pxmitframe = container_of(plist, struct xmit_frame,
> - list);
> -
> + list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
> list_del_init(&pxmitframe->list);
>
> psta_bmc->sleepq_len--;
> @@ -2232,7 +2211,6 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
> /* update_BCNTIM(padapter); */
> update_mask |= BIT(1);
> }
> -
> /* spin_unlock_bh(&psta_bmc->sleep_q.lock); */
> spin_unlock_bh(&pxmitpriv->lock);
> }
> @@ -2245,19 +2223,15 @@ void xmit_delivery_enabled_frames23a(struct rtw_adapter *padapter,
> struct sta_info *psta)
> {
> u8 wmmps_ac = 0;
> - struct list_head *plist, *phead, *ptmp;
> - struct xmit_frame *pxmitframe;
> + struct list_head *phead;
> + struct xmit_frame *pxmitframe, *ptmp;
> struct sta_priv *pstapriv = &padapter->stapriv;
> struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
>
> /* spin_lock_bh(&psta->sleep_q.lock); */
> spin_lock_bh(&pxmitpriv->lock);
> -
> phead = get_list_head(&psta->sleep_q);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pxmitframe = container_of(plist, struct xmit_frame, list);
> -
> + list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
> switch (pxmitframe->attrib.priority) {
> case 1:
> case 2:
> diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
> index 0ae2180..908b84c 100644
> --- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
> +++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
> @@ -1270,18 +1270,14 @@ void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv,
>
> void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
> {
> - struct list_head *plist, *phead, *ptmp;
> + struct list_head *phead;
> struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
> struct rtw_queue *queue = &pmlmepriv->scanned_queue;
> - struct wlan_network *pnetwork;
> + struct wlan_network *pnetwork, *ptmp;
>
> spin_lock_bh(&pmlmepriv->scanned_queue.lock);
> -
> phead = get_list_head(queue);
> -
> - list_for_each_safe(plist, ptmp, phead) {
> - pnetwork = container_of(plist, struct wlan_network, list);
> -
> + list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
> /* report network only if the current channel set
> contains the channel to which this network belongs */
> if (rtw_ch_set_search_ch23a
> @@ -1289,7 +1285,6 @@ void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
> pnetwork->network.DSConfig) >= 0)
> rtw_cfg80211_inform_bss(padapter, pnetwork);
> }
> -
> spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
>
> /* call this after other things have been done */
> @@ -2850,9 +2845,9 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
> {
> const u8 *mac = params->mac;
> int ret = 0;
> - struct list_head *phead, *plist, *ptmp;
> + struct list_head *phead;
> u8 updated = 0;
> - struct sta_info *psta;
> + struct sta_info *psta, *ptmp;
> struct rtw_adapter *padapter = netdev_priv(ndev);
> struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
> struct sta_priv *pstapriv = &padapter->stapriv;
> @@ -2881,13 +2876,9 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
> return -EINVAL;
>
> spin_lock_bh(&pstapriv->asoc_list_lock);
> -
> phead = &pstapriv->asoc_list;
> -
> /* check asoc_queue */
> - list_for_each_safe(plist, ptmp, phead) {
> - psta = container_of(plist, struct sta_info, asoc_list);
> -
> + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
> if (ether_addr_equal(mac, psta->hwaddr)) {
> if (psta->dot8021xalg == 1 &&
> psta->bpairwise_key_installed == false) {
> @@ -2912,7 +2903,6 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
> }
> }
> }
> -
> spin_unlock_bh(&pstapriv->asoc_list_lock);
>
> associated_clients_update23a(padapter, updated);
> diff --git a/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c b/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
> index 0cdaef0..cf4a506 100644
> --- a/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
> +++ b/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
> @@ -210,22 +210,21 @@ exit:
> void rtl8723au_write_port_cancel(struct rtw_adapter *padapter)
> {
> struct xmit_buf *pxmitbuf;
> - struct list_head *plist;
> int j;
>
> DBG_8723A("%s\n", __func__);
>
> padapter->bWritePortCancel = true;
>
> - list_for_each(plist, &padapter->xmitpriv.xmitbuf_list) {
> - pxmitbuf = container_of(plist, struct xmit_buf, list2);
> + list_for_each_entry(pxmitbuf, &padapter->xmitpriv.xmitbuf_list,
> + list2) {
> for (j = 0; j < 8; j++) {
> if (pxmitbuf->pxmit_urb[j])
> usb_kill_urb(pxmitbuf->pxmit_urb[j]);
> }
> }
> - list_for_each(plist, &padapter->xmitpriv.xmitextbuf_list) {
> - pxmitbuf = container_of(plist, struct xmit_buf, list2);
> + list_for_each_entry(pxmitbuf, &padapter->xmitpriv.xmitextbuf_list,
> + list2) {
> for (j = 0; j < 8; j++) {
> if (pxmitbuf->pxmit_urb[j])
> usb_kill_urb(pxmitbuf->pxmit_urb[j]);
This patch set uses list_for_each_entry*() instead of
list_for_each*(), removes useless codes, and cleans
whitespaces and blank lines.
Changes in v4:
- revise the patchs as Jes suggested.
Changes in v3:
- split it into three patches.
Changes in v2:
- drop the coding style fixing in v1.
Geliang Tang (3):
staging: rtl8723au: use list_for_each_entry*()
staging: rtl8723au: core: rtw_recv: remove useless codes
staging: rtl8723au: whitespace and blank line cleaning
drivers/staging/rtl8723au/core/rtw_ap.c | 92 ++++++-----------------
drivers/staging/rtl8723au/core/rtw_mlme.c | 38 +++-------
drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 13 ++--
drivers/staging/rtl8723au/core/rtw_recv.c | 42 ++++-------
drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 36 +++------
drivers/staging/rtl8723au/core/rtw_xmit.c | 90 ++++++++--------------
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 22 ++----
drivers/staging/rtl8723au/os_dep/usb_ops_linux.c | 9 +--
8 files changed, 106 insertions(+), 236 deletions(-)
--
2.5.0
kbuild test robot <[email protected]> writes:
> Hi Geliang,
>
> [auto build test ERROR on staging/staging-testing]
> [also build test ERROR on v4.5-rc4 next-20160217]
> [if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
>
> url: https://github.com/0day-ci/linux/commits/Geliang-Tang/staging-rtl8723au-use-list_for_each_entry/20160217-220638
> config: i386-randconfig-s1-201607 (attached as .config)
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=i386
>
> Note: the linux-review/Geliang-Tang/staging-rtl8723au-use-list_for_each_entry/20160217-220638 HEAD 495811a52aba181af76c3baf57da3d81a79c2fe8 builds fine.
> It only hurts bisectibility.
>
> All errors (new ones prefixed by >>):
>
> drivers/staging/rtl8723au/core/rtw_recv.c: In function 'rtw_free_recvframe23a_queue':
>>> drivers/staging/rtl8723au/core/rtw_recv.c:203:2: error: 'plist' undeclared (first use in this function)
> plist = phead->next;
> ^
This doesn't work, you cannot break interim builds. Your patch 2 needs
to go before patch 1, and you must always check that they compile for
each patch you apply.
NACK
Jes
Geliang Tang <[email protected]> writes:
> There are some useless codes in rtw_free_recvframe23a_queue() and
> recvframe_defrag(), so remove them.
>
> Signed-off-by: Geliang Tang <[email protected]>
> ---
> Changes in v3:
> - split it into three patches.
> Changes in v2:
> - drop the coding style fixing in v1.
> ---
> drivers/staging/rtl8723au/core/rtw_recv.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
I assume this requires patch 1/3 applied first?
Acked-by: Jes Sorensen <[email protected]>
>
> diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
> index 18b7d03..b36bc6b 100644
> --- a/drivers/staging/rtl8723au/core/rtw_recv.c
> +++ b/drivers/staging/rtl8723au/core/rtw_recv.c
> @@ -201,7 +201,6 @@ static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue)
> spin_lock(&pframequeue->lock);
>
> phead = get_list_head(pframequeue);
> - plist = phead->next;
>
> list_for_each_entry_safe(hdr, ptmp, phead, list) {
> rtw_free_recvframe23a(hdr);
> @@ -1567,7 +1566,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
> struct rtw_queue *defrag_q)
> {
> struct list_head *plist, *phead;
> - u8 *data, wlanhdr_offset;
> + u8 wlanhdr_offset;
> u8 curfragnum;
> struct recv_frame *pnfhdr, *ptmp;
> struct recv_frame *prframe, *pnextrframe;
> @@ -1596,10 +1595,6 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
>
> curfragnum++;
>
> - phead = get_list_head(defrag_q);
> -
> - data = prframe->pkt->data;
> -
> list_for_each_entry_safe(pnfhdr, ptmp, phead, list) {
> pnextrframe = (struct recv_frame *)pnfhdr;
> /* check the fragment sequence (2nd ~n fragment frame) */
Use list_for_each_entry*() instead of list_for_each*() to simplify
the code.
Signed-off-by: Geliang Tang <[email protected]>
---
Changes in v2:
- drop the coding style fixing in v1.
---
drivers/staging/rtl8723au/core/rtw_ap.c | 92 ++++++-----------------
drivers/staging/rtl8723au/core/rtw_mlme.c | 38 +++-------
drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 15 +---
drivers/staging/rtl8723au/core/rtw_recv.c | 43 ++++-------
drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 36 +++------
drivers/staging/rtl8723au/core/rtw_xmit.c | 90 ++++++++--------------
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 22 ++----
drivers/staging/rtl8723au/os_dep/usb_ops_linux.c | 9 +--
8 files changed, 106 insertions(+), 239 deletions(-)
diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c
index 1aa9b26..ce4b589 100644
--- a/drivers/staging/rtl8723au/core/rtw_ap.c
+++ b/drivers/staging/rtl8723au/core/rtw_ap.c
@@ -171,24 +171,20 @@ static u8 chk_sta_is_alive(struct sta_info *psta)
return ret;
}
-void expire_timeout_chk23a(struct rtw_adapter *padapter)
+void expire_timeout_chk23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
u8 updated = 0;
- struct sta_info *psta;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
u8 chk_alive_num = 0;
struct sta_info *chk_alive_list[NUM_STA];
int i;
spin_lock_bh(&pstapriv->auth_list_lock);
-
phead = &pstapriv->auth_list;
-
/* check auth_queue */
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, auth_list);
-
+ list_for_each_entry_safe(psta, ptmp, phead, auth_list) {
if (psta->expire_to > 0) {
psta->expire_to--;
if (psta->expire_to == 0) {
@@ -206,19 +202,13 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
spin_lock_bh(&pstapriv->auth_list_lock);
}
}
-
}
-
spin_unlock_bh(&pstapriv->auth_list_lock);
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
/* check asoc_queue */
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
-
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
if (chk_sta_is_alive(psta) || !psta->expire_to) {
psta->expire_to = pstapriv->expire_to;
psta->keep_alive_trycnt = 0;
@@ -283,7 +273,6 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
}
}
}
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
if (chk_alive_num) {
@@ -1059,7 +1048,7 @@ void rtw_set_macaddr_acl23a(struct rtw_adapter *padapter, int mode)
int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
{
- struct list_head *plist, *phead;
+ struct list_head *phead;
u8 added = false;
int i, ret = 0;
struct rtw_wlan_acl_node *paclnode;
@@ -1073,12 +1062,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
return -1;
spin_lock_bh(&pacl_node_q->lock);
-
phead = get_list_head(pacl_node_q);
-
- list_for_each(plist, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
-
+ list_for_each_entry(paclnode, phead, list) {
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid == true) {
added = true;
@@ -1087,7 +1072,6 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
}
}
}
-
spin_unlock_bh(&pacl_node_q->lock);
if (added)
@@ -1121,8 +1105,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
{
- struct list_head *plist, *phead, *ptmp;
- struct rtw_wlan_acl_node *paclnode;
+ struct list_head *phead;
+ struct rtw_wlan_acl_node *paclnode, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
struct rtw_queue *pacl_node_q = &pacl_list->acl_node_q;
@@ -1130,12 +1114,8 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
DBG_8723A("%s(acl_num =%d) = %pM\n", __func__, pacl_list->num, addr);
spin_lock_bh(&pacl_node_q->lock);
-
phead = get_list_head(pacl_node_q);
-
- list_for_each_safe(plist, ptmp, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
-
+ list_for_each_entry_safe(paclnode, ptmp, phead, list) {
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid) {
paclnode->valid = false;
@@ -1146,7 +1126,6 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
}
}
}
-
spin_unlock_bh(&pacl_node_q->lock);
DBG_8723A("%s, acl_num =%d\n", __func__, pacl_list->num);
@@ -1354,20 +1333,14 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated)
{
/* update associated stations cap. */
if (updated == true) {
- struct list_head *phead, *plist, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
-
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
VCS_update23a(padapter, psta);
- }
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
}
}
@@ -1627,7 +1600,7 @@ u8 ap_free_sta23a(struct rtw_adapter *padapter, struct sta_info *psta, bool acti
int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_offset)
{
- struct list_head *phead, *plist;
+ struct list_head *phead;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@@ -1642,10 +1615,7 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
-
- list_for_each(plist, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
-
+ list_for_each_entry(psta, phead, asoc_list) {
issue_action_spct_ch_switch23a(padapter, psta->hwaddr, new_ch, ch_offset);
psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2);
}
@@ -1658,8 +1628,8 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of
int rtw_sta_flush23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
@@ -1675,10 +1645,7 @@ int rtw_sta_flush23a(struct rtw_adapter *padapter)
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
-
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
-
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
/* Remove sta from asoc_list */
list_del_init(&psta->asoc_list);
pstapriv->asoc_list_cnt--;
@@ -1744,9 +1711,9 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
struct mlme_priv *mlmepriv = &padapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct sta_priv *pstapriv = &padapter->stapriv;
- struct sta_info *psta;
+ struct sta_info *psta, *ptmp;
struct security_priv *psecuritypriv = &padapter->securitypriv;
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
u8 chk_alive_num = 0;
struct sta_info *chk_alive_list[NUM_STA];
int i;
@@ -1775,15 +1742,9 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
}
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
-
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
chk_alive_list[chk_alive_num++] = psta;
- }
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
for (i = 0; i < chk_alive_num; i++) {
@@ -1841,8 +1802,8 @@ void start_ap_mode23a(struct rtw_adapter *padapter)
void stop_ap_mode23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
- struct rtw_wlan_acl_node *paclnode;
+ struct list_head *phead;
+ struct rtw_wlan_acl_node *paclnode, *ptmp;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -1864,15 +1825,10 @@ void stop_ap_mode23a(struct rtw_adapter *padapter)
/* for ACL */
spin_lock_bh(&pacl_node_q->lock);
phead = get_list_head(pacl_node_q);
-
- list_for_each_safe(plist, ptmp, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
-
+ list_for_each_entry_safe(paclnode, ptmp, phead, list) {
if (paclnode->valid == true) {
paclnode->valid = false;
-
list_del_init(&paclnode->list);
-
pacl_list->num--;
}
}
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 3c09ea9..3adda55 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -171,21 +171,15 @@ exit:
void rtw_free_network_queue23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
- struct wlan_network *pnetwork;
+ struct list_head *phead;
+ struct wlan_network *pnetwork, *ptmp;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct rtw_queue *scanned_queue = &pmlmepriv->scanned_queue;
spin_lock_bh(&scanned_queue->lock);
-
phead = get_list_head(scanned_queue);
-
- list_for_each_safe(plist, ptmp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
-
+ list_for_each_entry_safe(pnetwork, ptmp, phead, list)
_rtw_free_network23a(pmlmepriv, pnetwork);
- }
-
spin_unlock_bh(&scanned_queue->lock);
}
@@ -329,15 +323,12 @@ int is_same_network23a(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst)
struct wlan_network *
rtw_get_oldest_wlan_network23a(struct rtw_queue *scanned_queue)
{
- struct list_head *plist, *phead;
+ struct list_head *phead;
struct wlan_network *pwlan;
struct wlan_network *oldest = NULL;
phead = get_list_head(scanned_queue);
-
- list_for_each(plist, phead) {
- pwlan = container_of(plist, struct wlan_network, list);
-
+ list_for_each_entry(pwlan, phead, list) {
if (pwlan->fixed != true) {
if (!oldest || time_after(oldest->last_scanned,
pwlan->last_scanned))
@@ -445,7 +436,6 @@ static void rtw_update_scanned_network(struct rtw_adapter *adapter,
spin_lock_bh(&queue->lock);
phead = get_list_head(queue);
-
list_for_each(plist, phead) {
pnetwork = container_of(plist, struct wlan_network, list);
@@ -710,21 +700,17 @@ rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf)
static void free_scanqueue(struct mlme_priv *pmlmepriv)
{
- struct wlan_network *pnetwork;
+ struct wlan_network *pnetwork, *ptemp;
struct rtw_queue *scan_queue = &pmlmepriv->scanned_queue;
- struct list_head *plist, *phead, *ptemp;
+ struct list_head *phead;
RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, "+free_scanqueue\n");
spin_lock_bh(&scan_queue->lock);
-
phead = get_list_head(scan_queue);
-
- list_for_each_safe(plist, ptemp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
+ list_for_each_entry_safe(pnetwork, ptemp, phead, list) {
pnetwork->fixed = false;
_rtw_free_network23a(pmlmepriv, pnetwork);
}
-
spin_unlock_bh(&scan_queue->lock);
}
@@ -1625,15 +1611,13 @@ exit:
static struct wlan_network *
rtw_select_candidate_from_queue(struct mlme_priv *pmlmepriv)
{
- struct wlan_network *pnetwork, *candidate = NULL;
+ struct wlan_network *pnetwork, *ptmp, *candidate = NULL;
struct rtw_queue *queue = &pmlmepriv->scanned_queue;
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
phead = get_list_head(queue);
-
- list_for_each_safe(plist, ptmp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
+ list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
if (!pnetwork) {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
"%s: return _FAIL:(pnetwork == NULL)\n",
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index d28f29a..c392d22 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -6082,10 +6082,10 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
#ifdef CONFIG_8723AU_AP_MODE
else { /* tx bc/mc frames after update TIM */
struct sta_info *psta_bmc;
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe, *tmp;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
- struct sta_priv *pstapriv = &padapter->stapriv;
+ struct sta_priv *pstapriv = &padapter->stapriv;
/* for BC/MC Frames */
psta_bmc = rtw_get_bcmc_stainfo23a(padapter);
@@ -6096,14 +6096,8 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
msleep(10);/* 10ms, ATIM(HIQ) Windows */
/* spin_lock_bh(&psta_bmc->sleep_q.lock); */
spin_lock_bh(&pxmitpriv->lock);
-
phead = get_list_head(&psta_bmc->sleep_q);
-
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist,
- struct xmit_frame,
- list);
-
+ list_for_each_entry_safe(pxmitframe, tmp, phead, list) {
list_del_init(&pxmitframe->list);
psta_bmc->sleepq_len--;
@@ -6119,7 +6113,6 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
rtl8723au_hal_xmitframe_enqueue(padapter,
pxmitframe);
}
-
/* spin_unlock_bh(&psta_bmc->sleep_q.lock); */
spin_unlock_bh(&pxmitpriv->lock);
}
diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
index 404b618..de1226e 100644
--- a/drivers/staging/rtl8723au/core/rtw_recv.c
+++ b/drivers/staging/rtl8723au/core/rtw_recv.c
@@ -85,16 +85,16 @@ int _rtw_init_recv_priv23a(struct recv_priv *precvpriv,
return res;
}
-void _rtw_free_recv_priv23a (struct recv_priv *precvpriv)
+void _rtw_free_recv_priv23a(struct recv_priv *precvpriv)
{
struct rtw_adapter *padapter = precvpriv->adapter;
- struct recv_frame *precvframe;
- struct list_head *plist, *ptmp;
+ struct recv_frame *precvframe, *ptmp;
rtw_free_uc_swdec_pending_queue23a(padapter);
- list_for_each_safe(plist, ptmp, &precvpriv->free_recv_queue.queue) {
- precvframe = container_of(plist, struct recv_frame, list);
+ list_for_each_entry_safe(precvframe, ptmp,
+ &precvpriv->free_recv_queue.queue,
+ list) {
list_del_init(&precvframe->list);
kfree(precvframe);
}
@@ -195,19 +195,13 @@ using spinlock to protect
static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue)
{
- struct recv_frame *hdr;
- struct list_head *plist, *phead, *ptmp;
+ struct recv_frame *hdr, *ptmp;
+ struct list_head *phead;
spin_lock(&pframequeue->lock);
-
phead = get_list_head(pframequeue);
- plist = phead->next;
-
- list_for_each_safe(plist, ptmp, phead) {
- hdr = container_of(plist, struct recv_frame, list);
+ list_for_each_entry_safe(hdr, ptmp, phead, list)
rtw_free_recvframe23a(hdr);
- }
-
spin_unlock(&pframequeue->lock);
}
@@ -1567,16 +1561,14 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
struct rtw_queue *defrag_q)
{
- struct list_head *plist, *phead, *ptmp;
- u8 *data, wlanhdr_offset;
- u8 curfragnum;
- struct recv_frame *pnfhdr;
+ struct list_head *plist, *phead;
+ u8 wlanhdr_offset;
+ u8 curfragnum;
+ struct recv_frame *pnfhdr, *ptmp;
struct recv_frame *prframe, *pnextrframe;
- struct rtw_queue *pfree_recv_queue;
+ struct rtw_queue *pfree_recv_queue;
struct sk_buff *skb;
-
-
curfragnum = 0;
pfree_recv_queue = &adapter->recvpriv.free_recv_queue;
@@ -1597,12 +1589,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
curfragnum++;
- phead = get_list_head(defrag_q);
-
- data = prframe->pkt->data;
-
- list_for_each_safe(plist, ptmp, phead) {
- pnfhdr = container_of(plist, struct recv_frame, list);
+ list_for_each_entry_safe(pnfhdr, ptmp, phead, list) {
pnextrframe = (struct recv_frame *)pnfhdr;
/* check the fragment sequence (2nd ~n fragment frame) */
@@ -1644,8 +1631,6 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_,
"Performance defrag!!!!!\n");
-
-
return prframe;
}
diff --git a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
index b06bff7..22d857b 100644
--- a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
@@ -83,8 +83,8 @@ int _rtw_init_sta_priv23a(struct sta_priv *pstapriv)
int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
{
- struct list_head *phead, *plist, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct recv_reorder_ctrl *preorder_ctrl;
int index;
@@ -93,12 +93,9 @@ int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
spin_lock_bh(&pstapriv->sta_hash_lock);
for (index = 0; index < NUM_STA; index++) {
phead = &pstapriv->sta_hash[index];
-
- list_for_each_safe(plist, ptmp, phead) {
+ list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
int i;
- psta = container_of(plist, struct sta_info,
- hash_list);
for (i = 0; i < 16 ; i++) {
preorder_ctrl = &psta->recvreorder_ctrl[i];
del_timer_sync(&preorder_ctrl->reordering_ctrl_timer);
@@ -325,8 +322,8 @@ exit:
/* free all stainfo which in sta_hash[all] */
void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
{
- struct list_head *plist, *phead, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct sta_info *pbcmc_stainfo = rtw_get_bcmc_stainfo23a(padapter);
s32 index;
@@ -335,13 +332,9 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
return;
spin_lock_bh(&pstapriv->sta_hash_lock);
-
for (index = 0; index < NUM_STA; index++) {
phead = &pstapriv->sta_hash[index];
-
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, hash_list);
-
+ list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
if (pbcmc_stainfo != psta)
rtw_free_stainfo23a(padapter, psta);
}
@@ -352,9 +345,9 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
/* any station allocated can be searched by hash list */
struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
{
- struct list_head *plist, *phead;
+ struct list_head *phead;
struct sta_info *psta = NULL;
- u32 index;
+ u32 index;
const u8 *addr;
if (hwaddr == NULL)
@@ -368,12 +361,8 @@ struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
index = wifi_mac_hash(addr);
spin_lock_bh(&pstapriv->sta_hash_lock);
-
phead = &pstapriv->sta_hash[index];
-
- list_for_each(plist, phead) {
- psta = container_of(plist, struct sta_info, hash_list);
-
+ list_for_each_entry(psta, phead, hash_list) {
/* if found the matched address */
if (ether_addr_equal(psta->hwaddr, addr))
break;
@@ -418,7 +407,7 @@ bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
{
bool res = true;
#ifdef CONFIG_8723AU_AP_MODE
- struct list_head *plist, *phead;
+ struct list_head *phead;
struct rtw_wlan_acl_node *paclnode;
bool match = false;
struct sta_priv *pstapriv = &padapter->stapriv;
@@ -427,10 +416,7 @@ bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
spin_lock_bh(&pacl_node_q->lock);
phead = get_list_head(pacl_node_q);
-
- list_for_each(plist, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
-
+ list_for_each_entry(paclnode, phead, list) {
if (ether_addr_equal(paclnode->addr, mac_addr)) {
if (paclnode->valid) {
match = true;
diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c
index a4b6bb6..b82b182 100644
--- a/drivers/staging/rtl8723au/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723au/core/rtw_xmit.c
@@ -193,39 +193,38 @@ fail:
goto exit;
}
-void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv)
+void _rtw_free_xmit_priv23a(struct xmit_priv *pxmitpriv)
{
struct rtw_adapter *padapter = pxmitpriv->adapter;
- struct xmit_frame *pxframe;
- struct xmit_buf *pxmitbuf;
- struct list_head *plist, *ptmp;
+ struct xmit_frame *pxframe, *ptmp;
+ struct xmit_buf *pxmitbuf, *ptmp2;
- list_for_each_safe(plist, ptmp, &pxmitpriv->free_xmit_queue.queue) {
- pxframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxframe, ptmp,
+ &pxmitpriv->free_xmit_queue.queue, list) {
list_del_init(&pxframe->list);
rtw_os_xmit_complete23a(padapter, pxframe);
kfree(pxframe);
}
- list_for_each_safe(plist, ptmp, &pxmitpriv->xmitbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry_safe(pxmitbuf, ptmp2,
+ &pxmitpriv->xmitbuf_list, list2) {
list_del_init(&pxmitbuf->list2);
rtw_os_xmit_resource_free23a(padapter, pxmitbuf);
kfree(pxmitbuf);
}
/* free xframe_ext queue, the same count as extbuf */
- list_for_each_safe(plist, ptmp,
- &pxmitpriv->free_xframe_ext_queue.queue) {
- pxframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxframe, ptmp,
+ &pxmitpriv->free_xframe_ext_queue.queue,
+ list) {
list_del_init(&pxframe->list);
rtw_os_xmit_complete23a(padapter, pxframe);
kfree(pxframe);
}
/* free xmit extension buff */
- list_for_each_safe(plist, ptmp, &pxmitpriv->xmitextbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry_safe(pxmitbuf, ptmp2,
+ &pxmitpriv->xmitextbuf_list, list2) {
list_del_init(&pxmitbuf->list2);
rtw_os_xmit_resource_free23a(padapter, pxmitbuf);
kfree(pxmitbuf);
@@ -1563,18 +1562,13 @@ exit:
void rtw_free_xmitframe_queue23a(struct xmit_priv *pxmitpriv,
struct rtw_queue *pframequeue)
{
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe, *ptmp;
spin_lock_bh(&pframequeue->lock);
-
phead = get_list_head(pframequeue);
-
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
-
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list)
rtw_free_xmitframe23a(pxmitpriv, pxmitframe);
- }
spin_unlock_bh(&pframequeue->lock);
}
@@ -1612,9 +1606,9 @@ struct xmit_frame *
rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i,
int entry)
{
- struct list_head *sta_plist, *sta_phead, *ptmp;
+ struct list_head *sta_phead;
struct hw_xmit *phwxmit;
- struct tx_servq *ptxservq = NULL;
+ struct tx_servq *ptxservq = NULL, *ptmp;
struct rtw_queue *pframe_queue = NULL;
struct xmit_frame *pxmitframe = NULL;
struct rtw_adapter *padapter = pxmitpriv->adapter;
@@ -1638,11 +1632,8 @@ rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i,
phwxmit = phwxmit_i + inx[i];
sta_phead = get_list_head(phwxmit->sta_queue);
-
- list_for_each_safe(sta_plist, ptmp, sta_phead) {
- ptxservq = container_of(sta_plist, struct tx_servq,
- tx_pending);
-
+ list_for_each_entry_safe(ptxservq, ptmp, sta_phead,
+ tx_pending) {
pframe_queue = &ptxservq->sta_pending;
pxmitframe = dequeue_one_xmitframe(pxmitpriv, phwxmit, ptxservq, pframe_queue);
@@ -2052,18 +2043,15 @@ dequeue_xmitframes_to_sleeping_queue(struct rtw_adapter *padapter,
struct rtw_queue *pframequeue)
{
int ret;
- struct list_head *plist, *phead, *ptmp;
- u8 ac_index;
+ struct list_head *phead;
+ u8 ac_index;
struct tx_servq *ptxservq;
- struct pkt_attrib *pattrib;
- struct xmit_frame *pxmitframe;
- struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
+ struct pkt_attrib *pattrib;
+ struct xmit_frame *pxmitframe, *ptmp;
+ struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
phead = get_list_head(pframequeue);
-
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
-
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
ret = xmitframe_enqueue_for_sleeping_sta23a(padapter, pxmitframe);
if (ret == true) {
@@ -2124,17 +2112,14 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
{
u8 update_mask = 0, wmmps_ac = 0;
struct sta_info *psta_bmc;
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe = NULL;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe = NULL, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
spin_lock_bh(&pxmitpriv->lock);
-
phead = get_list_head(&psta->sleep_q);
-
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
list_del_init(&pxmitframe->list);
switch (pxmitframe->attrib.priority) {
@@ -2194,7 +2179,6 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
pstapriv->sta_dz_bitmap &= ~CHKBIT(psta->aid);
}
-
/* spin_unlock_bh(&psta->sleep_q.lock); */
spin_unlock_bh(&pxmitpriv->lock);
@@ -2206,13 +2190,8 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
if ((pstapriv->sta_dz_bitmap&0xfffe) == 0x0) {
/* no any sta in ps mode */
spin_lock_bh(&pxmitpriv->lock);
-
phead = get_list_head(&psta_bmc->sleep_q);
-
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame,
- list);
-
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
list_del_init(&pxmitframe->list);
psta_bmc->sleepq_len--;
@@ -2232,7 +2211,6 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
/* update_BCNTIM(padapter); */
update_mask |= BIT(1);
}
-
/* spin_unlock_bh(&psta_bmc->sleep_q.lock); */
spin_unlock_bh(&pxmitpriv->lock);
}
@@ -2245,19 +2223,15 @@ void xmit_delivery_enabled_frames23a(struct rtw_adapter *padapter,
struct sta_info *psta)
{
u8 wmmps_ac = 0;
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
/* spin_lock_bh(&psta->sleep_q.lock); */
spin_lock_bh(&pxmitpriv->lock);
-
phead = get_list_head(&psta->sleep_q);
-
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
-
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
switch (pxmitframe->attrib.priority) {
case 1:
case 2:
diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 0ae2180..908b84c 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -1270,18 +1270,14 @@ void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv,
void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
{
- struct list_head *plist, *phead, *ptmp;
+ struct list_head *phead;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct rtw_queue *queue = &pmlmepriv->scanned_queue;
- struct wlan_network *pnetwork;
+ struct wlan_network *pnetwork, *ptmp;
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
-
phead = get_list_head(queue);
-
- list_for_each_safe(plist, ptmp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
-
+ list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
/* report network only if the current channel set
contains the channel to which this network belongs */
if (rtw_ch_set_search_ch23a
@@ -1289,7 +1285,6 @@ void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
pnetwork->network.DSConfig) >= 0)
rtw_cfg80211_inform_bss(padapter, pnetwork);
}
-
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
/* call this after other things have been done */
@@ -2850,9 +2845,9 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
{
const u8 *mac = params->mac;
int ret = 0;
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
u8 updated = 0;
- struct sta_info *psta;
+ struct sta_info *psta, *ptmp;
struct rtw_adapter *padapter = netdev_priv(ndev);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct sta_priv *pstapriv = &padapter->stapriv;
@@ -2881,13 +2876,9 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
return -EINVAL;
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
/* check asoc_queue */
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
-
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
if (ether_addr_equal(mac, psta->hwaddr)) {
if (psta->dot8021xalg == 1 &&
psta->bpairwise_key_installed == false) {
@@ -2912,7 +2903,6 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
}
}
}
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
associated_clients_update23a(padapter, updated);
diff --git a/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c b/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
index 0cdaef0..cf4a506 100644
--- a/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
@@ -210,22 +210,21 @@ exit:
void rtl8723au_write_port_cancel(struct rtw_adapter *padapter)
{
struct xmit_buf *pxmitbuf;
- struct list_head *plist;
int j;
DBG_8723A("%s\n", __func__);
padapter->bWritePortCancel = true;
- list_for_each(plist, &padapter->xmitpriv.xmitbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry(pxmitbuf, &padapter->xmitpriv.xmitbuf_list,
+ list2) {
for (j = 0; j < 8; j++) {
if (pxmitbuf->pxmit_urb[j])
usb_kill_urb(pxmitbuf->pxmit_urb[j]);
}
}
- list_for_each(plist, &padapter->xmitpriv.xmitextbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry(pxmitbuf, &padapter->xmitpriv.xmitextbuf_list,
+ list2) {
for (j = 0; j < 8; j++) {
if (pxmitbuf->pxmit_urb[j])
usb_kill_urb(pxmitbuf->pxmit_urb[j]);
--
2.5.0
There are some useless codes in rtw_free_recvframe23a_queue() and
recvframe_defrag(), so remove them.
Signed-off-by: Geliang Tang <[email protected]>
Acked-by: Jes Sorensen <[email protected]>
---
drivers/staging/rtl8723au/core/rtw_recv.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
index 0b4593c..d1e0f65 100644
--- a/drivers/staging/rtl8723au/core/rtw_recv.c
+++ b/drivers/staging/rtl8723au/core/rtw_recv.c
@@ -195,12 +195,11 @@ using spinlock to protect
static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue)
{
struct recv_frame *hdr, *ptmp;
- struct list_head *plist, *phead;
+ struct list_head *phead;
spin_lock(&pframequeue->lock);
phead = get_list_head(pframequeue);
- plist = phead->next;
list_for_each_entry_safe(hdr, ptmp, phead, list)
rtw_free_recvframe23a(hdr);
@@ -1547,7 +1546,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
struct rtw_queue *defrag_q)
{
struct list_head *plist, *phead;
- u8 *data, wlanhdr_offset;
+ u8 wlanhdr_offset;
u8 curfragnum;
struct recv_frame *pnfhdr, *ptmp;
struct recv_frame *prframe, *pnextrframe;
@@ -1576,10 +1575,6 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
curfragnum++;
- phead = get_list_head(defrag_q);
-
- data = prframe->pkt->data;
-
list_for_each_entry_safe(pnfhdr, ptmp, phead, list) {
pnextrframe = (struct recv_frame *)pnfhdr;
/* check the fragment sequence (2nd ~n fragment frame) */
--
2.5.0
There are some useless codes in rtw_free_recvframe23a_queue() and
recvframe_defrag(), so remove them.
Signed-off-by: Geliang Tang <[email protected]>
---
Changes in v3:
- split it into three patches.
Changes in v2:
- drop the coding style fixing in v1.
---
drivers/staging/rtl8723au/core/rtw_recv.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
index 18b7d03..b36bc6b 100644
--- a/drivers/staging/rtl8723au/core/rtw_recv.c
+++ b/drivers/staging/rtl8723au/core/rtw_recv.c
@@ -201,7 +201,6 @@ static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue)
spin_lock(&pframequeue->lock);
phead = get_list_head(pframequeue);
- plist = phead->next;
list_for_each_entry_safe(hdr, ptmp, phead, list) {
rtw_free_recvframe23a(hdr);
@@ -1567,7 +1566,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
struct rtw_queue *defrag_q)
{
struct list_head *plist, *phead;
- u8 *data, wlanhdr_offset;
+ u8 wlanhdr_offset;
u8 curfragnum;
struct recv_frame *pnfhdr, *ptmp;
struct recv_frame *prframe, *pnextrframe;
@@ -1596,10 +1595,6 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
curfragnum++;
- phead = get_list_head(defrag_q);
-
- data = prframe->pkt->data;
-
list_for_each_entry_safe(pnfhdr, ptmp, phead, list) {
pnextrframe = (struct recv_frame *)pnfhdr;
/* check the fragment sequence (2nd ~n fragment frame) */
--
2.5.0
Hi Geliang,
[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.5-rc4 next-20160217]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Geliang-Tang/staging-rtl8723au-use-list_for_each_entry/20160217-220638
config: i386-randconfig-s1-201607 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
Note: the linux-review/Geliang-Tang/staging-rtl8723au-use-list_for_each_entry/20160217-220638 HEAD 495811a52aba181af76c3baf57da3d81a79c2fe8 builds fine.
It only hurts bisectibility.
All errors (new ones prefixed by >>):
drivers/staging/rtl8723au/core/rtw_recv.c: In function 'rtw_free_recvframe23a_queue':
>> drivers/staging/rtl8723au/core/rtw_recv.c:203:2: error: 'plist' undeclared (first use in this function)
plist = phead->next;
^
drivers/staging/rtl8723au/core/rtw_recv.c:203:2: note: each undeclared identifier is reported only once for each function it appears in
vim +/plist +203 drivers/staging/rtl8723au/core/rtw_recv.c
3437e0c7 Geliang Tang 2016-02-17 197 struct recv_frame *hdr, *ptmp;
3437e0c7 Geliang Tang 2016-02-17 198 struct list_head *phead;
5e93f352 Larry Finger 2014-03-28 199
5e93f352 Larry Finger 2014-03-28 200 spin_lock(&pframequeue->lock);
5e93f352 Larry Finger 2014-03-28 201
5e93f352 Larry Finger 2014-03-28 202 phead = get_list_head(pframequeue);
5e93f352 Larry Finger 2014-03-28 @203 plist = phead->next;
5e93f352 Larry Finger 2014-03-28 204
3437e0c7 Geliang Tang 2016-02-17 205 list_for_each_entry_safe(hdr, ptmp, phead, list)
c5779a0d Jes Sorensen 2014-05-09 206 rtw_free_recvframe23a(hdr);
:::::: The code at line 203 was first introduced by commit
:::::: 5e93f35209578fcabfa855e427354195e54b491f staging: r8723au: Add source files for new driver - part 1
:::::: TO: Larry Finger <[email protected]>
:::::: CC: Greg Kroah-Hartman <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Geliang Tang <[email protected]> writes:
> Use list_for_each_entry*() instead of list_for_each*() to simplify
> the code.
>
> Signed-off-by: Geliang Tang <[email protected]>
> ---
> Changes in v3:
> - split it into three patches.
> Changes in v2:
> - drop the coding style fixing in v1.
> ---
> drivers/staging/rtl8723au/core/rtw_ap.c | 55 ++++++++-----------
> drivers/staging/rtl8723au/core/rtw_mlme.c | 26 ++++-----
> drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 10 ++--
> drivers/staging/rtl8723au/core/rtw_recv.c | 22 ++++----
> drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 25 ++++-----
> drivers/staging/rtl8723au/core/rtw_xmit.c | 64 ++++++++++-------------
> drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 14 +++--
> drivers/staging/rtl8723au/os_dep/usb_ops_linux.c | 9 ++--
> 8 files changed, 96 insertions(+), 129 deletions(-)
This one is mostly OK, however when you do multi patch sets, always
include a cover letter describing the overall changes of the set.
A few nit picks:
> diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
> index 404b618..18b7d03 100644
> --- a/drivers/staging/rtl8723au/core/rtw_recv.c
> +++ b/drivers/staging/rtl8723au/core/rtw_recv.c
> @@ -88,13 +88,13 @@ int _rtw_init_recv_priv23a(struct recv_priv *precvpriv,
> void _rtw_free_recv_priv23a (struct recv_priv *precvpriv)
> {
> struct rtw_adapter *padapter = precvpriv->adapter;
> - struct recv_frame *precvframe;
> - struct list_head *plist, *ptmp;
> + struct recv_frame *precvframe, *ptmp;
>
> rtw_free_uc_swdec_pending_queue23a(padapter);
>
> - list_for_each_safe(plist, ptmp, &precvpriv->free_recv_queue.queue) {
> - precvframe = container_of(plist, struct recv_frame, list);
> + list_for_each_entry_safe(precvframe, ptmp,
> + &precvpriv->free_recv_queue.queue,
> + list) {
> list_del_init(&precvframe->list);
> kfree(precvframe);
> }
Too aggressive line breaking, the 'list' fits within 80 characters on
the line above.
> @@ -195,16 +195,15 @@ using spinlock to protect
>
> static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue)
> {
> - struct recv_frame *hdr;
> - struct list_head *plist, *phead, *ptmp;
> + struct recv_frame *hdr, *ptmp;
> + struct list_head *phead;
>
> spin_lock(&pframequeue->lock);
>
> phead = get_list_head(pframequeue);
> plist = phead->next;
>
> - list_for_each_safe(plist, ptmp, phead) {
> - hdr = container_of(plist, struct recv_frame, list);
> + list_for_each_entry_safe(hdr, ptmp, phead, list) {
> rtw_free_recvframe23a(hdr);
> }
>
You could remove the brackets here, since you are fixing that specific
line. I am fine with this as is, some of the checkpatch police force
might bite over it.
On overall this patch is a lot better than the first version.
All set and done, I am thinking of removing this driver once Kalle pulls
in my currently posted set of changes for rtl8xxxu, plus the next one I
have lined up. I seems to me rtl8xxxu can replace rtl8723au at this
point.
I will probably mark rtl8723au deprecated after 4.6 comes out, and
remove the driver around 4.7.
Cheers,
Jes
On Wed, Feb 17, 2016 at 12:28:33PM -0500, Jes Sorensen wrote:
> kbuild test robot <[email protected]> writes:
> > Hi Geliang,
> >
> > [auto build test ERROR on staging/staging-testing]
> > [also build test ERROR on v4.5-rc4 next-20160217]
> > [if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
> >
> > url: https://github.com/0day-ci/linux/commits/Geliang-Tang/staging-rtl8723au-use-list_for_each_entry/20160217-220638
> > config: i386-randconfig-s1-201607 (attached as .config)
> > reproduce:
> > # save the attached .config to linux build tree
> > make ARCH=i386
> >
> > Note: the linux-review/Geliang-Tang/staging-rtl8723au-use-list_for_each_entry/20160217-220638 HEAD 495811a52aba181af76c3baf57da3d81a79c2fe8 builds fine.
> > It only hurts bisectibility.
> >
> > All errors (new ones prefixed by >>):
> >
> > drivers/staging/rtl8723au/core/rtw_recv.c: In function 'rtw_free_recvframe23a_queue':
> >>> drivers/staging/rtl8723au/core/rtw_recv.c:203:2: error: 'plist' undeclared (first use in this function)
> > plist = phead->next;
> > ^
>
> This doesn't work, you cannot break interim builds. Your patch 2 needs
> to go before patch 1, and you must always check that they compile for
> each patch you apply.
>
> NACK
Sorry for the trouble caused. I updated my patchs to fix this problem.
- Geliang
This patch set uses list_for_each_entry*() instead of
list_for_each*(), removes useless codes, and cleans
whitespaces and blank lines.
Changes in v5:
- fix build error.
Changes in v4:
- revise the patchs as Jes suggested.
Changes in v3:
- split it into three patches.
Changes in v2:
- drop the coding style fixing in v1.
Geliang Tang (3):
staging: rtl8723au: use list_for_each_entry*()
staging: rtl8723au: core: rtw_recv: remove useless codes
staging: rtl8723au: whitespace and blank line cleaning
drivers/staging/rtl8723au/core/rtw_ap.c | 92 ++++++-----------------
drivers/staging/rtl8723au/core/rtw_mlme.c | 38 +++-------
drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 13 ++--
drivers/staging/rtl8723au/core/rtw_recv.c | 42 ++++-------
drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 36 +++------
drivers/staging/rtl8723au/core/rtw_xmit.c | 90 ++++++++--------------
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 22 ++----
drivers/staging/rtl8723au/os_dep/usb_ops_linux.c | 9 +--
8 files changed, 106 insertions(+), 236 deletions(-)
--
2.5.0
Geliang Tang <[email protected]> writes:
> On Wed, Feb 17, 2016 at 12:28:33PM -0500, Jes Sorensen wrote:
>> kbuild test robot <[email protected]> writes:
>> > All errors (new ones prefixed by >>):
>> >
>> > drivers/staging/rtl8723au/core/rtw_recv.c: In function 'rtw_free_recvframe23a_queue':
>> >>> drivers/staging/rtl8723au/core/rtw_recv.c:203:2: error: 'plist' undeclared (first use in this function)
>> > plist = phead->next;
>> > ^
>>
>> This doesn't work, you cannot break interim builds. Your patch 2 needs
>> to go before patch 1, and you must always check that they compile for
>> each patch you apply.
>>
>> NACK
>
> Sorry for the trouble caused. I updated my patchs to fix this problem.
>
> - Geliang
>
> This patch set uses list_for_each_entry*() instead of
> list_for_each*(), removes useless codes, and cleans
> whitespaces and blank lines.
No worries, I much prefer taking a few rounds to get it right.
This set looks good to me.
Acked-by: Jes Sorensen <[email protected]>
Use list_for_each_entry*() instead of list_for_each*() to simplify
the code.
Signed-off-by: Geliang Tang <[email protected]>
---
drivers/staging/rtl8723au/core/rtw_ap.c | 59 ++++++++------------
drivers/staging/rtl8723au/core/rtw_mlme.c | 28 ++++------
drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 10 ++--
drivers/staging/rtl8723au/core/rtw_recv.c | 22 ++++----
drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 25 ++++-----
drivers/staging/rtl8723au/core/rtw_xmit.c | 66 ++++++++++-------------
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 14 +++--
drivers/staging/rtl8723au/os_dep/usb_ops_linux.c | 9 ++--
8 files changed, 95 insertions(+), 138 deletions(-)
diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c
index 1aa9b26..4ab3631 100644
--- a/drivers/staging/rtl8723au/core/rtw_ap.c
+++ b/drivers/staging/rtl8723au/core/rtw_ap.c
@@ -173,9 +173,9 @@ static u8 chk_sta_is_alive(struct sta_info *psta)
void expire_timeout_chk23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
u8 updated = 0;
- struct sta_info *psta;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
u8 chk_alive_num = 0;
struct sta_info *chk_alive_list[NUM_STA];
@@ -186,8 +186,7 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
phead = &pstapriv->auth_list;
/* check auth_queue */
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, auth_list);
+ list_for_each_entry_safe(psta, ptmp, phead, auth_list) {
if (psta->expire_to > 0) {
psta->expire_to--;
@@ -216,8 +215,7 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
phead = &pstapriv->asoc_list;
/* check asoc_queue */
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
if (chk_sta_is_alive(psta) || !psta->expire_to) {
psta->expire_to = pstapriv->expire_to;
@@ -1059,7 +1057,7 @@ void rtw_set_macaddr_acl23a(struct rtw_adapter *padapter, int mode)
int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
{
- struct list_head *plist, *phead;
+ struct list_head *phead;
u8 added = false;
int i, ret = 0;
struct rtw_wlan_acl_node *paclnode;
@@ -1076,8 +1074,7 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
phead = get_list_head(pacl_node_q);
- list_for_each(plist, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
+ list_for_each_entry(paclnode, phead, list) {
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid == true) {
@@ -1121,8 +1118,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
{
- struct list_head *plist, *phead, *ptmp;
- struct rtw_wlan_acl_node *paclnode;
+ struct list_head *phead;
+ struct rtw_wlan_acl_node *paclnode, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
struct rtw_queue *pacl_node_q = &pacl_list->acl_node_q;
@@ -1133,8 +1130,7 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
phead = get_list_head(pacl_node_q);
- list_for_each_safe(plist, ptmp, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
+ list_for_each_entry_safe(paclnode, ptmp, phead, list) {
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid) {
@@ -1354,19 +1350,16 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated)
{
/* update associated stations cap. */
if (updated == true) {
- struct list_head *phead, *plist, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
-
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
VCS_update23a(padapter, psta);
- }
spin_unlock_bh(&pstapriv->asoc_list_lock);
}
@@ -1627,7 +1620,7 @@ u8 ap_free_sta23a(struct rtw_adapter *padapter, struct sta_info *psta, bool acti
int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_offset)
{
- struct list_head *phead, *plist;
+ struct list_head *phead;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@@ -1643,8 +1636,7 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
- list_for_each(plist, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
+ list_for_each_entry(psta, phead, asoc_list) {
issue_action_spct_ch_switch23a(padapter, psta->hwaddr, new_ch, ch_offset);
psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2);
@@ -1658,8 +1650,8 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of
int rtw_sta_flush23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
@@ -1676,8 +1668,7 @@ int rtw_sta_flush23a(struct rtw_adapter *padapter)
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
/* Remove sta from asoc_list */
list_del_init(&psta->asoc_list);
@@ -1744,9 +1735,9 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
struct mlme_priv *mlmepriv = &padapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct sta_priv *pstapriv = &padapter->stapriv;
- struct sta_info *psta;
+ struct sta_info *psta, *ptmp;
struct security_priv *psecuritypriv = &padapter->securitypriv;
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
u8 chk_alive_num = 0;
struct sta_info *chk_alive_list[NUM_STA];
int i;
@@ -1778,11 +1769,8 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
phead = &pstapriv->asoc_list;
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
-
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
chk_alive_list[chk_alive_num++] = psta;
- }
spin_unlock_bh(&pstapriv->asoc_list_lock);
@@ -1841,8 +1829,8 @@ void start_ap_mode23a(struct rtw_adapter *padapter)
void stop_ap_mode23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
- struct rtw_wlan_acl_node *paclnode;
+ struct list_head *phead;
+ struct rtw_wlan_acl_node *paclnode, *ptmp;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -1865,8 +1853,7 @@ void stop_ap_mode23a(struct rtw_adapter *padapter)
spin_lock_bh(&pacl_node_q->lock);
phead = get_list_head(pacl_node_q);
- list_for_each_safe(plist, ptmp, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
+ list_for_each_entry_safe(paclnode, ptmp, phead, list) {
if (paclnode->valid == true) {
paclnode->valid = false;
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 3c09ea9..b807376 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -171,8 +171,8 @@ exit:
void rtw_free_network_queue23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
- struct wlan_network *pnetwork;
+ struct list_head *phead;
+ struct wlan_network *pnetwork, *ptmp;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct rtw_queue *scanned_queue = &pmlmepriv->scanned_queue;
@@ -180,11 +180,8 @@ void rtw_free_network_queue23a(struct rtw_adapter *padapter)
phead = get_list_head(scanned_queue);
- list_for_each_safe(plist, ptmp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
-
+ list_for_each_entry_safe(pnetwork, ptmp, phead, list)
_rtw_free_network23a(pmlmepriv, pnetwork);
- }
spin_unlock_bh(&scanned_queue->lock);
}
@@ -329,14 +326,13 @@ int is_same_network23a(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst)
struct wlan_network *
rtw_get_oldest_wlan_network23a(struct rtw_queue *scanned_queue)
{
- struct list_head *plist, *phead;
+ struct list_head *phead;
struct wlan_network *pwlan;
struct wlan_network *oldest = NULL;
phead = get_list_head(scanned_queue);
- list_for_each(plist, phead) {
- pwlan = container_of(plist, struct wlan_network, list);
+ list_for_each_entry(pwlan, phead, list) {
if (pwlan->fixed != true) {
if (!oldest || time_after(oldest->last_scanned,
@@ -710,17 +706,16 @@ rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf)
static void free_scanqueue(struct mlme_priv *pmlmepriv)
{
- struct wlan_network *pnetwork;
+ struct wlan_network *pnetwork, *ptemp;
struct rtw_queue *scan_queue = &pmlmepriv->scanned_queue;
- struct list_head *plist, *phead, *ptemp;
+ struct list_head *phead;
RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, "+free_scanqueue\n");
spin_lock_bh(&scan_queue->lock);
phead = get_list_head(scan_queue);
- list_for_each_safe(plist, ptemp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
+ list_for_each_entry_safe(pnetwork, ptemp, phead, list) {
pnetwork->fixed = false;
_rtw_free_network23a(pmlmepriv, pnetwork);
}
@@ -1625,15 +1620,14 @@ exit:
static struct wlan_network *
rtw_select_candidate_from_queue(struct mlme_priv *pmlmepriv)
{
- struct wlan_network *pnetwork, *candidate = NULL;
+ struct wlan_network *pnetwork, *ptmp, *candidate = NULL;
struct rtw_queue *queue = &pmlmepriv->scanned_queue;
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
phead = get_list_head(queue);
- list_for_each_safe(plist, ptmp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
+ list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
if (!pnetwork) {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
"%s: return _FAIL:(pnetwork == NULL)\n",
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index a39e441..9322363c 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -6061,8 +6061,8 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
#ifdef CONFIG_8723AU_AP_MODE
else { /* tx bc/mc frames after update TIM */
struct sta_info *psta_bmc;
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe, *ptmp;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct sta_priv *pstapriv = &padapter->stapriv;
@@ -6078,10 +6078,8 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
phead = get_list_head(&psta_bmc->sleep_q);
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist,
- struct xmit_frame,
- list);
+ list_for_each_entry_safe(pxmitframe, ptmp,
+ phead, list) {
list_del_init(&pxmitframe->list);
diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
index 81abe50..0b4593c 100644
--- a/drivers/staging/rtl8723au/core/rtw_recv.c
+++ b/drivers/staging/rtl8723au/core/rtw_recv.c
@@ -88,13 +88,12 @@ int _rtw_init_recv_priv23a(struct recv_priv *precvpriv,
void _rtw_free_recv_priv23a (struct recv_priv *precvpriv)
{
struct rtw_adapter *padapter = precvpriv->adapter;
- struct recv_frame *precvframe;
- struct list_head *plist, *ptmp;
+ struct recv_frame *precvframe, *ptmp;
rtw_free_uc_swdec_pending_queue23a(padapter);
- list_for_each_safe(plist, ptmp, &precvpriv->free_recv_queue.queue) {
- precvframe = container_of(plist, struct recv_frame, list);
+ list_for_each_entry_safe(precvframe, ptmp,
+ &precvpriv->free_recv_queue.queue, list) {
list_del_init(&precvframe->list);
kfree(precvframe);
}
@@ -195,18 +194,16 @@ using spinlock to protect
static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue)
{
- struct recv_frame *hdr;
- struct list_head *plist, *phead, *ptmp;
+ struct recv_frame *hdr, *ptmp;
+ struct list_head *plist, *phead;
spin_lock(&pframequeue->lock);
phead = get_list_head(pframequeue);
plist = phead->next;
- list_for_each_safe(plist, ptmp, phead) {
- hdr = container_of(plist, struct recv_frame, list);
+ list_for_each_entry_safe(hdr, ptmp, phead, list)
rtw_free_recvframe23a(hdr);
- }
spin_unlock(&pframequeue->lock);
}
@@ -1549,10 +1546,10 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
struct rtw_queue *defrag_q)
{
- struct list_head *plist, *phead, *ptmp;
+ struct list_head *plist, *phead;
u8 *data, wlanhdr_offset;
u8 curfragnum;
- struct recv_frame *pnfhdr;
+ struct recv_frame *pnfhdr, *ptmp;
struct recv_frame *prframe, *pnextrframe;
struct rtw_queue *pfree_recv_queue;
struct sk_buff *skb;
@@ -1583,8 +1580,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
data = prframe->pkt->data;
- list_for_each_safe(plist, ptmp, phead) {
- pnfhdr = container_of(plist, struct recv_frame, list);
+ list_for_each_entry_safe(pnfhdr, ptmp, phead, list) {
pnextrframe = (struct recv_frame *)pnfhdr;
/* check the fragment sequence (2nd ~n fragment frame) */
diff --git a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
index b06bff7..232f245 100644
--- a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
@@ -83,8 +83,8 @@ int _rtw_init_sta_priv23a(struct sta_priv *pstapriv)
int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
{
- struct list_head *phead, *plist, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct recv_reorder_ctrl *preorder_ctrl;
int index;
@@ -94,11 +94,9 @@ int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
for (index = 0; index < NUM_STA; index++) {
phead = &pstapriv->sta_hash[index];
- list_for_each_safe(plist, ptmp, phead) {
+ list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
int i;
- psta = container_of(plist, struct sta_info,
- hash_list);
for (i = 0; i < 16 ; i++) {
preorder_ctrl = &psta->recvreorder_ctrl[i];
del_timer_sync(&preorder_ctrl->reordering_ctrl_timer);
@@ -325,8 +323,8 @@ exit:
/* free all stainfo which in sta_hash[all] */
void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
{
- struct list_head *plist, *phead, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct sta_info *pbcmc_stainfo = rtw_get_bcmc_stainfo23a(padapter);
s32 index;
@@ -339,8 +337,7 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
for (index = 0; index < NUM_STA; index++) {
phead = &pstapriv->sta_hash[index];
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, hash_list);
+ list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
if (pbcmc_stainfo != psta)
rtw_free_stainfo23a(padapter, psta);
@@ -352,7 +349,7 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
/* any station allocated can be searched by hash list */
struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
{
- struct list_head *plist, *phead;
+ struct list_head *phead;
struct sta_info *psta = NULL;
u32 index;
const u8 *addr;
@@ -371,8 +368,7 @@ struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
phead = &pstapriv->sta_hash[index];
- list_for_each(plist, phead) {
- psta = container_of(plist, struct sta_info, hash_list);
+ list_for_each_entry(psta, phead, hash_list) {
/* if found the matched address */
if (ether_addr_equal(psta->hwaddr, addr))
@@ -418,7 +414,7 @@ bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
{
bool res = true;
#ifdef CONFIG_8723AU_AP_MODE
- struct list_head *plist, *phead;
+ struct list_head *phead;
struct rtw_wlan_acl_node *paclnode;
bool match = false;
struct sta_priv *pstapriv = &padapter->stapriv;
@@ -428,8 +424,7 @@ bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
spin_lock_bh(&pacl_node_q->lock);
phead = get_list_head(pacl_node_q);
- list_for_each(plist, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
+ list_for_each_entry(paclnode, phead, list) {
if (ether_addr_equal(paclnode->addr, mac_addr)) {
if (paclnode->valid) {
diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c
index a4b6bb6..f88d670 100644
--- a/drivers/staging/rtl8723au/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723au/core/rtw_xmit.c
@@ -196,36 +196,35 @@ fail:
void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv)
{
struct rtw_adapter *padapter = pxmitpriv->adapter;
- struct xmit_frame *pxframe;
- struct xmit_buf *pxmitbuf;
- struct list_head *plist, *ptmp;
+ struct xmit_frame *pxframe, *ptmp;
+ struct xmit_buf *pxmitbuf, *ptmp2;
- list_for_each_safe(plist, ptmp, &pxmitpriv->free_xmit_queue.queue) {
- pxframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxframe, ptmp,
+ &pxmitpriv->free_xmit_queue.queue, list) {
list_del_init(&pxframe->list);
rtw_os_xmit_complete23a(padapter, pxframe);
kfree(pxframe);
}
- list_for_each_safe(plist, ptmp, &pxmitpriv->xmitbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry_safe(pxmitbuf, ptmp2,
+ &pxmitpriv->xmitbuf_list, list2) {
list_del_init(&pxmitbuf->list2);
rtw_os_xmit_resource_free23a(padapter, pxmitbuf);
kfree(pxmitbuf);
}
/* free xframe_ext queue, the same count as extbuf */
- list_for_each_safe(plist, ptmp,
- &pxmitpriv->free_xframe_ext_queue.queue) {
- pxframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxframe, ptmp,
+ &pxmitpriv->free_xframe_ext_queue.queue,
+ list) {
list_del_init(&pxframe->list);
rtw_os_xmit_complete23a(padapter, pxframe);
kfree(pxframe);
}
/* free xmit extension buff */
- list_for_each_safe(plist, ptmp, &pxmitpriv->xmitextbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry_safe(pxmitbuf, ptmp2,
+ &pxmitpriv->xmitextbuf_list, list2) {
list_del_init(&pxmitbuf->list2);
rtw_os_xmit_resource_free23a(padapter, pxmitbuf);
kfree(pxmitbuf);
@@ -1563,18 +1562,15 @@ exit:
void rtw_free_xmitframe_queue23a(struct xmit_priv *pxmitpriv,
struct rtw_queue *pframequeue)
{
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe, *ptmp;
spin_lock_bh(&pframequeue->lock);
phead = get_list_head(pframequeue);
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
-
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list)
rtw_free_xmitframe23a(pxmitpriv, pxmitframe);
- }
spin_unlock_bh(&pframequeue->lock);
}
@@ -1612,9 +1608,9 @@ struct xmit_frame *
rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i,
int entry)
{
- struct list_head *sta_plist, *sta_phead, *ptmp;
+ struct list_head *sta_phead;
struct hw_xmit *phwxmit;
- struct tx_servq *ptxservq = NULL;
+ struct tx_servq *ptxservq = NULL, *ptmp;
struct rtw_queue *pframe_queue = NULL;
struct xmit_frame *pxmitframe = NULL;
struct rtw_adapter *padapter = pxmitpriv->adapter;
@@ -1639,9 +1635,8 @@ rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i,
sta_phead = get_list_head(phwxmit->sta_queue);
- list_for_each_safe(sta_plist, ptmp, sta_phead) {
- ptxservq = container_of(sta_plist, struct tx_servq,
- tx_pending);
+ list_for_each_entry_safe(ptxservq, ptmp, sta_phead,
+ tx_pending) {
pframe_queue = &ptxservq->sta_pending;
@@ -2052,17 +2047,16 @@ dequeue_xmitframes_to_sleeping_queue(struct rtw_adapter *padapter,
struct rtw_queue *pframequeue)
{
int ret;
- struct list_head *plist, *phead, *ptmp;
+ struct list_head *phead;
u8 ac_index;
struct tx_servq *ptxservq;
struct pkt_attrib *pattrib;
- struct xmit_frame *pxmitframe;
+ struct xmit_frame *pxmitframe, *ptmp;
struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
phead = get_list_head(pframequeue);
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
ret = xmitframe_enqueue_for_sleeping_sta23a(padapter, pxmitframe);
@@ -2124,8 +2118,8 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
{
u8 update_mask = 0, wmmps_ac = 0;
struct sta_info *psta_bmc;
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe = NULL;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe = NULL, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
@@ -2133,8 +2127,7 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
phead = get_list_head(&psta->sleep_q);
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
list_del_init(&pxmitframe->list);
switch (pxmitframe->attrib.priority) {
@@ -2209,9 +2202,7 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
phead = get_list_head(&psta_bmc->sleep_q);
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame,
- list);
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
list_del_init(&pxmitframe->list);
@@ -2245,8 +2236,8 @@ void xmit_delivery_enabled_frames23a(struct rtw_adapter *padapter,
struct sta_info *psta)
{
u8 wmmps_ac = 0;
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
@@ -2255,8 +2246,7 @@ void xmit_delivery_enabled_frames23a(struct rtw_adapter *padapter,
phead = get_list_head(&psta->sleep_q);
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
switch (pxmitframe->attrib.priority) {
case 1:
diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 0ae2180..26cb279 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -1270,17 +1270,16 @@ void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv,
void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
{
- struct list_head *plist, *phead, *ptmp;
+ struct list_head *phead;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct rtw_queue *queue = &pmlmepriv->scanned_queue;
- struct wlan_network *pnetwork;
+ struct wlan_network *pnetwork, *ptmp;
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
phead = get_list_head(queue);
- list_for_each_safe(plist, ptmp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
+ list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
/* report network only if the current channel set
contains the channel to which this network belongs */
@@ -2850,9 +2849,9 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
{
const u8 *mac = params->mac;
int ret = 0;
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
u8 updated = 0;
- struct sta_info *psta;
+ struct sta_info *psta, *ptmp;
struct rtw_adapter *padapter = netdev_priv(ndev);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct sta_priv *pstapriv = &padapter->stapriv;
@@ -2885,8 +2884,7 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
phead = &pstapriv->asoc_list;
/* check asoc_queue */
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
if (ether_addr_equal(mac, psta->hwaddr)) {
if (psta->dot8021xalg == 1 &&
diff --git a/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c b/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
index 0cdaef0..cf4a506 100644
--- a/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
@@ -210,22 +210,21 @@ exit:
void rtl8723au_write_port_cancel(struct rtw_adapter *padapter)
{
struct xmit_buf *pxmitbuf;
- struct list_head *plist;
int j;
DBG_8723A("%s\n", __func__);
padapter->bWritePortCancel = true;
- list_for_each(plist, &padapter->xmitpriv.xmitbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry(pxmitbuf, &padapter->xmitpriv.xmitbuf_list,
+ list2) {
for (j = 0; j < 8; j++) {
if (pxmitbuf->pxmit_urb[j])
usb_kill_urb(pxmitbuf->pxmit_urb[j]);
}
}
- list_for_each(plist, &padapter->xmitpriv.xmitextbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry(pxmitbuf, &padapter->xmitpriv.xmitextbuf_list,
+ list2) {
for (j = 0; j < 8; j++) {
if (pxmitbuf->pxmit_urb[j])
usb_kill_urb(pxmitbuf->pxmit_urb[j]);
--
2.5.0
Use list_for_each_entry*() instead of list_for_each*() to simplify
the code.
Signed-off-by: Geliang Tang <[email protected]>
---
drivers/staging/rtl8723au/core/rtw_ap.c | 59 ++++++++------------
drivers/staging/rtl8723au/core/rtw_mlme.c | 28 ++++------
drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 10 ++--
drivers/staging/rtl8723au/core/rtw_recv.c | 22 ++++----
drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 25 ++++-----
drivers/staging/rtl8723au/core/rtw_xmit.c | 66 ++++++++++-------------
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 14 +++--
drivers/staging/rtl8723au/os_dep/usb_ops_linux.c | 9 ++--
8 files changed, 95 insertions(+), 138 deletions(-)
diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c
index 1aa9b26..4ab3631 100644
--- a/drivers/staging/rtl8723au/core/rtw_ap.c
+++ b/drivers/staging/rtl8723au/core/rtw_ap.c
@@ -173,9 +173,9 @@ static u8 chk_sta_is_alive(struct sta_info *psta)
void expire_timeout_chk23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
u8 updated = 0;
- struct sta_info *psta;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
u8 chk_alive_num = 0;
struct sta_info *chk_alive_list[NUM_STA];
@@ -186,8 +186,7 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
phead = &pstapriv->auth_list;
/* check auth_queue */
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, auth_list);
+ list_for_each_entry_safe(psta, ptmp, phead, auth_list) {
if (psta->expire_to > 0) {
psta->expire_to--;
@@ -216,8 +215,7 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
phead = &pstapriv->asoc_list;
/* check asoc_queue */
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
if (chk_sta_is_alive(psta) || !psta->expire_to) {
psta->expire_to = pstapriv->expire_to;
@@ -1059,7 +1057,7 @@ void rtw_set_macaddr_acl23a(struct rtw_adapter *padapter, int mode)
int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
{
- struct list_head *plist, *phead;
+ struct list_head *phead;
u8 added = false;
int i, ret = 0;
struct rtw_wlan_acl_node *paclnode;
@@ -1076,8 +1074,7 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
phead = get_list_head(pacl_node_q);
- list_for_each(plist, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
+ list_for_each_entry(paclnode, phead, list) {
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid == true) {
@@ -1121,8 +1118,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
{
- struct list_head *plist, *phead, *ptmp;
- struct rtw_wlan_acl_node *paclnode;
+ struct list_head *phead;
+ struct rtw_wlan_acl_node *paclnode, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
struct rtw_queue *pacl_node_q = &pacl_list->acl_node_q;
@@ -1133,8 +1130,7 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
phead = get_list_head(pacl_node_q);
- list_for_each_safe(plist, ptmp, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
+ list_for_each_entry_safe(paclnode, ptmp, phead, list) {
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid) {
@@ -1354,19 +1350,16 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated)
{
/* update associated stations cap. */
if (updated == true) {
- struct list_head *phead, *plist, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
-
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
VCS_update23a(padapter, psta);
- }
spin_unlock_bh(&pstapriv->asoc_list_lock);
}
@@ -1627,7 +1620,7 @@ u8 ap_free_sta23a(struct rtw_adapter *padapter, struct sta_info *psta, bool acti
int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_offset)
{
- struct list_head *phead, *plist;
+ struct list_head *phead;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@@ -1643,8 +1636,7 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
- list_for_each(plist, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
+ list_for_each_entry(psta, phead, asoc_list) {
issue_action_spct_ch_switch23a(padapter, psta->hwaddr, new_ch, ch_offset);
psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2);
@@ -1658,8 +1650,8 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of
int rtw_sta_flush23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
@@ -1676,8 +1668,7 @@ int rtw_sta_flush23a(struct rtw_adapter *padapter)
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
/* Remove sta from asoc_list */
list_del_init(&psta->asoc_list);
@@ -1744,9 +1735,9 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
struct mlme_priv *mlmepriv = &padapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct sta_priv *pstapriv = &padapter->stapriv;
- struct sta_info *psta;
+ struct sta_info *psta, *ptmp;
struct security_priv *psecuritypriv = &padapter->securitypriv;
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
u8 chk_alive_num = 0;
struct sta_info *chk_alive_list[NUM_STA];
int i;
@@ -1778,11 +1769,8 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
phead = &pstapriv->asoc_list;
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
-
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
chk_alive_list[chk_alive_num++] = psta;
- }
spin_unlock_bh(&pstapriv->asoc_list_lock);
@@ -1841,8 +1829,8 @@ void start_ap_mode23a(struct rtw_adapter *padapter)
void stop_ap_mode23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
- struct rtw_wlan_acl_node *paclnode;
+ struct list_head *phead;
+ struct rtw_wlan_acl_node *paclnode, *ptmp;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -1865,8 +1853,7 @@ void stop_ap_mode23a(struct rtw_adapter *padapter)
spin_lock_bh(&pacl_node_q->lock);
phead = get_list_head(pacl_node_q);
- list_for_each_safe(plist, ptmp, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
+ list_for_each_entry_safe(paclnode, ptmp, phead, list) {
if (paclnode->valid == true) {
paclnode->valid = false;
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 3c09ea9..b807376 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -171,8 +171,8 @@ exit:
void rtw_free_network_queue23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
- struct wlan_network *pnetwork;
+ struct list_head *phead;
+ struct wlan_network *pnetwork, *ptmp;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct rtw_queue *scanned_queue = &pmlmepriv->scanned_queue;
@@ -180,11 +180,8 @@ void rtw_free_network_queue23a(struct rtw_adapter *padapter)
phead = get_list_head(scanned_queue);
- list_for_each_safe(plist, ptmp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
-
+ list_for_each_entry_safe(pnetwork, ptmp, phead, list)
_rtw_free_network23a(pmlmepriv, pnetwork);
- }
spin_unlock_bh(&scanned_queue->lock);
}
@@ -329,14 +326,13 @@ int is_same_network23a(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst)
struct wlan_network *
rtw_get_oldest_wlan_network23a(struct rtw_queue *scanned_queue)
{
- struct list_head *plist, *phead;
+ struct list_head *phead;
struct wlan_network *pwlan;
struct wlan_network *oldest = NULL;
phead = get_list_head(scanned_queue);
- list_for_each(plist, phead) {
- pwlan = container_of(plist, struct wlan_network, list);
+ list_for_each_entry(pwlan, phead, list) {
if (pwlan->fixed != true) {
if (!oldest || time_after(oldest->last_scanned,
@@ -710,17 +706,16 @@ rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf)
static void free_scanqueue(struct mlme_priv *pmlmepriv)
{
- struct wlan_network *pnetwork;
+ struct wlan_network *pnetwork, *ptemp;
struct rtw_queue *scan_queue = &pmlmepriv->scanned_queue;
- struct list_head *plist, *phead, *ptemp;
+ struct list_head *phead;
RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, "+free_scanqueue\n");
spin_lock_bh(&scan_queue->lock);
phead = get_list_head(scan_queue);
- list_for_each_safe(plist, ptemp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
+ list_for_each_entry_safe(pnetwork, ptemp, phead, list) {
pnetwork->fixed = false;
_rtw_free_network23a(pmlmepriv, pnetwork);
}
@@ -1625,15 +1620,14 @@ exit:
static struct wlan_network *
rtw_select_candidate_from_queue(struct mlme_priv *pmlmepriv)
{
- struct wlan_network *pnetwork, *candidate = NULL;
+ struct wlan_network *pnetwork, *ptmp, *candidate = NULL;
struct rtw_queue *queue = &pmlmepriv->scanned_queue;
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
phead = get_list_head(queue);
- list_for_each_safe(plist, ptmp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
+ list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
if (!pnetwork) {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
"%s: return _FAIL:(pnetwork == NULL)\n",
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index a39e441..9322363c 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -6061,8 +6061,8 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
#ifdef CONFIG_8723AU_AP_MODE
else { /* tx bc/mc frames after update TIM */
struct sta_info *psta_bmc;
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe, *ptmp;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct sta_priv *pstapriv = &padapter->stapriv;
@@ -6078,10 +6078,8 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
phead = get_list_head(&psta_bmc->sleep_q);
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist,
- struct xmit_frame,
- list);
+ list_for_each_entry_safe(pxmitframe, ptmp,
+ phead, list) {
list_del_init(&pxmitframe->list);
diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
index 81abe50..bd93e76 100644
--- a/drivers/staging/rtl8723au/core/rtw_recv.c
+++ b/drivers/staging/rtl8723au/core/rtw_recv.c
@@ -88,13 +88,12 @@ int _rtw_init_recv_priv23a(struct recv_priv *precvpriv,
void _rtw_free_recv_priv23a (struct recv_priv *precvpriv)
{
struct rtw_adapter *padapter = precvpriv->adapter;
- struct recv_frame *precvframe;
- struct list_head *plist, *ptmp;
+ struct recv_frame *precvframe, *ptmp;
rtw_free_uc_swdec_pending_queue23a(padapter);
- list_for_each_safe(plist, ptmp, &precvpriv->free_recv_queue.queue) {
- precvframe = container_of(plist, struct recv_frame, list);
+ list_for_each_entry_safe(precvframe, ptmp,
+ &precvpriv->free_recv_queue.queue, list) {
list_del_init(&precvframe->list);
kfree(precvframe);
}
@@ -195,18 +194,16 @@ using spinlock to protect
static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue)
{
- struct recv_frame *hdr;
- struct list_head *plist, *phead, *ptmp;
+ struct recv_frame *hdr, *ptmp;
+ struct list_head *phead;
spin_lock(&pframequeue->lock);
phead = get_list_head(pframequeue);
plist = phead->next;
- list_for_each_safe(plist, ptmp, phead) {
- hdr = container_of(plist, struct recv_frame, list);
+ list_for_each_entry_safe(hdr, ptmp, phead, list)
rtw_free_recvframe23a(hdr);
- }
spin_unlock(&pframequeue->lock);
}
@@ -1549,10 +1546,10 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
struct rtw_queue *defrag_q)
{
- struct list_head *plist, *phead, *ptmp;
+ struct list_head *plist, *phead;
u8 *data, wlanhdr_offset;
u8 curfragnum;
- struct recv_frame *pnfhdr;
+ struct recv_frame *pnfhdr, *ptmp;
struct recv_frame *prframe, *pnextrframe;
struct rtw_queue *pfree_recv_queue;
struct sk_buff *skb;
@@ -1583,8 +1580,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
data = prframe->pkt->data;
- list_for_each_safe(plist, ptmp, phead) {
- pnfhdr = container_of(plist, struct recv_frame, list);
+ list_for_each_entry_safe(pnfhdr, ptmp, phead, list) {
pnextrframe = (struct recv_frame *)pnfhdr;
/* check the fragment sequence (2nd ~n fragment frame) */
diff --git a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
index b06bff7..232f245 100644
--- a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
@@ -83,8 +83,8 @@ int _rtw_init_sta_priv23a(struct sta_priv *pstapriv)
int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
{
- struct list_head *phead, *plist, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct recv_reorder_ctrl *preorder_ctrl;
int index;
@@ -94,11 +94,9 @@ int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
for (index = 0; index < NUM_STA; index++) {
phead = &pstapriv->sta_hash[index];
- list_for_each_safe(plist, ptmp, phead) {
+ list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
int i;
- psta = container_of(plist, struct sta_info,
- hash_list);
for (i = 0; i < 16 ; i++) {
preorder_ctrl = &psta->recvreorder_ctrl[i];
del_timer_sync(&preorder_ctrl->reordering_ctrl_timer);
@@ -325,8 +323,8 @@ exit:
/* free all stainfo which in sta_hash[all] */
void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
{
- struct list_head *plist, *phead, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct sta_info *pbcmc_stainfo = rtw_get_bcmc_stainfo23a(padapter);
s32 index;
@@ -339,8 +337,7 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
for (index = 0; index < NUM_STA; index++) {
phead = &pstapriv->sta_hash[index];
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, hash_list);
+ list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
if (pbcmc_stainfo != psta)
rtw_free_stainfo23a(padapter, psta);
@@ -352,7 +349,7 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
/* any station allocated can be searched by hash list */
struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
{
- struct list_head *plist, *phead;
+ struct list_head *phead;
struct sta_info *psta = NULL;
u32 index;
const u8 *addr;
@@ -371,8 +368,7 @@ struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
phead = &pstapriv->sta_hash[index];
- list_for_each(plist, phead) {
- psta = container_of(plist, struct sta_info, hash_list);
+ list_for_each_entry(psta, phead, hash_list) {
/* if found the matched address */
if (ether_addr_equal(psta->hwaddr, addr))
@@ -418,7 +414,7 @@ bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
{
bool res = true;
#ifdef CONFIG_8723AU_AP_MODE
- struct list_head *plist, *phead;
+ struct list_head *phead;
struct rtw_wlan_acl_node *paclnode;
bool match = false;
struct sta_priv *pstapriv = &padapter->stapriv;
@@ -428,8 +424,7 @@ bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
spin_lock_bh(&pacl_node_q->lock);
phead = get_list_head(pacl_node_q);
- list_for_each(plist, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
+ list_for_each_entry(paclnode, phead, list) {
if (ether_addr_equal(paclnode->addr, mac_addr)) {
if (paclnode->valid) {
diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c
index a4b6bb6..f88d670 100644
--- a/drivers/staging/rtl8723au/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723au/core/rtw_xmit.c
@@ -196,36 +196,35 @@ fail:
void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv)
{
struct rtw_adapter *padapter = pxmitpriv->adapter;
- struct xmit_frame *pxframe;
- struct xmit_buf *pxmitbuf;
- struct list_head *plist, *ptmp;
+ struct xmit_frame *pxframe, *ptmp;
+ struct xmit_buf *pxmitbuf, *ptmp2;
- list_for_each_safe(plist, ptmp, &pxmitpriv->free_xmit_queue.queue) {
- pxframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxframe, ptmp,
+ &pxmitpriv->free_xmit_queue.queue, list) {
list_del_init(&pxframe->list);
rtw_os_xmit_complete23a(padapter, pxframe);
kfree(pxframe);
}
- list_for_each_safe(plist, ptmp, &pxmitpriv->xmitbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry_safe(pxmitbuf, ptmp2,
+ &pxmitpriv->xmitbuf_list, list2) {
list_del_init(&pxmitbuf->list2);
rtw_os_xmit_resource_free23a(padapter, pxmitbuf);
kfree(pxmitbuf);
}
/* free xframe_ext queue, the same count as extbuf */
- list_for_each_safe(plist, ptmp,
- &pxmitpriv->free_xframe_ext_queue.queue) {
- pxframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxframe, ptmp,
+ &pxmitpriv->free_xframe_ext_queue.queue,
+ list) {
list_del_init(&pxframe->list);
rtw_os_xmit_complete23a(padapter, pxframe);
kfree(pxframe);
}
/* free xmit extension buff */
- list_for_each_safe(plist, ptmp, &pxmitpriv->xmitextbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry_safe(pxmitbuf, ptmp2,
+ &pxmitpriv->xmitextbuf_list, list2) {
list_del_init(&pxmitbuf->list2);
rtw_os_xmit_resource_free23a(padapter, pxmitbuf);
kfree(pxmitbuf);
@@ -1563,18 +1562,15 @@ exit:
void rtw_free_xmitframe_queue23a(struct xmit_priv *pxmitpriv,
struct rtw_queue *pframequeue)
{
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe, *ptmp;
spin_lock_bh(&pframequeue->lock);
phead = get_list_head(pframequeue);
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
-
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list)
rtw_free_xmitframe23a(pxmitpriv, pxmitframe);
- }
spin_unlock_bh(&pframequeue->lock);
}
@@ -1612,9 +1608,9 @@ struct xmit_frame *
rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i,
int entry)
{
- struct list_head *sta_plist, *sta_phead, *ptmp;
+ struct list_head *sta_phead;
struct hw_xmit *phwxmit;
- struct tx_servq *ptxservq = NULL;
+ struct tx_servq *ptxservq = NULL, *ptmp;
struct rtw_queue *pframe_queue = NULL;
struct xmit_frame *pxmitframe = NULL;
struct rtw_adapter *padapter = pxmitpriv->adapter;
@@ -1639,9 +1635,8 @@ rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i,
sta_phead = get_list_head(phwxmit->sta_queue);
- list_for_each_safe(sta_plist, ptmp, sta_phead) {
- ptxservq = container_of(sta_plist, struct tx_servq,
- tx_pending);
+ list_for_each_entry_safe(ptxservq, ptmp, sta_phead,
+ tx_pending) {
pframe_queue = &ptxservq->sta_pending;
@@ -2052,17 +2047,16 @@ dequeue_xmitframes_to_sleeping_queue(struct rtw_adapter *padapter,
struct rtw_queue *pframequeue)
{
int ret;
- struct list_head *plist, *phead, *ptmp;
+ struct list_head *phead;
u8 ac_index;
struct tx_servq *ptxservq;
struct pkt_attrib *pattrib;
- struct xmit_frame *pxmitframe;
+ struct xmit_frame *pxmitframe, *ptmp;
struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
phead = get_list_head(pframequeue);
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
ret = xmitframe_enqueue_for_sleeping_sta23a(padapter, pxmitframe);
@@ -2124,8 +2118,8 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
{
u8 update_mask = 0, wmmps_ac = 0;
struct sta_info *psta_bmc;
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe = NULL;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe = NULL, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
@@ -2133,8 +2127,7 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
phead = get_list_head(&psta->sleep_q);
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
list_del_init(&pxmitframe->list);
switch (pxmitframe->attrib.priority) {
@@ -2209,9 +2202,7 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
phead = get_list_head(&psta_bmc->sleep_q);
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame,
- list);
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
list_del_init(&pxmitframe->list);
@@ -2245,8 +2236,8 @@ void xmit_delivery_enabled_frames23a(struct rtw_adapter *padapter,
struct sta_info *psta)
{
u8 wmmps_ac = 0;
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
@@ -2255,8 +2246,7 @@ void xmit_delivery_enabled_frames23a(struct rtw_adapter *padapter,
phead = get_list_head(&psta->sleep_q);
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
switch (pxmitframe->attrib.priority) {
case 1:
diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 0ae2180..26cb279 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -1270,17 +1270,16 @@ void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv,
void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
{
- struct list_head *plist, *phead, *ptmp;
+ struct list_head *phead;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct rtw_queue *queue = &pmlmepriv->scanned_queue;
- struct wlan_network *pnetwork;
+ struct wlan_network *pnetwork, *ptmp;
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
phead = get_list_head(queue);
- list_for_each_safe(plist, ptmp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
+ list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
/* report network only if the current channel set
contains the channel to which this network belongs */
@@ -2850,9 +2849,9 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
{
const u8 *mac = params->mac;
int ret = 0;
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
u8 updated = 0;
- struct sta_info *psta;
+ struct sta_info *psta, *ptmp;
struct rtw_adapter *padapter = netdev_priv(ndev);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct sta_priv *pstapriv = &padapter->stapriv;
@@ -2885,8 +2884,7 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
phead = &pstapriv->asoc_list;
/* check asoc_queue */
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
if (ether_addr_equal(mac, psta->hwaddr)) {
if (psta->dot8021xalg == 1 &&
diff --git a/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c b/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
index 0cdaef0..cf4a506 100644
--- a/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
@@ -210,22 +210,21 @@ exit:
void rtl8723au_write_port_cancel(struct rtw_adapter *padapter)
{
struct xmit_buf *pxmitbuf;
- struct list_head *plist;
int j;
DBG_8723A("%s\n", __func__);
padapter->bWritePortCancel = true;
- list_for_each(plist, &padapter->xmitpriv.xmitbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry(pxmitbuf, &padapter->xmitpriv.xmitbuf_list,
+ list2) {
for (j = 0; j < 8; j++) {
if (pxmitbuf->pxmit_urb[j])
usb_kill_urb(pxmitbuf->pxmit_urb[j]);
}
}
- list_for_each(plist, &padapter->xmitpriv.xmitextbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry(pxmitbuf, &padapter->xmitpriv.xmitextbuf_list,
+ list2) {
for (j = 0; j < 8; j++) {
if (pxmitbuf->pxmit_urb[j])
usb_kill_urb(pxmitbuf->pxmit_urb[j]);
--
2.5.0
This patch cleans whitespaces and blank lines involved with
previous two patchs in this patch set.
Signed-off-by: Geliang Tang <[email protected]>
---
drivers/staging/rtl8723au/core/rtw_ap.c | 33 +----------------------
drivers/staging/rtl8723au/core/rtw_mlme.c | 10 -------
drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 3 +--
drivers/staging/rtl8723au/core/rtw_recv.c | 15 +++--------
drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 11 +-------
drivers/staging/rtl8723au/core/rtw_xmit.c | 26 ++++--------------
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 8 ------
7 files changed, 12 insertions(+), 94 deletions(-)
diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c
index 4ab3631..ce4b589 100644
--- a/drivers/staging/rtl8723au/core/rtw_ap.c
+++ b/drivers/staging/rtl8723au/core/rtw_ap.c
@@ -171,7 +171,7 @@ static u8 chk_sta_is_alive(struct sta_info *psta)
return ret;
}
-void expire_timeout_chk23a(struct rtw_adapter *padapter)
+void expire_timeout_chk23a(struct rtw_adapter *padapter)
{
struct list_head *phead;
u8 updated = 0;
@@ -182,12 +182,9 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
int i;
spin_lock_bh(&pstapriv->auth_list_lock);
-
phead = &pstapriv->auth_list;
-
/* check auth_queue */
list_for_each_entry_safe(psta, ptmp, phead, auth_list) {
-
if (psta->expire_to > 0) {
psta->expire_to--;
if (psta->expire_to == 0) {
@@ -205,18 +202,13 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
spin_lock_bh(&pstapriv->auth_list_lock);
}
}
-
}
-
spin_unlock_bh(&pstapriv->auth_list_lock);
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
/* check asoc_queue */
list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
-
if (chk_sta_is_alive(psta) || !psta->expire_to) {
psta->expire_to = pstapriv->expire_to;
psta->keep_alive_trycnt = 0;
@@ -281,7 +273,6 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
}
}
}
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
if (chk_alive_num) {
@@ -1071,11 +1062,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
return -1;
spin_lock_bh(&pacl_node_q->lock);
-
phead = get_list_head(pacl_node_q);
-
list_for_each_entry(paclnode, phead, list) {
-
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid == true) {
added = true;
@@ -1084,7 +1072,6 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
}
}
}
-
spin_unlock_bh(&pacl_node_q->lock);
if (added)
@@ -1127,11 +1114,8 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
DBG_8723A("%s(acl_num =%d) = %pM\n", __func__, pacl_list->num, addr);
spin_lock_bh(&pacl_node_q->lock);
-
phead = get_list_head(pacl_node_q);
-
list_for_each_entry_safe(paclnode, ptmp, phead, list) {
-
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid) {
paclnode->valid = false;
@@ -1142,7 +1126,6 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
}
}
}
-
spin_unlock_bh(&pacl_node_q->lock);
DBG_8723A("%s, acl_num =%d\n", __func__, pacl_list->num);
@@ -1355,12 +1338,9 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated)
struct sta_priv *pstapriv = &padapter->stapriv;
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
VCS_update23a(padapter, psta);
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
}
}
@@ -1635,9 +1615,7 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
-
list_for_each_entry(psta, phead, asoc_list) {
-
issue_action_spct_ch_switch23a(padapter, psta->hwaddr, new_ch, ch_offset);
psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2);
}
@@ -1667,9 +1645,7 @@ int rtw_sta_flush23a(struct rtw_adapter *padapter)
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
-
list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
-
/* Remove sta from asoc_list */
list_del_init(&psta->asoc_list);
pstapriv->asoc_list_cnt--;
@@ -1766,12 +1742,9 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
}
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
chk_alive_list[chk_alive_num++] = psta;
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
for (i = 0; i < chk_alive_num; i++) {
@@ -1852,14 +1825,10 @@ void stop_ap_mode23a(struct rtw_adapter *padapter)
/* for ACL */
spin_lock_bh(&pacl_node_q->lock);
phead = get_list_head(pacl_node_q);
-
list_for_each_entry_safe(paclnode, ptmp, phead, list) {
-
if (paclnode->valid == true) {
paclnode->valid = false;
-
list_del_init(&paclnode->list);
-
pacl_list->num--;
}
}
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c
index b807376..3adda55 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -177,12 +177,9 @@ void rtw_free_network_queue23a(struct rtw_adapter *padapter)
struct rtw_queue *scanned_queue = &pmlmepriv->scanned_queue;
spin_lock_bh(&scanned_queue->lock);
-
phead = get_list_head(scanned_queue);
-
list_for_each_entry_safe(pnetwork, ptmp, phead, list)
_rtw_free_network23a(pmlmepriv, pnetwork);
-
spin_unlock_bh(&scanned_queue->lock);
}
@@ -331,9 +328,7 @@ rtw_get_oldest_wlan_network23a(struct rtw_queue *scanned_queue)
struct wlan_network *oldest = NULL;
phead = get_list_head(scanned_queue);
-
list_for_each_entry(pwlan, phead, list) {
-
if (pwlan->fixed != true) {
if (!oldest || time_after(oldest->last_scanned,
pwlan->last_scanned))
@@ -441,7 +436,6 @@ static void rtw_update_scanned_network(struct rtw_adapter *adapter,
spin_lock_bh(&queue->lock);
phead = get_list_head(queue);
-
list_for_each(plist, phead) {
pnetwork = container_of(plist, struct wlan_network, list);
@@ -712,14 +706,11 @@ static void free_scanqueue(struct mlme_priv *pmlmepriv)
RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, "+free_scanqueue\n");
spin_lock_bh(&scan_queue->lock);
-
phead = get_list_head(scan_queue);
-
list_for_each_entry_safe(pnetwork, ptemp, phead, list) {
pnetwork->fixed = false;
_rtw_free_network23a(pmlmepriv, pnetwork);
}
-
spin_unlock_bh(&scan_queue->lock);
}
@@ -1626,7 +1617,6 @@ rtw_select_candidate_from_queue(struct mlme_priv *pmlmepriv)
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
phead = get_list_head(queue);
-
list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
if (!pnetwork) {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index 9322363c..f4fff38 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -6064,7 +6064,7 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
struct list_head *phead;
struct xmit_frame *pxmitframe, *ptmp;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
- struct sta_priv *pstapriv = &padapter->stapriv;
+ struct sta_priv *pstapriv = &padapter->stapriv;
/* for BC/MC Frames */
psta_bmc = rtw_get_bcmc_stainfo23a(padapter);
@@ -6096,7 +6096,6 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
rtl8723au_hal_xmitframe_enqueue(padapter,
pxmitframe);
}
-
/* spin_unlock_bh(&psta_bmc->sleep_q.lock); */
spin_unlock_bh(&pxmitpriv->lock);
}
diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
index d1e0f65..0a7741c 100644
--- a/drivers/staging/rtl8723au/core/rtw_recv.c
+++ b/drivers/staging/rtl8723au/core/rtw_recv.c
@@ -85,7 +85,7 @@ int _rtw_init_recv_priv23a(struct recv_priv *precvpriv,
return res;
}
-void _rtw_free_recv_priv23a (struct recv_priv *precvpriv)
+void _rtw_free_recv_priv23a(struct recv_priv *precvpriv)
{
struct rtw_adapter *padapter = precvpriv->adapter;
struct recv_frame *precvframe, *ptmp;
@@ -198,12 +198,9 @@ static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue)
struct list_head *phead;
spin_lock(&pframequeue->lock);
-
phead = get_list_head(pframequeue);
-
list_for_each_entry_safe(hdr, ptmp, phead, list)
rtw_free_recvframe23a(hdr);
-
spin_unlock(&pframequeue->lock);
}
@@ -1546,15 +1543,13 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
struct rtw_queue *defrag_q)
{
struct list_head *plist, *phead;
- u8 wlanhdr_offset;
- u8 curfragnum;
+ u8 wlanhdr_offset;
+ u8 curfragnum;
struct recv_frame *pnfhdr, *ptmp;
struct recv_frame *prframe, *pnextrframe;
- struct rtw_queue *pfree_recv_queue;
+ struct rtw_queue *pfree_recv_queue;
struct sk_buff *skb;
-
-
curfragnum = 0;
pfree_recv_queue = &adapter->recvpriv.free_recv_queue;
@@ -1617,8 +1612,6 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_,
"Performance defrag!!!!!\n");
-
-
return prframe;
}
diff --git a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
index 232f245..22d857b 100644
--- a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
@@ -93,7 +93,6 @@ int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
spin_lock_bh(&pstapriv->sta_hash_lock);
for (index = 0; index < NUM_STA; index++) {
phead = &pstapriv->sta_hash[index];
-
list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
int i;
@@ -333,12 +332,9 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
return;
spin_lock_bh(&pstapriv->sta_hash_lock);
-
for (index = 0; index < NUM_STA; index++) {
phead = &pstapriv->sta_hash[index];
-
list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
-
if (pbcmc_stainfo != psta)
rtw_free_stainfo23a(padapter, psta);
}
@@ -351,7 +347,7 @@ struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
{
struct list_head *phead;
struct sta_info *psta = NULL;
- u32 index;
+ u32 index;
const u8 *addr;
if (hwaddr == NULL)
@@ -365,11 +361,8 @@ struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
index = wifi_mac_hash(addr);
spin_lock_bh(&pstapriv->sta_hash_lock);
-
phead = &pstapriv->sta_hash[index];
-
list_for_each_entry(psta, phead, hash_list) {
-
/* if found the matched address */
if (ether_addr_equal(psta->hwaddr, addr))
break;
@@ -423,9 +416,7 @@ bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
spin_lock_bh(&pacl_node_q->lock);
phead = get_list_head(pacl_node_q);
-
list_for_each_entry(paclnode, phead, list) {
-
if (ether_addr_equal(paclnode->addr, mac_addr)) {
if (paclnode->valid) {
match = true;
diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c
index f88d670..b82b182 100644
--- a/drivers/staging/rtl8723au/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723au/core/rtw_xmit.c
@@ -193,7 +193,7 @@ fail:
goto exit;
}
-void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv)
+void _rtw_free_xmit_priv23a(struct xmit_priv *pxmitpriv)
{
struct rtw_adapter *padapter = pxmitpriv->adapter;
struct xmit_frame *pxframe, *ptmp;
@@ -1566,9 +1566,7 @@ void rtw_free_xmitframe_queue23a(struct xmit_priv *pxmitpriv,
struct xmit_frame *pxmitframe, *ptmp;
spin_lock_bh(&pframequeue->lock);
-
phead = get_list_head(pframequeue);
-
list_for_each_entry_safe(pxmitframe, ptmp, phead, list)
rtw_free_xmitframe23a(pxmitpriv, pxmitframe);
spin_unlock_bh(&pframequeue->lock);
@@ -1634,10 +1632,8 @@ rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i,
phwxmit = phwxmit_i + inx[i];
sta_phead = get_list_head(phwxmit->sta_queue);
-
list_for_each_entry_safe(ptxservq, ptmp, sta_phead,
tx_pending) {
-
pframe_queue = &ptxservq->sta_pending;
pxmitframe = dequeue_one_xmitframe(pxmitpriv, phwxmit, ptxservq, pframe_queue);
@@ -2048,16 +2044,14 @@ dequeue_xmitframes_to_sleeping_queue(struct rtw_adapter *padapter,
{
int ret;
struct list_head *phead;
- u8 ac_index;
+ u8 ac_index;
struct tx_servq *ptxservq;
- struct pkt_attrib *pattrib;
- struct xmit_frame *pxmitframe, *ptmp;
- struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
+ struct pkt_attrib *pattrib;
+ struct xmit_frame *pxmitframe, *ptmp;
+ struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
phead = get_list_head(pframequeue);
-
list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
-
ret = xmitframe_enqueue_for_sleeping_sta23a(padapter, pxmitframe);
if (ret == true) {
@@ -2124,9 +2118,7 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
spin_lock_bh(&pxmitpriv->lock);
-
phead = get_list_head(&psta->sleep_q);
-
list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
list_del_init(&pxmitframe->list);
@@ -2187,7 +2179,6 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
pstapriv->sta_dz_bitmap &= ~CHKBIT(psta->aid);
}
-
/* spin_unlock_bh(&psta->sleep_q.lock); */
spin_unlock_bh(&pxmitpriv->lock);
@@ -2199,11 +2190,8 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
if ((pstapriv->sta_dz_bitmap&0xfffe) == 0x0) {
/* no any sta in ps mode */
spin_lock_bh(&pxmitpriv->lock);
-
phead = get_list_head(&psta_bmc->sleep_q);
-
list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
-
list_del_init(&pxmitframe->list);
psta_bmc->sleepq_len--;
@@ -2223,7 +2211,6 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
/* update_BCNTIM(padapter); */
update_mask |= BIT(1);
}
-
/* spin_unlock_bh(&psta_bmc->sleep_q.lock); */
spin_unlock_bh(&pxmitpriv->lock);
}
@@ -2243,11 +2230,8 @@ void xmit_delivery_enabled_frames23a(struct rtw_adapter *padapter,
/* spin_lock_bh(&psta->sleep_q.lock); */
spin_lock_bh(&pxmitpriv->lock);
-
phead = get_list_head(&psta->sleep_q);
-
list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
-
switch (pxmitframe->attrib.priority) {
case 1:
case 2:
diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 26cb279..908b84c 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -1276,11 +1276,8 @@ void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
struct wlan_network *pnetwork, *ptmp;
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
-
phead = get_list_head(queue);
-
list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
-
/* report network only if the current channel set
contains the channel to which this network belongs */
if (rtw_ch_set_search_ch23a
@@ -1288,7 +1285,6 @@ void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
pnetwork->network.DSConfig) >= 0)
rtw_cfg80211_inform_bss(padapter, pnetwork);
}
-
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
/* call this after other things have been done */
@@ -2880,12 +2876,9 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
return -EINVAL;
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
/* check asoc_queue */
list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
-
if (ether_addr_equal(mac, psta->hwaddr)) {
if (psta->dot8021xalg == 1 &&
psta->bpairwise_key_installed == false) {
@@ -2910,7 +2903,6 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
}
}
}
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
associated_clients_update23a(padapter, updated);
--
2.5.0
There are some useless codes in rtw_free_recvframe23a_queue() and
recvframe_defrag(), so remove them.
Signed-off-by: Geliang Tang <[email protected]>
Acked-by: Jes Sorensen <[email protected]>
---
drivers/staging/rtl8723au/core/rtw_recv.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
index bd93e76..d1e0f65 100644
--- a/drivers/staging/rtl8723au/core/rtw_recv.c
+++ b/drivers/staging/rtl8723au/core/rtw_recv.c
@@ -200,7 +200,6 @@ static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue)
spin_lock(&pframequeue->lock);
phead = get_list_head(pframequeue);
- plist = phead->next;
list_for_each_entry_safe(hdr, ptmp, phead, list)
rtw_free_recvframe23a(hdr);
@@ -1547,7 +1546,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
struct rtw_queue *defrag_q)
{
struct list_head *plist, *phead;
- u8 *data, wlanhdr_offset;
+ u8 wlanhdr_offset;
u8 curfragnum;
struct recv_frame *pnfhdr, *ptmp;
struct recv_frame *prframe, *pnextrframe;
@@ -1576,10 +1575,6 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
curfragnum++;
- phead = get_list_head(defrag_q);
-
- data = prframe->pkt->data;
-
list_for_each_entry_safe(pnfhdr, ptmp, phead, list) {
pnextrframe = (struct recv_frame *)pnfhdr;
/* check the fragment sequence (2nd ~n fragment frame) */
--
2.5.0
Use list_for_each_entry*() instead of list_for_each*() to simplify
the code.
Signed-off-by: Geliang Tang <[email protected]>
---
Changes in v3:
- split it into three patches.
Changes in v2:
- drop the coding style fixing in v1.
---
drivers/staging/rtl8723au/core/rtw_ap.c | 55 ++++++++-----------
drivers/staging/rtl8723au/core/rtw_mlme.c | 26 ++++-----
drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 10 ++--
drivers/staging/rtl8723au/core/rtw_recv.c | 22 ++++----
drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 25 ++++-----
drivers/staging/rtl8723au/core/rtw_xmit.c | 64 ++++++++++-------------
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 14 +++--
drivers/staging/rtl8723au/os_dep/usb_ops_linux.c | 9 ++--
8 files changed, 96 insertions(+), 129 deletions(-)
diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c
index 1aa9b26..4bcd617 100644
--- a/drivers/staging/rtl8723au/core/rtw_ap.c
+++ b/drivers/staging/rtl8723au/core/rtw_ap.c
@@ -173,9 +173,9 @@ static u8 chk_sta_is_alive(struct sta_info *psta)
void expire_timeout_chk23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
u8 updated = 0;
- struct sta_info *psta;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
u8 chk_alive_num = 0;
struct sta_info *chk_alive_list[NUM_STA];
@@ -186,8 +186,7 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
phead = &pstapriv->auth_list;
/* check auth_queue */
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, auth_list);
+ list_for_each_entry_safe(psta, ptmp, phead, auth_list) {
if (psta->expire_to > 0) {
psta->expire_to--;
@@ -216,8 +215,7 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
phead = &pstapriv->asoc_list;
/* check asoc_queue */
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
if (chk_sta_is_alive(psta) || !psta->expire_to) {
psta->expire_to = pstapriv->expire_to;
@@ -1059,7 +1057,7 @@ void rtw_set_macaddr_acl23a(struct rtw_adapter *padapter, int mode)
int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
{
- struct list_head *plist, *phead;
+ struct list_head *phead;
u8 added = false;
int i, ret = 0;
struct rtw_wlan_acl_node *paclnode;
@@ -1076,8 +1074,7 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
phead = get_list_head(pacl_node_q);
- list_for_each(plist, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
+ list_for_each_entry(paclnode, phead, list) {
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid == true) {
@@ -1121,8 +1118,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
{
- struct list_head *plist, *phead, *ptmp;
- struct rtw_wlan_acl_node *paclnode;
+ struct list_head *phead;
+ struct rtw_wlan_acl_node *paclnode, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
struct rtw_queue *pacl_node_q = &pacl_list->acl_node_q;
@@ -1133,8 +1130,7 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
phead = get_list_head(pacl_node_q);
- list_for_each_safe(plist, ptmp, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
+ list_for_each_entry_safe(paclnode, ptmp, phead, list) {
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid) {
@@ -1354,16 +1350,15 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated)
{
/* update associated stations cap. */
if (updated == true) {
- struct list_head *phead, *plist, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
VCS_update23a(padapter, psta);
}
@@ -1627,7 +1622,7 @@ u8 ap_free_sta23a(struct rtw_adapter *padapter, struct sta_info *psta, bool acti
int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_offset)
{
- struct list_head *phead, *plist;
+ struct list_head *phead;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@@ -1643,8 +1638,7 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
- list_for_each(plist, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
+ list_for_each_entry(psta, phead, asoc_list) {
issue_action_spct_ch_switch23a(padapter, psta->hwaddr, new_ch, ch_offset);
psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2);
@@ -1658,8 +1652,8 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of
int rtw_sta_flush23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
@@ -1676,8 +1670,7 @@ int rtw_sta_flush23a(struct rtw_adapter *padapter)
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
/* Remove sta from asoc_list */
list_del_init(&psta->asoc_list);
@@ -1744,9 +1737,9 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
struct mlme_priv *mlmepriv = &padapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct sta_priv *pstapriv = &padapter->stapriv;
- struct sta_info *psta;
+ struct sta_info *psta, *ptmp;
struct security_priv *psecuritypriv = &padapter->securitypriv;
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
u8 chk_alive_num = 0;
struct sta_info *chk_alive_list[NUM_STA];
int i;
@@ -1778,8 +1771,7 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
phead = &pstapriv->asoc_list;
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
chk_alive_list[chk_alive_num++] = psta;
}
@@ -1841,8 +1833,8 @@ void start_ap_mode23a(struct rtw_adapter *padapter)
void stop_ap_mode23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
- struct rtw_wlan_acl_node *paclnode;
+ struct list_head *phead;
+ struct rtw_wlan_acl_node *paclnode, *ptmp;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -1865,8 +1857,7 @@ void stop_ap_mode23a(struct rtw_adapter *padapter)
spin_lock_bh(&pacl_node_q->lock);
phead = get_list_head(pacl_node_q);
- list_for_each_safe(plist, ptmp, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
+ list_for_each_entry_safe(paclnode, ptmp, phead, list) {
if (paclnode->valid == true) {
paclnode->valid = false;
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 3c09ea9..6cc1f33 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -171,8 +171,8 @@ exit:
void rtw_free_network_queue23a(struct rtw_adapter *padapter)
{
- struct list_head *phead, *plist, *ptmp;
- struct wlan_network *pnetwork;
+ struct list_head *phead;
+ struct wlan_network *pnetwork, *ptmp;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct rtw_queue *scanned_queue = &pmlmepriv->scanned_queue;
@@ -180,8 +180,7 @@ void rtw_free_network_queue23a(struct rtw_adapter *padapter)
phead = get_list_head(scanned_queue);
- list_for_each_safe(plist, ptmp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
+ list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
_rtw_free_network23a(pmlmepriv, pnetwork);
}
@@ -329,14 +328,13 @@ int is_same_network23a(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst)
struct wlan_network *
rtw_get_oldest_wlan_network23a(struct rtw_queue *scanned_queue)
{
- struct list_head *plist, *phead;
+ struct list_head *phead;
struct wlan_network *pwlan;
struct wlan_network *oldest = NULL;
phead = get_list_head(scanned_queue);
- list_for_each(plist, phead) {
- pwlan = container_of(plist, struct wlan_network, list);
+ list_for_each_entry(pwlan, phead, list) {
if (pwlan->fixed != true) {
if (!oldest || time_after(oldest->last_scanned,
@@ -710,17 +708,16 @@ rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf)
static void free_scanqueue(struct mlme_priv *pmlmepriv)
{
- struct wlan_network *pnetwork;
+ struct wlan_network *pnetwork, *ptemp;
struct rtw_queue *scan_queue = &pmlmepriv->scanned_queue;
- struct list_head *plist, *phead, *ptemp;
+ struct list_head *phead;
RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, "+free_scanqueue\n");
spin_lock_bh(&scan_queue->lock);
phead = get_list_head(scan_queue);
- list_for_each_safe(plist, ptemp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
+ list_for_each_entry_safe(pnetwork, ptemp, phead, list) {
pnetwork->fixed = false;
_rtw_free_network23a(pmlmepriv, pnetwork);
}
@@ -1625,15 +1622,14 @@ exit:
static struct wlan_network *
rtw_select_candidate_from_queue(struct mlme_priv *pmlmepriv)
{
- struct wlan_network *pnetwork, *candidate = NULL;
+ struct wlan_network *pnetwork, *ptmp, *candidate = NULL;
struct rtw_queue *queue = &pmlmepriv->scanned_queue;
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
phead = get_list_head(queue);
- list_for_each_safe(plist, ptmp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
+ list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
if (!pnetwork) {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
"%s: return _FAIL:(pnetwork == NULL)\n",
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index d28f29a..1b94031 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -6082,8 +6082,8 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
#ifdef CONFIG_8723AU_AP_MODE
else { /* tx bc/mc frames after update TIM */
struct sta_info *psta_bmc;
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe, *ptmp;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct sta_priv *pstapriv = &padapter->stapriv;
@@ -6099,10 +6099,8 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
phead = get_list_head(&psta_bmc->sleep_q);
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist,
- struct xmit_frame,
- list);
+ list_for_each_entry_safe(pxmitframe, ptmp,
+ phead, list) {
list_del_init(&pxmitframe->list);
diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
index 404b618..18b7d03 100644
--- a/drivers/staging/rtl8723au/core/rtw_recv.c
+++ b/drivers/staging/rtl8723au/core/rtw_recv.c
@@ -88,13 +88,13 @@ int _rtw_init_recv_priv23a(struct recv_priv *precvpriv,
void _rtw_free_recv_priv23a (struct recv_priv *precvpriv)
{
struct rtw_adapter *padapter = precvpriv->adapter;
- struct recv_frame *precvframe;
- struct list_head *plist, *ptmp;
+ struct recv_frame *precvframe, *ptmp;
rtw_free_uc_swdec_pending_queue23a(padapter);
- list_for_each_safe(plist, ptmp, &precvpriv->free_recv_queue.queue) {
- precvframe = container_of(plist, struct recv_frame, list);
+ list_for_each_entry_safe(precvframe, ptmp,
+ &precvpriv->free_recv_queue.queue,
+ list) {
list_del_init(&precvframe->list);
kfree(precvframe);
}
@@ -195,16 +195,15 @@ using spinlock to protect
static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue)
{
- struct recv_frame *hdr;
- struct list_head *plist, *phead, *ptmp;
+ struct recv_frame *hdr, *ptmp;
+ struct list_head *phead;
spin_lock(&pframequeue->lock);
phead = get_list_head(pframequeue);
plist = phead->next;
- list_for_each_safe(plist, ptmp, phead) {
- hdr = container_of(plist, struct recv_frame, list);
+ list_for_each_entry_safe(hdr, ptmp, phead, list) {
rtw_free_recvframe23a(hdr);
}
@@ -1567,10 +1566,10 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
struct rtw_queue *defrag_q)
{
- struct list_head *plist, *phead, *ptmp;
+ struct list_head *plist, *phead;
u8 *data, wlanhdr_offset;
u8 curfragnum;
- struct recv_frame *pnfhdr;
+ struct recv_frame *pnfhdr, *ptmp;
struct recv_frame *prframe, *pnextrframe;
struct rtw_queue *pfree_recv_queue;
struct sk_buff *skb;
@@ -1601,8 +1600,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
data = prframe->pkt->data;
- list_for_each_safe(plist, ptmp, phead) {
- pnfhdr = container_of(plist, struct recv_frame, list);
+ list_for_each_entry_safe(pnfhdr, ptmp, phead, list) {
pnextrframe = (struct recv_frame *)pnfhdr;
/* check the fragment sequence (2nd ~n fragment frame) */
diff --git a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
index b06bff7..232f245 100644
--- a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
@@ -83,8 +83,8 @@ int _rtw_init_sta_priv23a(struct sta_priv *pstapriv)
int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
{
- struct list_head *phead, *plist, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct recv_reorder_ctrl *preorder_ctrl;
int index;
@@ -94,11 +94,9 @@ int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
for (index = 0; index < NUM_STA; index++) {
phead = &pstapriv->sta_hash[index];
- list_for_each_safe(plist, ptmp, phead) {
+ list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
int i;
- psta = container_of(plist, struct sta_info,
- hash_list);
for (i = 0; i < 16 ; i++) {
preorder_ctrl = &psta->recvreorder_ctrl[i];
del_timer_sync(&preorder_ctrl->reordering_ctrl_timer);
@@ -325,8 +323,8 @@ exit:
/* free all stainfo which in sta_hash[all] */
void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
{
- struct list_head *plist, *phead, *ptmp;
- struct sta_info *psta;
+ struct list_head *phead;
+ struct sta_info *psta, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct sta_info *pbcmc_stainfo = rtw_get_bcmc_stainfo23a(padapter);
s32 index;
@@ -339,8 +337,7 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
for (index = 0; index < NUM_STA; index++) {
phead = &pstapriv->sta_hash[index];
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, hash_list);
+ list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
if (pbcmc_stainfo != psta)
rtw_free_stainfo23a(padapter, psta);
@@ -352,7 +349,7 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
/* any station allocated can be searched by hash list */
struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
{
- struct list_head *plist, *phead;
+ struct list_head *phead;
struct sta_info *psta = NULL;
u32 index;
const u8 *addr;
@@ -371,8 +368,7 @@ struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
phead = &pstapriv->sta_hash[index];
- list_for_each(plist, phead) {
- psta = container_of(plist, struct sta_info, hash_list);
+ list_for_each_entry(psta, phead, hash_list) {
/* if found the matched address */
if (ether_addr_equal(psta->hwaddr, addr))
@@ -418,7 +414,7 @@ bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
{
bool res = true;
#ifdef CONFIG_8723AU_AP_MODE
- struct list_head *plist, *phead;
+ struct list_head *phead;
struct rtw_wlan_acl_node *paclnode;
bool match = false;
struct sta_priv *pstapriv = &padapter->stapriv;
@@ -428,8 +424,7 @@ bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
spin_lock_bh(&pacl_node_q->lock);
phead = get_list_head(pacl_node_q);
- list_for_each(plist, phead) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
+ list_for_each_entry(paclnode, phead, list) {
if (ether_addr_equal(paclnode->addr, mac_addr)) {
if (paclnode->valid) {
diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c
index a4b6bb6..668806b 100644
--- a/drivers/staging/rtl8723au/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723au/core/rtw_xmit.c
@@ -196,36 +196,35 @@ fail:
void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv)
{
struct rtw_adapter *padapter = pxmitpriv->adapter;
- struct xmit_frame *pxframe;
- struct xmit_buf *pxmitbuf;
- struct list_head *plist, *ptmp;
+ struct xmit_frame *pxframe, *ptmp;
+ struct xmit_buf *pxmitbuf, *ptmp2;
- list_for_each_safe(plist, ptmp, &pxmitpriv->free_xmit_queue.queue) {
- pxframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxframe, ptmp,
+ &pxmitpriv->free_xmit_queue.queue, list) {
list_del_init(&pxframe->list);
rtw_os_xmit_complete23a(padapter, pxframe);
kfree(pxframe);
}
- list_for_each_safe(plist, ptmp, &pxmitpriv->xmitbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry_safe(pxmitbuf, ptmp2,
+ &pxmitpriv->xmitbuf_list, list2) {
list_del_init(&pxmitbuf->list2);
rtw_os_xmit_resource_free23a(padapter, pxmitbuf);
kfree(pxmitbuf);
}
/* free xframe_ext queue, the same count as extbuf */
- list_for_each_safe(plist, ptmp,
- &pxmitpriv->free_xframe_ext_queue.queue) {
- pxframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxframe, ptmp,
+ &pxmitpriv->free_xframe_ext_queue.queue,
+ list) {
list_del_init(&pxframe->list);
rtw_os_xmit_complete23a(padapter, pxframe);
kfree(pxframe);
}
/* free xmit extension buff */
- list_for_each_safe(plist, ptmp, &pxmitpriv->xmitextbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry_safe(pxmitbuf, ptmp2,
+ &pxmitpriv->xmitextbuf_list, list2) {
list_del_init(&pxmitbuf->list2);
rtw_os_xmit_resource_free23a(padapter, pxmitbuf);
kfree(pxmitbuf);
@@ -1563,15 +1562,14 @@ exit:
void rtw_free_xmitframe_queue23a(struct xmit_priv *pxmitpriv,
struct rtw_queue *pframequeue)
{
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe, *ptmp;
spin_lock_bh(&pframequeue->lock);
phead = get_list_head(pframequeue);
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
rtw_free_xmitframe23a(pxmitpriv, pxmitframe);
}
@@ -1612,9 +1610,9 @@ struct xmit_frame *
rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i,
int entry)
{
- struct list_head *sta_plist, *sta_phead, *ptmp;
+ struct list_head *sta_phead;
struct hw_xmit *phwxmit;
- struct tx_servq *ptxservq = NULL;
+ struct tx_servq *ptxservq = NULL, *ptmp;
struct rtw_queue *pframe_queue = NULL;
struct xmit_frame *pxmitframe = NULL;
struct rtw_adapter *padapter = pxmitpriv->adapter;
@@ -1639,9 +1637,8 @@ rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i,
sta_phead = get_list_head(phwxmit->sta_queue);
- list_for_each_safe(sta_plist, ptmp, sta_phead) {
- ptxservq = container_of(sta_plist, struct tx_servq,
- tx_pending);
+ list_for_each_entry_safe(ptxservq, ptmp, sta_phead,
+ tx_pending) {
pframe_queue = &ptxservq->sta_pending;
@@ -2052,17 +2049,16 @@ dequeue_xmitframes_to_sleeping_queue(struct rtw_adapter *padapter,
struct rtw_queue *pframequeue)
{
int ret;
- struct list_head *plist, *phead, *ptmp;
+ struct list_head *phead;
u8 ac_index;
struct tx_servq *ptxservq;
struct pkt_attrib *pattrib;
- struct xmit_frame *pxmitframe;
+ struct xmit_frame *pxmitframe, *ptmp;
struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
phead = get_list_head(pframequeue);
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
ret = xmitframe_enqueue_for_sleeping_sta23a(padapter, pxmitframe);
@@ -2124,8 +2120,8 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
{
u8 update_mask = 0, wmmps_ac = 0;
struct sta_info *psta_bmc;
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe = NULL;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe = NULL, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
@@ -2133,8 +2129,7 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
phead = get_list_head(&psta->sleep_q);
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
list_del_init(&pxmitframe->list);
switch (pxmitframe->attrib.priority) {
@@ -2209,9 +2204,7 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
phead = get_list_head(&psta_bmc->sleep_q);
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame,
- list);
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
list_del_init(&pxmitframe->list);
@@ -2245,8 +2238,8 @@ void xmit_delivery_enabled_frames23a(struct rtw_adapter *padapter,
struct sta_info *psta)
{
u8 wmmps_ac = 0;
- struct list_head *plist, *phead, *ptmp;
- struct xmit_frame *pxmitframe;
+ struct list_head *phead;
+ struct xmit_frame *pxmitframe, *ptmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
@@ -2255,8 +2248,7 @@ void xmit_delivery_enabled_frames23a(struct rtw_adapter *padapter,
phead = get_list_head(&psta->sleep_q);
- list_for_each_safe(plist, ptmp, phead) {
- pxmitframe = container_of(plist, struct xmit_frame, list);
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
switch (pxmitframe->attrib.priority) {
case 1:
diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 0ae2180..26cb279 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -1270,17 +1270,16 @@ void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv,
void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
{
- struct list_head *plist, *phead, *ptmp;
+ struct list_head *phead;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct rtw_queue *queue = &pmlmepriv->scanned_queue;
- struct wlan_network *pnetwork;
+ struct wlan_network *pnetwork, *ptmp;
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
phead = get_list_head(queue);
- list_for_each_safe(plist, ptmp, phead) {
- pnetwork = container_of(plist, struct wlan_network, list);
+ list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
/* report network only if the current channel set
contains the channel to which this network belongs */
@@ -2850,9 +2849,9 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
{
const u8 *mac = params->mac;
int ret = 0;
- struct list_head *phead, *plist, *ptmp;
+ struct list_head *phead;
u8 updated = 0;
- struct sta_info *psta;
+ struct sta_info *psta, *ptmp;
struct rtw_adapter *padapter = netdev_priv(ndev);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct sta_priv *pstapriv = &padapter->stapriv;
@@ -2885,8 +2884,7 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
phead = &pstapriv->asoc_list;
/* check asoc_queue */
- list_for_each_safe(plist, ptmp, phead) {
- psta = container_of(plist, struct sta_info, asoc_list);
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
if (ether_addr_equal(mac, psta->hwaddr)) {
if (psta->dot8021xalg == 1 &&
diff --git a/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c b/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
index 0cdaef0..cf4a506 100644
--- a/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c
@@ -210,22 +210,21 @@ exit:
void rtl8723au_write_port_cancel(struct rtw_adapter *padapter)
{
struct xmit_buf *pxmitbuf;
- struct list_head *plist;
int j;
DBG_8723A("%s\n", __func__);
padapter->bWritePortCancel = true;
- list_for_each(plist, &padapter->xmitpriv.xmitbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry(pxmitbuf, &padapter->xmitpriv.xmitbuf_list,
+ list2) {
for (j = 0; j < 8; j++) {
if (pxmitbuf->pxmit_urb[j])
usb_kill_urb(pxmitbuf->pxmit_urb[j]);
}
}
- list_for_each(plist, &padapter->xmitpriv.xmitextbuf_list) {
- pxmitbuf = container_of(plist, struct xmit_buf, list2);
+ list_for_each_entry(pxmitbuf, &padapter->xmitpriv.xmitextbuf_list,
+ list2) {
for (j = 0; j < 8; j++) {
if (pxmitbuf->pxmit_urb[j])
usb_kill_urb(pxmitbuf->pxmit_urb[j]);
--
2.5.0
Julian Calaby <[email protected]> writes:
> Hi Geliang,
>
> On Sun, Feb 7, 2016 at 2:30 PM, Geliang Tang <[email protected]> wrote:
>> This patch cleans whitespaces and blank lines surrounding
>> list_for_each_entry*().
>
> It does a lot more than this, including:
> - Removing some unnecessary brackets
> - Whitespace changes well away from the list_for_each_entry*() calls
>
> You need to either specify all of these in the changelog or split it
> up into multiple patches.
>
> Thanks,
>
> Julian Calaby
I agree, I think a more descriptive patch message will suffice here.
Jes
This patch cleans whitespaces and blank lines surrounding
list_for_each_entry*().
Signed-off-by: Geliang Tang <[email protected]>
---
Changes in v3:
- split it into three patches.
Changes in v2:
- drop the coding style fixing in v1.
---
drivers/staging/rtl8723au/core/rtw_ap.c | 41 ++---------------------
drivers/staging/rtl8723au/core/rtw_mlme.c | 14 +-------
drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 3 +-
drivers/staging/rtl8723au/core/rtw_recv.c | 18 +++-------
drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 11 +-----
drivers/staging/rtl8723au/core/rtw_xmit.c | 30 ++++-------------
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 8 -----
7 files changed, 17 insertions(+), 108 deletions(-)
diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c
index 4bcd617..ce4b589 100644
--- a/drivers/staging/rtl8723au/core/rtw_ap.c
+++ b/drivers/staging/rtl8723au/core/rtw_ap.c
@@ -171,7 +171,7 @@ static u8 chk_sta_is_alive(struct sta_info *psta)
return ret;
}
-void expire_timeout_chk23a(struct rtw_adapter *padapter)
+void expire_timeout_chk23a(struct rtw_adapter *padapter)
{
struct list_head *phead;
u8 updated = 0;
@@ -182,12 +182,9 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
int i;
spin_lock_bh(&pstapriv->auth_list_lock);
-
phead = &pstapriv->auth_list;
-
/* check auth_queue */
list_for_each_entry_safe(psta, ptmp, phead, auth_list) {
-
if (psta->expire_to > 0) {
psta->expire_to--;
if (psta->expire_to == 0) {
@@ -205,18 +202,13 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
spin_lock_bh(&pstapriv->auth_list_lock);
}
}
-
}
-
spin_unlock_bh(&pstapriv->auth_list_lock);
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
/* check asoc_queue */
list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
-
if (chk_sta_is_alive(psta) || !psta->expire_to) {
psta->expire_to = pstapriv->expire_to;
psta->keep_alive_trycnt = 0;
@@ -281,7 +273,6 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter)
}
}
}
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
if (chk_alive_num) {
@@ -1071,11 +1062,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
return -1;
spin_lock_bh(&pacl_node_q->lock);
-
phead = get_list_head(pacl_node_q);
-
list_for_each_entry(paclnode, phead, list) {
-
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid == true) {
added = true;
@@ -1084,7 +1072,6 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr)
}
}
}
-
spin_unlock_bh(&pacl_node_q->lock);
if (added)
@@ -1127,11 +1114,8 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
DBG_8723A("%s(acl_num =%d) = %pM\n", __func__, pacl_list->num, addr);
spin_lock_bh(&pacl_node_q->lock);
-
phead = get_list_head(pacl_node_q);
-
list_for_each_entry_safe(paclnode, ptmp, phead, list) {
-
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid) {
paclnode->valid = false;
@@ -1142,7 +1126,6 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr)
}
}
}
-
spin_unlock_bh(&pacl_node_q->lock);
DBG_8723A("%s, acl_num =%d\n", __func__, pacl_list->num);
@@ -1355,14 +1338,9 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated)
struct sta_priv *pstapriv = &padapter->stapriv;
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
- list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
-
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
VCS_update23a(padapter, psta);
- }
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
}
}
@@ -1637,9 +1615,7 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
-
list_for_each_entry(psta, phead, asoc_list) {
-
issue_action_spct_ch_switch23a(padapter, psta->hwaddr, new_ch, ch_offset);
psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2);
}
@@ -1669,9 +1645,7 @@ int rtw_sta_flush23a(struct rtw_adapter *padapter)
spin_lock_bh(&pstapriv->asoc_list_lock);
phead = &pstapriv->asoc_list;
-
list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
-
/* Remove sta from asoc_list */
list_del_init(&psta->asoc_list);
pstapriv->asoc_list_cnt--;
@@ -1768,14 +1742,9 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
}
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
- list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
-
+ list_for_each_entry_safe(psta, ptmp, phead, asoc_list)
chk_alive_list[chk_alive_num++] = psta;
- }
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
for (i = 0; i < chk_alive_num; i++) {
@@ -1856,14 +1825,10 @@ void stop_ap_mode23a(struct rtw_adapter *padapter)
/* for ACL */
spin_lock_bh(&pacl_node_q->lock);
phead = get_list_head(pacl_node_q);
-
list_for_each_entry_safe(paclnode, ptmp, phead, list) {
-
if (paclnode->valid == true) {
paclnode->valid = false;
-
list_del_init(&paclnode->list);
-
pacl_list->num--;
}
}
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 6cc1f33..3adda55 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -177,14 +177,9 @@ void rtw_free_network_queue23a(struct rtw_adapter *padapter)
struct rtw_queue *scanned_queue = &pmlmepriv->scanned_queue;
spin_lock_bh(&scanned_queue->lock);
-
phead = get_list_head(scanned_queue);
-
- list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
-
+ list_for_each_entry_safe(pnetwork, ptmp, phead, list)
_rtw_free_network23a(pmlmepriv, pnetwork);
- }
-
spin_unlock_bh(&scanned_queue->lock);
}
@@ -333,9 +328,7 @@ rtw_get_oldest_wlan_network23a(struct rtw_queue *scanned_queue)
struct wlan_network *oldest = NULL;
phead = get_list_head(scanned_queue);
-
list_for_each_entry(pwlan, phead, list) {
-
if (pwlan->fixed != true) {
if (!oldest || time_after(oldest->last_scanned,
pwlan->last_scanned))
@@ -443,7 +436,6 @@ static void rtw_update_scanned_network(struct rtw_adapter *adapter,
spin_lock_bh(&queue->lock);
phead = get_list_head(queue);
-
list_for_each(plist, phead) {
pnetwork = container_of(plist, struct wlan_network, list);
@@ -714,14 +706,11 @@ static void free_scanqueue(struct mlme_priv *pmlmepriv)
RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, "+free_scanqueue\n");
spin_lock_bh(&scan_queue->lock);
-
phead = get_list_head(scan_queue);
-
list_for_each_entry_safe(pnetwork, ptemp, phead, list) {
pnetwork->fixed = false;
_rtw_free_network23a(pmlmepriv, pnetwork);
}
-
spin_unlock_bh(&scan_queue->lock);
}
@@ -1628,7 +1617,6 @@ rtw_select_candidate_from_queue(struct mlme_priv *pmlmepriv)
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
phead = get_list_head(queue);
-
list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
if (!pnetwork) {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index 1b94031..61fbd10 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -6085,7 +6085,7 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
struct list_head *phead;
struct xmit_frame *pxmitframe, *ptmp;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
- struct sta_priv *pstapriv = &padapter->stapriv;
+ struct sta_priv *pstapriv = &padapter->stapriv;
/* for BC/MC Frames */
psta_bmc = rtw_get_bcmc_stainfo23a(padapter);
@@ -6117,7 +6117,6 @@ int tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
rtl8723au_hal_xmitframe_enqueue(padapter,
pxmitframe);
}
-
/* spin_unlock_bh(&psta_bmc->sleep_q.lock); */
spin_unlock_bh(&pxmitpriv->lock);
}
diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
index b36bc6b..de1226e 100644
--- a/drivers/staging/rtl8723au/core/rtw_recv.c
+++ b/drivers/staging/rtl8723au/core/rtw_recv.c
@@ -85,7 +85,7 @@ int _rtw_init_recv_priv23a(struct recv_priv *precvpriv,
return res;
}
-void _rtw_free_recv_priv23a (struct recv_priv *precvpriv)
+void _rtw_free_recv_priv23a(struct recv_priv *precvpriv)
{
struct rtw_adapter *padapter = precvpriv->adapter;
struct recv_frame *precvframe, *ptmp;
@@ -199,13 +199,9 @@ static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue)
struct list_head *phead;
spin_lock(&pframequeue->lock);
-
phead = get_list_head(pframequeue);
-
- list_for_each_entry_safe(hdr, ptmp, phead, list) {
+ list_for_each_entry_safe(hdr, ptmp, phead, list)
rtw_free_recvframe23a(hdr);
- }
-
spin_unlock(&pframequeue->lock);
}
@@ -1566,15 +1562,13 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
struct rtw_queue *defrag_q)
{
struct list_head *plist, *phead;
- u8 wlanhdr_offset;
- u8 curfragnum;
+ u8 wlanhdr_offset;
+ u8 curfragnum;
struct recv_frame *pnfhdr, *ptmp;
struct recv_frame *prframe, *pnextrframe;
- struct rtw_queue *pfree_recv_queue;
+ struct rtw_queue *pfree_recv_queue;
struct sk_buff *skb;
-
-
curfragnum = 0;
pfree_recv_queue = &adapter->recvpriv.free_recv_queue;
@@ -1637,8 +1631,6 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter,
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_,
"Performance defrag!!!!!\n");
-
-
return prframe;
}
diff --git a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
index 232f245..22d857b 100644
--- a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c
@@ -93,7 +93,6 @@ int _rtw_free_sta_priv23a(struct sta_priv *pstapriv)
spin_lock_bh(&pstapriv->sta_hash_lock);
for (index = 0; index < NUM_STA; index++) {
phead = &pstapriv->sta_hash[index];
-
list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
int i;
@@ -333,12 +332,9 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter)
return;
spin_lock_bh(&pstapriv->sta_hash_lock);
-
for (index = 0; index < NUM_STA; index++) {
phead = &pstapriv->sta_hash[index];
-
list_for_each_entry_safe(psta, ptmp, phead, hash_list) {
-
if (pbcmc_stainfo != psta)
rtw_free_stainfo23a(padapter, psta);
}
@@ -351,7 +347,7 @@ struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
{
struct list_head *phead;
struct sta_info *psta = NULL;
- u32 index;
+ u32 index;
const u8 *addr;
if (hwaddr == NULL)
@@ -365,11 +361,8 @@ struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr)
index = wifi_mac_hash(addr);
spin_lock_bh(&pstapriv->sta_hash_lock);
-
phead = &pstapriv->sta_hash[index];
-
list_for_each_entry(psta, phead, hash_list) {
-
/* if found the matched address */
if (ether_addr_equal(psta->hwaddr, addr))
break;
@@ -423,9 +416,7 @@ bool rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr)
spin_lock_bh(&pacl_node_q->lock);
phead = get_list_head(pacl_node_q);
-
list_for_each_entry(paclnode, phead, list) {
-
if (ether_addr_equal(paclnode->addr, mac_addr)) {
if (paclnode->valid) {
match = true;
diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c
index 668806b..b82b182 100644
--- a/drivers/staging/rtl8723au/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723au/core/rtw_xmit.c
@@ -193,7 +193,7 @@ fail:
goto exit;
}
-void _rtw_free_xmit_priv23a (struct xmit_priv *pxmitpriv)
+void _rtw_free_xmit_priv23a(struct xmit_priv *pxmitpriv)
{
struct rtw_adapter *padapter = pxmitpriv->adapter;
struct xmit_frame *pxframe, *ptmp;
@@ -1566,13 +1566,9 @@ void rtw_free_xmitframe_queue23a(struct xmit_priv *pxmitpriv,
struct xmit_frame *pxmitframe, *ptmp;
spin_lock_bh(&pframequeue->lock);
-
phead = get_list_head(pframequeue);
-
- list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
-
+ list_for_each_entry_safe(pxmitframe, ptmp, phead, list)
rtw_free_xmitframe23a(pxmitpriv, pxmitframe);
- }
spin_unlock_bh(&pframequeue->lock);
}
@@ -1636,10 +1632,8 @@ rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i,
phwxmit = phwxmit_i + inx[i];
sta_phead = get_list_head(phwxmit->sta_queue);
-
list_for_each_entry_safe(ptxservq, ptmp, sta_phead,
tx_pending) {
-
pframe_queue = &ptxservq->sta_pending;
pxmitframe = dequeue_one_xmitframe(pxmitpriv, phwxmit, ptxservq, pframe_queue);
@@ -2050,16 +2044,14 @@ dequeue_xmitframes_to_sleeping_queue(struct rtw_adapter *padapter,
{
int ret;
struct list_head *phead;
- u8 ac_index;
+ u8 ac_index;
struct tx_servq *ptxservq;
- struct pkt_attrib *pattrib;
- struct xmit_frame *pxmitframe, *ptmp;
- struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
+ struct pkt_attrib *pattrib;
+ struct xmit_frame *pxmitframe, *ptmp;
+ struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits;
phead = get_list_head(pframequeue);
-
list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
-
ret = xmitframe_enqueue_for_sleeping_sta23a(padapter, pxmitframe);
if (ret == true) {
@@ -2126,9 +2118,7 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
spin_lock_bh(&pxmitpriv->lock);
-
phead = get_list_head(&psta->sleep_q);
-
list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
list_del_init(&pxmitframe->list);
@@ -2189,7 +2179,6 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
pstapriv->sta_dz_bitmap &= ~CHKBIT(psta->aid);
}
-
/* spin_unlock_bh(&psta->sleep_q.lock); */
spin_unlock_bh(&pxmitpriv->lock);
@@ -2201,11 +2190,8 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
if ((pstapriv->sta_dz_bitmap&0xfffe) == 0x0) {
/* no any sta in ps mode */
spin_lock_bh(&pxmitpriv->lock);
-
phead = get_list_head(&psta_bmc->sleep_q);
-
list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
-
list_del_init(&pxmitframe->list);
psta_bmc->sleepq_len--;
@@ -2225,7 +2211,6 @@ void wakeup_sta_to_xmit23a(struct rtw_adapter *padapter, struct sta_info *psta)
/* update_BCNTIM(padapter); */
update_mask |= BIT(1);
}
-
/* spin_unlock_bh(&psta_bmc->sleep_q.lock); */
spin_unlock_bh(&pxmitpriv->lock);
}
@@ -2245,11 +2230,8 @@ void xmit_delivery_enabled_frames23a(struct rtw_adapter *padapter,
/* spin_lock_bh(&psta->sleep_q.lock); */
spin_lock_bh(&pxmitpriv->lock);
-
phead = get_list_head(&psta->sleep_q);
-
list_for_each_entry_safe(pxmitframe, ptmp, phead, list) {
-
switch (pxmitframe->attrib.priority) {
case 1:
case 2:
diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 26cb279..908b84c 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -1276,11 +1276,8 @@ void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
struct wlan_network *pnetwork, *ptmp;
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
-
phead = get_list_head(queue);
-
list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
-
/* report network only if the current channel set
contains the channel to which this network belongs */
if (rtw_ch_set_search_ch23a
@@ -1288,7 +1285,6 @@ void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
pnetwork->network.DSConfig) >= 0)
rtw_cfg80211_inform_bss(padapter, pnetwork);
}
-
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
/* call this after other things have been done */
@@ -2880,12 +2876,9 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
return -EINVAL;
spin_lock_bh(&pstapriv->asoc_list_lock);
-
phead = &pstapriv->asoc_list;
-
/* check asoc_queue */
list_for_each_entry_safe(psta, ptmp, phead, asoc_list) {
-
if (ether_addr_equal(mac, psta->hwaddr)) {
if (psta->dot8021xalg == 1 &&
psta->bpairwise_key_installed == false) {
@@ -2910,7 +2903,6 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
}
}
}
-
spin_unlock_bh(&pstapriv->asoc_list_lock);
associated_clients_update23a(padapter, updated);
--
2.5.0