]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xenbus: prefer list_for_each()
authorJan Beulich <JBeulich@suse.com>
Mon, 24 Oct 2016 15:03:49 +0000 (09:03 -0600)
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>
Fri, 3 Feb 2017 20:55:26 +0000 (15:55 -0500)
This is more efficient than list_for_each_safe() when list modification
is accompanied by breaking out of the loop.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
OraBug: 25497392

(cherry picked from commit e1e5b3ff41983f506c3cbcf123fe7d682f61a8f1)
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
drivers/xen/xenbus/xenbus_dev_frontend.c

index ee10d8e6261f0257760ecaa6718c56e076fba7db..ca0b51457c8b6cf3cc481ea9c803ec430889bdbd 100644 (file)
@@ -366,7 +366,7 @@ out:
 
 static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u)
 {
-       struct watch_adapter *watch, *tmp_watch;
+       struct watch_adapter *watch;
        char *path, *token;
        int err, rc;
        LIST_HEAD(staging_q);
@@ -401,7 +401,7 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u)
                }
                list_add(&watch->list, &u->watches);
        } else {
-               list_for_each_entry_safe(watch, tmp_watch, &u->watches, list) {
+               list_for_each_entry(watch, &u->watches, list) {
                        if (!strcmp(watch->token, token) &&
                            !strcmp(watch->watch.node, path)) {
                                unregister_xenbus_watch(&watch->watch);