staging: rtl8192e: Use list_for_each_entry()
PATCH 1/1 staging: rtl8192e: Use list_for_each_entry()
Use list_for_each_entry() rather than a combination of list_for_each() and list_entry().
Semantic patch used:
@a@
expression pos, n, head;
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/rtl8192e/rtllib_rx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rtl8192e/rtllib_rx.c +1 -2
@@ -402,8 +402,7 @@ static int is_duplicate_packet(struct rtllib_device *ieee,u8 *mac = header->addr2;int index = mac[5 ] %IEEE_IBSS_MAC_HASH_SIZE ; -list_for_each (p, &ieee->ibss_mac_hash[index]) { - entry = list_entry(p, struct ieee_ibss_seq, list); +list_for_each_entry (entry, &ieee->ibss_mac_hash[index], list) {if (!memcmp (entry->mac, mac,ETH_ALEN ))break ; }
Signature · 1 line
2.5.0
Quoted 32 lines · Janani Ravichandran
Use
list_for_each_entry()rather than a combination oflist_for_each()andlist_entry().Semantic patch used:
@a@
expression pos, n, head;
expression mem;
type t;
identifier var;
iterator namelist_for_each_entry,list_for_each_entry_safe; iterator namelist_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
}
)
Quoted 5 lines
Signed-off-by Janani Ravichandran <[email protected]>--- drivers/staging/rtl8192e/rtllib_rx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
There has been a mistake. Please ignore this. Sorry.
Janani.
Quoted 22 lines
drivers/staging/rtl8192e/rtllib_rx.c +1
-2@@ -402,8 +402,7 @@ static int is_duplicate_packet(struct rtllib_device *ieee, u8 *mac = header->addr2;int index = mac[5 ] %IEEE_IBSS_MAC_HASH_SIZE ; -list_for_each (p, &ieee->ibss_mac_hash[index]) { - entry = list_entry(p, struct ieee_ibss_seq, list); +list_for_each_entry (entry, &ieee->ibss_mac_hash[index], list) {if (!memcmp (entry->mac, mac,ETH_ALEN ))break; }--
2.5.0