[PATCH 3/6] Staging: rtl8188eu: core: Use list_entry instead of container_of
From: Srishti Sharma
Date: Sat Sep 30 2017 - 03:20:22 EST
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@xxxxxxxxx>
---
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