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


Groups > linux.kernel > #1742542

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

From Srishti Sharma <srishtishar@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 3/6] Staging: rtl8188eu: core: Use list_entry instead of container_of
Date 2017-09-30 09:30 +0200
Message-ID <uvknL-12H-3@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_mlme.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index f663e6c..71b1f8a 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -198,7 +198,7 @@ struct wlan_network *rtw_find_network(struct __queue *scanned_queue, u8 *addr)
 	plist = phead->next;
 
 	while (plist != phead) {
-		pnetwork = container_of(plist, struct wlan_network, list);
+		pnetwork = list_entry(plist, struct wlan_network, list);
 		if (!memcmp(addr, pnetwork->network.MacAddress, ETH_ALEN))
 			break;
 		plist = plist->next;
@@ -223,7 +223,7 @@ void rtw_free_network_queue(struct adapter *padapter, u8 isfreeall)
 	plist = phead->next;
 
 	while (phead != plist) {
-		pnetwork = container_of(plist, struct wlan_network, list);
+		pnetwork = list_entry(plist, struct wlan_network, list);
 
 		plist = plist->next;
 
@@ -342,7 +342,7 @@ struct	wlan_network	*rtw_get_oldest_wlan_network(struct __queue *scanned_queue)
 	phead = get_list_head(scanned_queue);
 
 	for (plist = phead->next; plist != phead; plist = plist->next) {
-		pwlan = container_of(plist, struct wlan_network, list);
+		pwlan = list_entry(plist, struct wlan_network, list);
 
 		if (!pwlan->fixed) {
 			if (!oldest || time_after(oldest->last_scanned, pwlan->last_scanned))
@@ -421,7 +421,7 @@ void rtw_update_scanned_network(struct adapter *adapter, struct wlan_bssid_ex *t
 	plist = phead->next;
 
 	while (phead != plist) {
-		pnetwork	= container_of(plist, struct wlan_network, list);
+		pnetwork	= list_entry(plist, struct wlan_network, list);
 
 		if (is_same_network(&(pnetwork->network), target))
 			break;
-- 
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