Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1742541

[PATCH 2/6] Staging: rtl8188eu: core: Use list_entry instead of container_of

From Srishti Sharma <srishtishar@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 2/6] Staging: rtl8188eu: core: Use list_entry instead of container_of
Date 2017-09-30 09:20 +0200
Message-ID <uvke6-YT-27@gated-at.bofh.it> (permalink)
References <uvke5-YT-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


For variables of the type struct list_head use list_entry to access
current list element instead of using container_of.
Done using the following semantic patch by coccinelle.

@r@
struct list_head* l;
@@

-container_of
+list_entry
   (l,...)

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
---
 drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
index 22cf362..f9df4ac 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
@@ -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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] Replace container_of with list_entry Srishti Sharma <srishtishar@gmail.com> - 2017-09-30 09:20 +0200
  [PATCH 1/6] Staging: rtl8188eu: core: Use list_entry instead of container_of Srishti Sharma <srishtishar@gmail.com> - 2017-09-30 09:20 +0200
  [PATCH 2/6] Staging: rtl8188eu: core: Use list_entry instead of container_of Srishti Sharma <srishtishar@gmail.com> - 2017-09-30 09:20 +0200
  [PATCH 3/6] Staging: rtl8188eu: core: Use list_entry instead of container_of Srishti Sharma <srishtishar@gmail.com> - 2017-09-30 09:30 +0200
  [PATCH 4/6] Staging: rtl8188eu: core: Use list_entry instead of container_of Srishti Sharma <srishtishar@gmail.com> - 2017-09-30 09:30 +0200
  [PATCH 6/6] Staging: rtl8188eu: core: Use list_entry instead of container_of Srishti Sharma <srishtishar@gmail.com> - 2017-09-30 09:30 +0200
    Re: [Outreachy kernel] [PATCH 6/6] Staging: rtl8188eu: core: Use  list_entry instead of container_of Julia Lawall <julia.lawall@lip6.fr> - 2017-09-30 10:40 +0200
  [PATCH 5/6] Staging: rtl8188eu: core: Use list_entry instead of container_of Srishti Sharma <srishtishar@gmail.com> - 2017-09-30 09:30 +0200
  Re: [PATCH 0/6] Replace container_of with list_entry "Tobin C. Harding" <me@tobin.cc> - 2017-09-30 13:20 +0200

csiph-web