From: "Jan Beulich" Subject: [PATCH] linux-2.6.18: replace list_for_each..._safe() by list_for_each...() where possible Date: Fri, 17 Jun 2011 16:39:24 +0100 Message-ID: <4DFB914C02000078000480ED@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part97BB2C3C.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part97BB2C3C.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline There's no need for using the ..._safe() list iterators when deletion of objects is followed by a loop exit. Signed-off-by: Jan Beulcih --- a/drivers/xen/netback/accel.c +++ b/drivers/xen/netback/accel.c @@ -208,10 +208,10 @@ EXPORT_SYMBOL_GPL(netback_connect_accele */ void netback_disconnect_accelerator(int id, const char *eth_name) { - struct netback_accelerator *accelerator, *next; + struct netback_accelerator *accelerator; =20 mutex_lock(&accelerators_mutex); - list_for_each_entry_safe(accelerator, next, &accelerators_list, = link) { + list_for_each_entry(accelerator, &accelerators_list, link) { if (!strcmp(eth_name, accelerator->eth_name)) { xenbus_for_each_backend (accelerator, netback_accelerator_remove_ba= ckend); --- a/drivers/xen/pciback/vpci.c +++ b/drivers/xen/pciback/vpci.c @@ -146,9 +146,9 @@ void pciback_release_pci_dev(struct pcib spin_lock_irqsave(&vpci_dev->lock, flags); =20 for (slot =3D 0; slot < PCI_SLOT_MAX; slot++) { - struct pci_dev_entry *e, *tmp; - list_for_each_entry_safe(e, tmp, &vpci_dev->dev_list[slot],= - list) { + struct pci_dev_entry *e; + + list_for_each_entry(e, &vpci_dev->dev_list[slot], list) { if (e->dev =3D=3D dev) { list_del(&e->list); found_dev =3D e->dev; --- a/drivers/xen/xenbus/xenbus_dev.c +++ b/drivers/xen/xenbus/xenbus_dev.c @@ -233,7 +233,7 @@ static ssize_t xenbus_dev_write(struct f void *reply =3D NULL; LIST_HEAD(queue); char *path, *token; - struct watch_adapter *watch, *tmp_watch; + struct watch_adapter *watch; int err, rc =3D len; =20 if (!is_xenstored_ready()) @@ -289,8 +289,7 @@ static ssize_t xenbus_dev_write(struct f =09 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)) { --=__Part97BB2C3C.0__= Content-Type: text/plain; name="xen-list-no-safe.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="xen-list-no-safe.patch" Subject: replace list_for_each..._safe() by list_for_each...() where = possible=0A=0AThere's no need for using the ..._safe() list iterators when = deletion=0Aof objects is followed by a loop exit.=0A=0ASigned-off-by: Jan = Beulcih =0A=0A--- a/drivers/xen/netback/accel.c=0A+++ = b/drivers/xen/netback/accel.c=0A@@ -208,10 +208,10 @@ EXPORT_SYMBOL_GPL(net= back_connect_accele=0A */=0A void netback_disconnect_accelerator(int id, = const char *eth_name)=0A {=0A- struct netback_accelerator *accelerator, = *next;=0A+ struct netback_accelerator *accelerator;=0A =0A = mutex_lock(&accelerators_mutex);=0A- list_for_each_entry_safe(accelerato= r, next, &accelerators_list, link) {=0A+ list_for_each_entry(acceler= ator, &accelerators_list, link) {=0A if (!strcmp(eth_name, = accelerator->eth_name)) {=0A xenbus_for_each_backend=0A = (accelerator, netback_accelerator_remove_ba= ckend);=0A--- a/drivers/xen/pciback/vpci.c=0A+++ b/drivers/xen/pciback/vpci= .c=0A@@ -146,9 +146,9 @@ void pciback_release_pci_dev(struct pcib=0A = spin_lock_irqsave(&vpci_dev->lock, flags);=0A =0A for (slot =3D 0; = slot < PCI_SLOT_MAX; slot++) {=0A- struct pci_dev_entry *e, = *tmp;=0A- list_for_each_entry_safe(e, tmp, &vpci_dev->dev_lis= t[slot],=0A- list) {=0A+ = struct pci_dev_entry *e;=0A+=0A+ list_for_each_entry(e, = &vpci_dev->dev_list[slot], list) {=0A if (e->dev =3D=3D = dev) {=0A list_del(&e->list);=0A = found_dev =3D e->dev;=0A--- a/drivers/xen/xenbus/xenbus_dev.c=0A+++= b/drivers/xen/xenbus/xenbus_dev.c=0A@@ -233,7 +233,7 @@ static ssize_t = xenbus_dev_write(struct f=0A void *reply =3D NULL;=0A LIST_HEAD(q= ueue);=0A char *path, *token;=0A- struct watch_adapter *watch, = *tmp_watch;=0A+ struct watch_adapter *watch;=0A int err, rc =3D = len;=0A =0A if (!is_xenstored_ready())=0A@@ -289,8 +289,7 @@ static = ssize_t xenbus_dev_write(struct f=0A =0A = list_add(&watch->list, &u->watches);=0A } else {=0A- = list_for_each_entry_safe(watch, tmp_watch,=0A- = &u->watches, list) {=0A+ = list_for_each_entry(watch, &u->watches, list) {=0A = if (!strcmp(watch->token, token) &&=0A = !strcmp(watch->watch.node, path))=0A {=0A --=__Part97BB2C3C.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part97BB2C3C.0__=--