Skip to contentSkip to conversation

staging: rtl8723au: os_dep: Use list_for_each_entry_safe()

PATCH Superseded Janani Ravichandran 1 participant 1 message Feb 28, 2016 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723au: os_dep: Use list_for_each_entry_safe()

Use list_for_each_entry_safe() instead of a combination of list_for_each_safe() and container_of().

Semantic patch used:

@a@
expression pos, n, head, tmp;
expression mem;
type t;
identifier var;
iterator name list_for_each_entry, list_for_each_entry_safe; iterator name list_for_each, list_for_each_safe; @@

(
- list_for_each(pos, head)
+ list_for_each_entry(var, head, mem)
{
... when != var
- var = \(list_entry \| container_of\)(pos, t, mem); ... when any
}
|
- list_for_each_safe(pos, n, head)
+ list_for_each_entry_safe(var, n, head, mem) {
... when != var
- var = \(list_entry \| container_of\)(pos, t, mem); ... when any
}
)

---
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +1 -2
index 908b84c..c79d623 100644
@@ -1994,8 +1994,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
 
 	phead = get_list_head(queue);
 
-	list_for_each_safe(plist, ptmp, phead) {
-		pnetwork = container_of(plist, struct wlan_network, list);
+	list_for_each_entry_safe(pnetwork, ptmp, phead, list) {
 
 		if (sme->bssid) {
 			if (!ether_addr_equal(pnetwork->network.MacAddress,
Signature · 1 line
2.5.0