Skip to content

Commit

Permalink
xenbus: prefer list_for_each()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Juergen Gross <[email protected]>
Signed-off-by: David Vrabel <[email protected]>
  • Loading branch information
jbeulich authored and David Vrabel committed Oct 24, 2016
1 parent cb5f7e7 commit e1e5b3f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/xen/xenbus/xenbus_dev_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
struct watch_adapter *watch, *tmp_watch;
struct watch_adapter *watch;
char *path, *token;
int err, rc;
LIST_HEAD(staging_q);
Expand Down Expand Up @@ -399,7 +399,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);
Expand Down

0 comments on commit e1e5b3f

Please sign in to comment.