mirror of
https://github.com/torvalds/linux.git
synced 2024-11-29 15:41:36 +00:00
staging: rtl8712: Use list iterators and helpers
Use existing list iterators and helper functions. The following coccinelle script was used to convert the code. @@ identifier v1, v2, v3, v4; symbol next; expression e; iterator name list_for_each; statement S; @@ <+... ( - e = v1->next; | - e = get_next(v1); ) ... when != e - while ( \( v1 != e \| e != v1 \) ) + list_for_each (e, v1) { ... - v2 = container_of(e, struct v3, v4); + v2 = list_entry(e, struct v3, v4); ?- if (!v2) S ... ( - e = e->next; | - e = get_next(e); ) ... when != e } ...+> Compile tested only. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20210428173523.149958-1-linux@roeck-us.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
23017c8842
commit
3580942c86
@ -139,10 +139,8 @@ static struct wlan_network *r8712_find_network(struct __queue *scanned_queue,
|
||||
return NULL;
|
||||
spin_lock_irqsave(&scanned_queue->lock, irqL);
|
||||
phead = &scanned_queue->queue;
|
||||
plist = phead->next;
|
||||
while (plist != phead) {
|
||||
pnetwork = container_of(plist, struct wlan_network, list);
|
||||
plist = plist->next;
|
||||
list_for_each(plist, phead) {
|
||||
pnetwork = list_entry(plist, struct wlan_network, list);
|
||||
if (!memcmp(addr, pnetwork->network.MacAddress, ETH_ALEN))
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user