Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1e5b3ff authored by Jan Beulich's avatar Jan Beulich Committed by David Vrabel
Browse files

xenbus: prefer list_for_each()



This is more efficient than list_for_each_safe() when list modification
is accompanied by breaking out of the loop.

Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
parent cb5f7e7c
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -364,7 +364,7 @@ static int xenbus_write_transaction(unsigned msg_type,


static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u)
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;
	char *path, *token;
	int err, rc;
	int err, rc;
	LIST_HEAD(staging_q);
	LIST_HEAD(staging_q);
@@ -399,7 +399,7 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u)
		}
		}
		list_add(&watch->list, &u->watches);
		list_add(&watch->list, &u->watches);
	} else {
	} 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) &&
			if (!strcmp(watch->token, token) &&
			    !strcmp(watch->watch.node, path)) {
			    !strcmp(watch->watch.node, path)) {
				unregister_xenbus_watch(&watch->watch);
				unregister_xenbus_watch(&watch->watch);