WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] linux-2.6.18: replace list_for_each..._safe() by lis

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] linux-2.6.18: replace list_for_each..._safe() by list_for_each...() where possible
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Fri, 17 Jun 2011 16:39:24 +0100
Delivery-date: Fri, 17 Jun 2011 08:40:02 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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 <jbeulich@xxxxxxxxxx>

--- 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;
 
        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_backend);
--- 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);
 
        for (slot = 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 == dev) {
                                list_del(&e->list);
                                found_dev = 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 = NULL;
        LIST_HEAD(queue);
        char *path, *token;
-       struct watch_adapter *watch, *tmp_watch;
+       struct watch_adapter *watch;
        int err, rc = len;
 
        if (!is_xenstored_ready())
@@ -289,8 +289,7 @@ static ssize_t xenbus_dev_write(struct f
                        
                        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))
                                {



Attachment: xen-list-no-safe.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] linux-2.6.18: replace list_for_each..._safe() by list_for_each...() where possible, Jan Beulich <=