* [PATCH v2] Staging: rtl8188eu: core: rtw_ap: Use list_for_each_entry_safe
@ 2017-10-05 9:46 Srishti Sharma
2017-10-18 12:31 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Srishti Sharma @ 2017-10-05 9:46 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, outreachy-kernel, Srishti Sharma
This is a cleanup patch and doesn't change runtime behavior. It
changes an open coded list traversal to use list_for_each_entry_safe.
Done using the following semantic patch by coccinelle.
@r@
struct list_head* l;
expression e;
identifier m, list_del_init, f;
type T1;
T1* pos;
iterator name list_for_each_entry_safe;
@@
f(...){
+T1* tmp;
...
-while(...)
+list_for_each_entry_safe(pos,tmp,l,m)
{
...
-pos = container_of(l,T1,m);
...
-l=e;
<+...
list_del_init(&pos->m)
...+>
}
...
}
Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
---
Changes in v2
-Make commit message clear.
-Add file name to subject.
drivers/staging/rtl8188eu/core/rtw_ap.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c
index 32a4837..a2c599f 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -1196,7 +1196,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr)
int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr)
{
struct list_head *plist, *phead;
- struct rtw_wlan_acl_node *paclnode;
+ struct rtw_wlan_acl_node *paclnode, *tmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
struct __queue *pacl_node_q = &pacl_list->acl_node_q;
@@ -1208,10 +1208,7 @@ int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr)
phead = get_list_head(pacl_node_q);
plist = phead->next;
- while (phead != plist) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
- plist = plist->next;
-
+ list_for_each_entry_safe(paclnode, tmp, plist, list) {
if (!memcmp(paclnode->addr, addr, ETH_ALEN)) {
if (paclnode->valid) {
paclnode->valid = false;
@@ -1711,7 +1708,7 @@ u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta,
int rtw_sta_flush(struct adapter *padapter)
{
struct list_head *phead, *plist;
- struct sta_info *psta = NULL;
+ struct sta_info *psta = NULL, *tmp;
struct sta_priv *pstapriv = &padapter->stapriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
@@ -1727,11 +1724,7 @@ int rtw_sta_flush(struct adapter *padapter)
plist = phead->next;
/* free sta asoc_queue */
- while (phead != plist) {
- psta = container_of(plist, struct sta_info, asoc_list);
-
- plist = plist->next;
-
+ list_for_each_entry_safe(psta, tmp, plist, asoc_list) {
list_del_init(&psta->asoc_list);
pstapriv->asoc_list_cnt--;
@@ -1833,7 +1826,7 @@ void start_ap_mode(struct adapter *padapter)
void stop_ap_mode(struct adapter *padapter)
{
struct list_head *phead, *plist;
- struct rtw_wlan_acl_node *paclnode;
+ struct rtw_wlan_acl_node *paclnode, *tmp;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -1855,10 +1848,7 @@ void stop_ap_mode(struct adapter *padapter)
spin_lock_bh(&pacl_node_q->lock);
phead = get_list_head(pacl_node_q);
plist = phead->next;
- while (phead != plist) {
- paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
- plist = plist->next;
-
+ list_for_each_entry_safe(paclnode, tmp, plist, list) {
if (paclnode->valid) {
paclnode->valid = false;
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v2] Staging: rtl8188eu: core: rtw_ap: Use list_for_each_entry_safe
2017-10-05 9:46 [PATCH v2] Staging: rtl8188eu: core: rtw_ap: Use list_for_each_entry_safe Srishti Sharma
@ 2017-10-18 12:31 ` Greg KH
[not found] ` <CAB3L5ozhby6izgNjoBZS6BwzOgpVcoH1fErt8PN3JhptFv0FGA@mail.gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2017-10-18 12:31 UTC (permalink / raw)
To: Srishti Sharma; +Cc: devel, outreachy-kernel, linux-kernel
On Thu, Oct 05, 2017 at 03:16:42PM +0530, Srishti Sharma wrote:
> This is a cleanup patch and doesn't change runtime behavior. It
> changes an open coded list traversal to use list_for_each_entry_safe.
> Done using the following semantic patch by coccinelle.
You have sent me two different patches, with this same subject.
And you have sent me lots of different patches for this same driver, I
don't have any idea which order to apply them in. Please resend them
all, in an ordered patch series, properly numbered, so I know what to do
here.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] Staging: rtl8188eu: core: rtw_ap: Use list_for_each_entry_safe
@ 2017-10-04 17:14 Srishti Sharma
0 siblings, 0 replies; 5+ messages in thread
From: Srishti Sharma @ 2017-10-04 17:14 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, outreachy-kernel, Srishti Sharma
This is a cleanup patch and doesn't change runtime behaviour. It
changes an open coded list traversal to use list_for_each_entry_safe.
Done using the following semantic patch by coccinelle.
@r@
struct list_head* l;
expression e;
identifier m,list_del_init,f;
type T1;
T1* pos;
iterator name list_for_each_entry_safe;
@@
f(...){
+T1* tmp;
<+...
-while(...)
+list_for_each_entry_safe(pos,tmp,l,m)
{
...
-pos = container_of(l,T1,m);
...
-l=e;
<+...
list_del_init(&pos->m)
...+>
}
...+>
}
Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
---
Changes in v2
-Make commit message more clear.
-Add file name to the subject.
drivers/staging/rtl8188eu/core/rtw_ap.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c
index a2c599f..551af9e 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -280,7 +280,7 @@ void expire_timeout_chk(struct adapter *padapter)
{
struct list_head *phead, *plist;
u8 updated = 0;
- struct sta_info *psta = NULL;
+ struct sta_info *psta = NULL, *tmp;
struct sta_priv *pstapriv = &padapter->stapriv;
u8 chk_alive_num = 0;
char chk_alive_list[NUM_STA];
@@ -292,10 +292,7 @@ void expire_timeout_chk(struct adapter *padapter)
plist = phead->next;
/* check auth_queue */
- while (phead != plist) {
- psta = container_of(plist, struct sta_info, auth_list);
- plist = plist->next;
-
+ list_for_each_entry_safe(psta, tmp, plist, auth_list) {
if (psta->expire_to > 0) {
psta->expire_to--;
if (psta->expire_to == 0) {
@@ -326,10 +323,7 @@ void expire_timeout_chk(struct adapter *padapter)
plist = phead->next;
/* check asoc_queue */
- while (phead != plist) {
- psta = container_of(plist, struct sta_info, asoc_list);
- plist = plist->next;
-
+ list_for_each_entry_safe(psta, tmp, plist, asoc_list) {
if (chk_sta_is_alive(psta) || !psta->expire_to) {
psta->expire_to = pstapriv->expire_to;
psta->keep_alive_trycnt = 0;
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-10-18 15:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-05 9:46 [PATCH v2] Staging: rtl8188eu: core: rtw_ap: Use list_for_each_entry_safe Srishti Sharma
2017-10-18 12:31 ` Greg KH
[not found] ` <CAB3L5ozhby6izgNjoBZS6BwzOgpVcoH1fErt8PN3JhptFv0FGA@mail.gmail.com>
2017-10-18 14:59 ` [Outreachy kernel] " Julia Lawall
[not found] ` <CAB3L5ow53Tp4nucKeRiZSTMoaBocSTbpfa20TqOURV76X75YqQ@mail.gmail.com>
2017-10-18 15:19 ` Julia Lawall
-- strict thread matches above, loose matches on Subject: below --
2017-10-04 17:14 Srishti Sharma
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox