Staging: rtl8188eu: core: Use list_entry instead of container_of
PATCH 1/1 Staging: rtl8188eu: core: Use list_entry instead of container_of
For variables of the type struct list_head* use list_entry to access the current list element instead of using container_of. Done using the following semantic patch by coccinelle.
@r@
identifier e;
struct list_head* l;
@@
<... when != l == NULL
l;
...>
(
e =
-container_of
+list_entry
(
...))
--- drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +6 -6
@@ -152,8 +152,8 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv)while (phead != plist) {int i; - psta = container_of(plist, struct sta_info, - hash_list); + psta = list_entry(plist, struct sta_info, + hash_list); plist = plist->next;for (i =0 ; i <16 ; i++) {
@@ -323,7 +323,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta) plist = phead->next;while (!list_empty (phead)) { - prframe = container_of(plist, struct recv_frame, list); + prframe = list_entry(plist, struct recv_frame, list); plist = plist->next;
@@ -399,7 +399,7 @@ void rtw_free_all_stainfo(struct adapter *padapter) plist = phead->next;while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list); plist = plist->next;
@@ -435,7 +435,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) plist = phead->next;while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list);if ((!memcmp (psta->hwaddr, addr,ETH_ALEN )) == true) {/* if found the matched address */
@@ -493,7 +493,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) phead =get_list_head (pacl_node_q); plist = phead->next;while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + paclnode = list_entry(plist, struct rtw_wlan_acl_node, list); plist = plist->next;if (!memcmp (paclnode->addr, mac_addr,ETH_ALEN )) {
Signature · 1 line
2.7.4
Quoted 4 lines · Srishti Sharma
For variables of the type struct list_head* use
list_entryto access the current list element instead of usingcontainer_of. Done using the following semantic patch by coccinelle.
Quoted 8 lines
@r@
identifier e;
struct list_head* l;
@@<... when != l == NULL
l;
...>
I don't see what is the goal of the above code. The list_head variable is not going to be in a statement by itself. There is also no need to check for l being NULL. If it is NULL, the original code is incorrect too.
Quoted 7 lines
(
e =(quoted diff) +1
-1-container_of +list_entry ( ...))
Here you don't need the outer ( ). This makes a disjunction with only one choice. Since there is only one choice, you don't need the disjunction.
julia
Quoted 66 lines
Signed-off-by Srishti Sharma <[email protected]>--- drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +6
-7@@ -152,8 +152,8 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv)while (phead != plist) {int i; - psta = container_of(plist, struct sta_info, - hash_list); + psta = list_entry(plist, struct sta_info, + hash_list); plist = plist->next;for (i =0 ; i <16 ; i++) {@@ -323,7 +323,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta) plist = phead->next;while (!list_empty (phead)) { - prframe = container_of(plist, struct recv_frame, list); + prframe = list_entry(plist, struct recv_frame, list); plist = plist->next;@@ -399,7 +399,7 @@ void rtw_free_all_stainfo(struct adapter *padapter) plist = phead->next;while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list); plist = plist->next;@@ -435,7 +435,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) plist = phead->next;while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list);if ((!memcmp (psta->hwaddr, addr,ETH_ALEN )) == true) {/* if found the matched address */ @@ -493,7 +493,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) phead =get_list_head (pacl_node_q); plist = phead->next;while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + paclnode = list_entry(plist, struct rtw_wlan_acl_node, list); plist = plist->next;if (!memcmp (paclnode->addr, mac_addr,ETH_ALEN )) { --2.7.4
--
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 [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1506734581-10932-1-git-send-email-srishtishar%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 13 lines · Julia Lawall
Quoted 9 lines · Srishti Sharma
For variables of the type struct list_head* use
list_entryto access the current list element instead of usingcontainer_of. Done using the following semantic patch by coccinelle.@r@
identifier e;
struct list_head* l;
@@
Quoted 6 lines
Quoted 3 lines
<... when != l == NULL
l;
...>I don't see what is the goal of the above code. The
list_headvariable is not going to be in a statement by itself. There is also no need to check for l being NULL. If it is NULL, the original code is incorrect too.
Since only those container_of are to replaced with list_entry which have a variable of type list_head* , I wanted to check if it occurs anywhere beforecontainer_of , which it only does in it's declaration , because it can't be in any
statement by itself . I think it will be better to write .
@r@
identifier e;
struct list_head* l;
@@
<...container_of(l,...);
...>
e =
-container_of
+list_entry
(
....)Quoted 11 lines
Quoted 7 lines
(
e =(quoted diff) +1
-1-container_of +list_entry ( ...))
Here you don't need the outer ( ). This makes a disjunction with only one choice. Since there is only one choice, you don't need the disjunction.
Thanks a lot , for pointing out the errors .
Regards,
Srishti
Quoted 68 lines
julia
Quoted 66 lines
Signed-off-by Srishti Sharma <[email protected]>--- drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +6
-7@@ -152,8 +152,8 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv)while (phead != plist) {int i; - psta = container_of(plist, struct sta_info, - hash_list); + psta = list_entry(plist, struct sta_info, + hash_list); plist = plist->next;for (i =0 ; i <16 ; i++) {@@ -323,7 +323,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta) plist = phead->next;while (!list_empty (phead)) { - prframe = container_of(plist, struct recv_frame, list); + prframe = list_entry(plist, struct recv_frame, list); plist = plist->next;@@ -399,7 +399,7 @@ void rtw_free_all_stainfo(struct adapter *padapter) plist = phead->next;while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list); plist = plist->next;@@ -435,7 +435,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) plist = phead->next;while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list);if ((!memcmp (psta->hwaddr, addr,ETH_ALEN )) == true) {/* if found the matched address */ @@ -493,7 +493,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) phead =get_list_head (pacl_node_q); plist = phead->next;while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + paclnode = list_entry(plist, struct rtw_wlan_acl_node, list); plist = plist->next;if (!memcmp (paclnode->addr, mac_addr,ETH_ALEN )) { --2.7.4
--
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 [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1506734581-10932-1-git-send-email-srishtishar%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 17 lines · Srishti Sharma
Quoted 16 lines · Julia Lawall
Quoted 12 lines · Srishti Sharma
For variables of the type struct list_head* use
list_entryto access the current list element instead of usingcontainer_of. Done using the following semantic patch by coccinelle.@r@
identifier e;
struct list_head* l;
@@<... when != l == NULL
l;
...>
Quoted 8 lines
Quoted 3 lines
I don't see what is the goal of the above code. The
list_headvariable is not going to be in a statement by itself. There is also no need to check for l being NULL. If it is NULL, the original code is incorrect too.Since only those
container_ofare to replaced withlist_entrywhich have a variable of type list_head* , I wanted to check if it occurs anywhere beforecontainer_of,
Why? If it is a list, then it seems appropriate to access it using list_head.
Quoted 4 lines
which it only does in it's declaration , because it can't be in any
statement by itself . I think it will be better to write .
Quoted 8 lines
@r@
identifier e;
struct list_head* l;
@@<...
container_of(l,...);
...>
This doesn't ensure that there is a preceding container_of, if that is what you are trying to do. The problem is that <... P ...> finds 0 or more occurrences of pattern P, not 1 or more occurrences. 1 or more occurrences is <+... P ...+>. But it would be simpler if you want an occurrence of container_of before the thing you are transforming to put
container_of(l,...);
...
e = ...
But this doesn't make sense either, partly because the preceding container_of is just not needed, and also because a container_of would not be in a statement by itself. In Coccinelle, when you put a ; after something is means that the thing is a complete statement, not just the end half of a statement.
julia
Quoted 91 lines
e =
(quoted diff) +1
-1-container_of +list_entry ( ....)Quoted 12 lines
Quoted 8 lines
(
e =(quoted diff) +1
-1-container_of +list_entry ( ...))
Here you don't need the outer ( ). This makes a disjunction with only one choice. Since there is only one choice, you don't need the disjunction.
Thanks a lot , for pointing out the errors .
Regards,
SrishtiQuoted 68 lines
julia
Quoted 66 lines
Signed-off-by Srishti Sharma <[email protected]>--- drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +6
-7@@ -152,8 +152,8 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv)while (phead != plist) {int i; - psta = container_of(plist, struct sta_info, - hash_list); + psta = list_entry(plist, struct sta_info, + hash_list); plist = plist->next;for (i =0 ; i <16 ; i++) {@@ -323,7 +323,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta) plist = phead->next;while (!list_empty (phead)) { - prframe = container_of(plist, struct recv_frame, list); + prframe = list_entry(plist, struct recv_frame, list); plist = plist->next;@@ -399,7 +399,7 @@ void rtw_free_all_stainfo(struct adapter *padapter) plist = phead->next;while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list); plist = plist->next;@@ -435,7 +435,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) plist = phead->next;while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list);if ((!memcmp (psta->hwaddr, addr,ETH_ALEN )) == true) {/* if found the matched address */ @@ -493,7 +493,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) phead =get_list_head (pacl_node_q); plist = phead->next;while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + paclnode = list_entry(plist, struct rtw_wlan_acl_node, list); plist = plist->next;if (!memcmp (paclnode->addr, mac_addr,ETH_ALEN )) { --2.7.4
--
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 [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1506734581-10932-1-git-send-email-srishtishar%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 56 lines · Julia Lawall
Quoted 17 lines · Srishti Sharma
Quoted 16 lines · Julia Lawall
Quoted 12 lines · Srishti Sharma
For variables of the type struct list_head* use
list_entryto access the current list element instead of usingcontainer_of. Done using the following semantic patch by coccinelle.@r@
identifier e;
struct list_head* l;
@@<... when != l == NULL
l;
...>Quoted 8 lines
Quoted 3 lines
I don't see what is the goal of the above code. The
list_headvariable is not going to be in a statement by itself. There is also no need to check for l being NULL. If it is NULL, the original code is incorrect too.Since only those
container_ofare to replaced withlist_entrywhich have a variable of type list_head* , I wanted to check if it occurs anywhere beforecontainer_of,Why? If it is a list, then it seems appropriate to access it using
list_head.Quoted 4 lines
which it only does in it's declaration , because it can't be in any
statement by itself . I think it will be better to write .Quoted 8 lines
@r@
identifier e;
struct list_head* l;
@@<...
container_of(l,...);
...>This doesn't ensure that there is a preceding
container_of, if that is what you are trying to do. The problem is that <... P ...> finds 0 or more occurrences of pattern P, not 1 or more occurrences. 1 or more occurrences is <+... P ...+>. But it would be simpler if you want an occurrence ofcontainer_ofbefore the thing you are transforming to put
container_of(l,...);
...
e = ...
Quoted 5 lines
But this doesn't make sense either, partly because the preceding
container_ofis just not needed, and also because acontainer_ofwould not be in a statement by itself. In Coccinelle, when you put a ; after something is means that the thing is a complete statement, not just the end half of a statement.
So , I guess we can simply write.
e =
-container_of
+list_entry
(l,...)
Regards,
Srishti
Quoted 94 lines
julia
Quoted 91 lines
e =
(quoted diff) +1
-1-container_of +list_entry ( ....)Quoted 12 lines
Quoted 8 lines
(
e =(quoted diff) +1
-1-container_of +list_entry ( ...))
Here you don't need the outer ( ). This makes a disjunction with only one choice. Since there is only one choice, you don't need the disjunction.
Thanks a lot , for pointing out the errors .
Regards,
SrishtiQuoted 68 lines
julia
Quoted 66 lines
Signed-off-by Srishti Sharma <[email protected]>--- drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +6
-7@@ -152,8 +152,8 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv)while (phead != plist) {int i; - psta = container_of(plist, struct sta_info, - hash_list); + psta = list_entry(plist, struct sta_info, + hash_list); plist = plist->next;for (i =0 ; i <16 ; i++) {@@ -323,7 +323,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta) plist = phead->next;while (!list_empty (phead)) { - prframe = container_of(plist, struct recv_frame, list); + prframe = list_entry(plist, struct recv_frame, list); plist = plist->next;@@ -399,7 +399,7 @@ void rtw_free_all_stainfo(struct adapter *padapter) plist = phead->next;while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list); plist = plist->next;@@ -435,7 +435,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) plist = phead->next;while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list);if ((!memcmp (psta->hwaddr, addr,ETH_ALEN )) == true) {/* if found the matched address */ @@ -493,7 +493,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) phead =get_list_head (pacl_node_q); plist = phead->next;while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + paclnode = list_entry(plist, struct rtw_wlan_acl_node, list); plist = plist->next;if (!memcmp (paclnode->addr, mac_addr,ETH_ALEN )) { --2.7.4
--
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 [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1506734581-10932-1-git-send-email-srishtishar%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 66 lines · Srishti Sharma
Quoted 56 lines · Julia Lawall
Quoted 17 lines · Srishti Sharma
Quoted 16 lines · Julia Lawall
Quoted 12 lines · Srishti Sharma
For variables of the type struct list_head* use
list_entryto access the current list element instead of usingcontainer_of. Done using the following semantic patch by coccinelle.@r@
identifier e;
struct list_head* l;
@@<... when != l == NULL
l;
...>Quoted 8 lines
Quoted 3 lines
I don't see what is the goal of the above code. The
list_headvariable is not going to be in a statement by itself. There is also no need to check for l being NULL. If it is NULL, the original code is incorrect too.Since only those
container_ofare to replaced withlist_entrywhich have a variable of type list_head* , I wanted to check if it occurs anywhere beforecontainer_of,Why? If it is a list, then it seems appropriate to access it using
list_head.Quoted 4 lines
which it only does in it's declaration , because it can't be in any
statement by itself . I think it will be better to write .Quoted 8 lines
@r@
identifier e;
struct list_head* l;
@@<...
container_of(l,...);
...>This doesn't ensure that there is a preceding
container_of, if that is what you are trying to do. The problem is that <... P ...> finds 0 or more occurrences of pattern P, not 1 or more occurrences. 1 or more occurrences is <+... P ...+>. But it would be simpler if you want an occurrence ofcontainer_ofbefore the thing you are transforming to put
container_of(l,...);
...
e = ...Quoted 5 lines
But this doesn't make sense either, partly because the preceding
container_ofis just not needed, and also because acontainer_ofwould not be in a statement by itself. In Coccinelle, when you put a ; after something is means that the thing is a complete statement, not just the end half of a statement.So , I guess we can simply write.
e =
Review
Quoted 3 lines
(quoted diff) +1
-1-container_of +list_entry (l,...)
Yes. You don't even need the e =. As long as there is a call to container_of on a list_head * value, you can change it.
julia
Quoted 106 lines
Regards,
SrishtiQuoted 94 lines
julia
Quoted 91 lines
e =
(quoted diff) +1
-1-container_of +list_entry ( ....)Quoted 12 lines
Quoted 8 lines
(
e =(quoted diff) +1
-1-container_of +list_entry ( ...))
Here you don't need the outer ( ). This makes a disjunction with only one choice. Since there is only one choice, you don't need the disjunction.
Thanks a lot , for pointing out the errors .
Regards,
SrishtiQuoted 68 lines
julia
Quoted 66 lines
Signed-off-by Srishti Sharma <[email protected]>--- drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +6
-7@@ -152,8 +152,8 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv)while (phead != plist) {int i; - psta = container_of(plist, struct sta_info, - hash_list); + psta = list_entry(plist, struct sta_info, + hash_list); plist = plist->next;for (i =0 ; i <16 ; i++) {@@ -323,7 +323,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta) plist = phead->next;while (!list_empty (phead)) { - prframe = container_of(plist, struct recv_frame, list); + prframe = list_entry(plist, struct recv_frame, list); plist = plist->next;@@ -399,7 +399,7 @@ void rtw_free_all_stainfo(struct adapter *padapter) plist = phead->next;while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list); plist = plist->next;@@ -435,7 +435,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) plist = phead->next;while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list);if ((!memcmp (psta->hwaddr, addr,ETH_ALEN )) == true) {/* if found the matched address */ @@ -493,7 +493,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) phead =get_list_head (pacl_node_q); plist = phead->next;while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + paclnode = list_entry(plist, struct rtw_wlan_acl_node, list); plist = plist->next;if (!memcmp (paclnode->addr, mac_addr,ETH_ALEN )) { --2.7.4
--
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 [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1506734581-10932-1-git-send-email-srishtishar%40gmail.com.
For more options, visit https://groups.google.com/d/optout.--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAB3L5ox9u0pj04pjkiC8MRgx%3DMZqwh%3Dg%3D2VE0-ZG8NYvrUrDBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 69 lines · Julia Lawall
Quoted 65 lines · Srishti Sharma
Quoted 56 lines · Julia Lawall
Quoted 17 lines · Srishti Sharma
Quoted 16 lines · Julia Lawall
Quoted 12 lines · Srishti Sharma
For variables of the type struct list_head* use
list_entryto access the current list element instead of usingcontainer_of. Done using the following semantic patch by coccinelle.@r@
identifier e;
struct list_head* l;
@@<... when != l == NULL
l;
...>Quoted 8 lines
Quoted 3 lines
I don't see what is the goal of the above code. The
list_headvariable is not going to be in a statement by itself. There is also no need to check for l being NULL. If it is NULL, the original code is incorrect too.Since only those
container_ofare to replaced withlist_entrywhich have a variable of type list_head* , I wanted to check if it occurs anywhere beforecontainer_of,Why? If it is a list, then it seems appropriate to access it using
list_head.Quoted 4 lines
which it only does in it's declaration , because it can't be in any
statement by itself . I think it will be better to write .Quoted 8 lines
@r@
identifier e;
struct list_head* l;
@@<...
container_of(l,...);
...>This doesn't ensure that there is a preceding
container_of, if that is what you are trying to do. The problem is that <... P ...> finds 0 or more occurrences of pattern P, not 1 or more occurrences. 1 or more occurrences is <+... P ...+>. But it would be simpler if you want an occurrence ofcontainer_ofbefore the thing you are transforming to put
container_of(l,...);
...
e = ...Quoted 5 lines
But this doesn't make sense either, partly because the preceding
container_ofis just not needed, and also because acontainer_ofwould not be in a statement by itself. In Coccinelle, when you put a ; after something is means that the thing is a complete statement, not just the end half of a statement.So , I guess we can simply write.
Quoted 7 lines
Review
Quoted 4 lines
e =
(quoted diff) +1
-1-container_of +list_entry (l,...)Yes. You don't even need the e =. As long as there is a call to
container_ofon alist_head* value, you can change it.
Okay, Thanks again :) , I'll make the changes and resend .
Regards,
Srishti
Quoted 109 lines
julia
Quoted 106 lines
Regards,
SrishtiQuoted 94 lines
julia
Quoted 91 lines
e =
(quoted diff) +1
-1-container_of +list_entry ( ....)Quoted 12 lines
Quoted 8 lines
(
e =(quoted diff) +1
-1-container_of +list_entry ( ...))
Here you don't need the outer ( ). This makes a disjunction with only one choice. Since there is only one choice, you don't need the disjunction.
Thanks a lot , for pointing out the errors .
Regards,
SrishtiQuoted 68 lines
julia
Quoted 66 lines
Signed-off-by Srishti Sharma <[email protected]>--- drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +6
-7@@ -152,8 +152,8 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv)while (phead != plist) {int i; - psta = container_of(plist, struct sta_info, - hash_list); + psta = list_entry(plist, struct sta_info, + hash_list); plist = plist->next;for (i =0 ; i <16 ; i++) {@@ -323,7 +323,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta) plist = phead->next;while (!list_empty (phead)) { - prframe = container_of(plist, struct recv_frame, list); + prframe = list_entry(plist, struct recv_frame, list); plist = plist->next;@@ -399,7 +399,7 @@ void rtw_free_all_stainfo(struct adapter *padapter) plist = phead->next;while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list); plist = plist->next;@@ -435,7 +435,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) plist = phead->next;while (phead != plist) { - psta = container_of(plist, struct sta_info, hash_list); + psta = list_entry(plist, struct sta_info, hash_list);if ((!memcmp (psta->hwaddr, addr,ETH_ALEN )) == true) {/* if found the matched address */ @@ -493,7 +493,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) phead =get_list_head (pacl_node_q); plist = phead->next;while (phead != plist) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + paclnode = list_entry(plist, struct rtw_wlan_acl_node, list); plist = plist->next;if (!memcmp (paclnode->addr, mac_addr,ETH_ALEN )) { --2.7.4
--
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 [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1506734581-10932-1-git-send-email-srishtishar%40gmail.com.
For more options, visit https://groups.google.com/d/optout.--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAB3L5ox9u0pj04pjkiC8MRgx%3DMZqwh%3Dg%3D2VE0-ZG8NYvrUrDBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.