* [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
* [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
* Re: [Outreachy kernel] Re: [PATCH v2] Staging: rtl8188eu: core: rtw_ap: Use list_for_each_entry_safe
[not found] ` <CAB3L5ozhby6izgNjoBZS6BwzOgpVcoH1fErt8PN3JhptFv0FGA@mail.gmail.com>
@ 2017-10-18 14:59 ` Julia Lawall
[not found] ` <CAB3L5ow53Tp4nucKeRiZSTMoaBocSTbpfa20TqOURV76X75YqQ@mail.gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2017-10-18 14:59 UTC (permalink / raw)
To: Srishti Sharma
Cc: Greg KH, devel, outreachy-kernel, Linux kernel mailing list
[-- Attachment #1: Type: text/plain, Size: 1883 bytes --]
On Wed, 18 Oct 2017, Srishti Sharma wrote:
>
>
> On Wed, Oct 18, 2017 at 6:01 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> 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.
>
>
> I had sent them individually because in a patch series they would have the
> same subject, as all of them are making similar changes in different files
> of the driver. One patch for all files would probably be too long, What do
> you suggest I do in this situation ?
I don't have the specific change handy, but maybe you can incorporate
more information about the affected file or about the change itself in teh
subject line. All subject lines need to be unique.
julia
>
> Regards,
> Srishti
>
> thanks,
>
> greg k-h
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/CAB3L5ozhby6izgNjoBZS6Bw
> zOgpVcoH1fErt8PN3JhptFv0FGA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Outreachy kernel] Re: [PATCH v2] Staging: rtl8188eu: core: rtw_ap: Use list_for_each_entry_safe
[not found] ` <CAB3L5ow53Tp4nucKeRiZSTMoaBocSTbpfa20TqOURV76X75YqQ@mail.gmail.com>
@ 2017-10-18 15:19 ` Julia Lawall
0 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2017-10-18 15:19 UTC (permalink / raw)
To: Srishti Sharma
Cc: Greg KH, devel, outreachy-kernel, Linux kernel mailing list
[-- Attachment #1: Type: text/plain, Size: 2987 bytes --]
On Wed, 18 Oct 2017, Srishti Sharma wrote:
>
>
> On Wed, Oct 18, 2017 at 8:29 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
> On Wed, 18 Oct 2017, Srishti Sharma wrote:
>
> >
> >
> > On Wed, Oct 18, 2017 at 6:01 PM, Greg KH
> <gregkh@linuxfoundation.org> wrote:
> > 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.
> >
> >
> > I had sent them individually because in a patch series they
> would have the
> > same subject, as all of them are making similar changes in
> different files
> > of the driver. One patch for all files would probably be too
> long, What do
> > you suggest I do in this situation ?
>
> I don't have the specific change handy, but maybe you can
> incorporate
> more information about the affected file or about the change
> itself in teh
> subject line. All subject lines need to be unique.
>
>
> I think if I add the file name for every file in the subject, even after
> saying use list_for_each_entry_safe for all of them, that should make them
> unique , right ? As this is what we did last time to make it unique, but I
> should have then sent them as a patch set.
A patch set is essential when there are multiple changes to the same file,
because one change ight affect how the others apply.
All commits should have unique subject lines, patch series or not.
julia
>
> Regards,
> Srishti
>
>
>
>
> julia
>
>
> >
> > Regards,
> > Srishti
> >
> > thanks,
> >
> > greg k-h
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups
> > "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it,
> send an
> > email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to
> outreachy-kernel@googlegroups.com.
> > To view this discussion on the webvisithttps://groups.google.com/d/msgid/outreachy-kernel/CAB3L5ozhby6izgNjoB
> ZS6Bw
> > zOgpVcoH1fErt8PN3JhptFv0FGA%40mail.gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
> >
>
>
>
>
^ permalink raw reply [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