* [PATCH v2] xenbus: prefer list_for_each()
@ 2016-08-09 10:17 Jan Beulich
0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2016-08-09 10:17 UTC (permalink / raw)
To: David Vrabel, Boris Ostrovsky, Juergen Gross; +Cc: xen-devel, linux-kernel
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>
---
v2: Avoid commit message to continue from subject.
---
drivers/xen/xenbus/xenbus_dev_frontend.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- 4.8-rc1/drivers/xen/xenbus/xenbus_dev_frontend.c
+++ 4.8-rc1-xen-xenbus-dev-list_for_each/drivers/xen/xenbus/xenbus_dev_frontend.c
@@ -364,7 +364,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);
@@ -399,7 +399,7 @@ static int xenbus_write_watch(unsigned m
}
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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-08-09 10:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-09 10:17 [PATCH v2] xenbus: prefer list_for_each() Jan Beulich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).