[PATCH 16/22] list changes

Jörn Engel joern at wohnheim.fh-wedel.de
Tue Dec 21 09:03:22 EST 2004


Change some list.h calls.

Signed-off-by: Jörn Engel <joern at wohnheim.fh-wedel.de>
---

 blockmtd.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

--- linux-2.6.9cow/drivers/mtd/devices/blockmtd.c~blockmtd_list	2004-12-20 22:41:15.000000000 +0100
+++ linux-2.6.9cow/drivers/mtd/devices/blockmtd.c	2004-12-20 22:53:00.000000000 +0100
@@ -412,12 +412,11 @@
 	dev->mtd.priv = dev;
 	dev->mtd.owner = THIS_MODULE;
 
-	list_add(&dev->list, &blkmtd_device_list);
 	if (add_mtd_device(&dev->mtd)) {
 		/* Device didnt get added, so free the entry */
-		list_del(&dev->list);
 		goto devinit_err;
 	}
+	list_add(&dev->list, &blkmtd_device_list);
 	INFO("mtd%d: [%s] erase_size = %dKiB [%ld]", dev->mtd.index,
 			dev->mtd.name + strlen("blkmtd: "),
 			dev->mtd.erasesize >> 10, PAGE_SIZE);
@@ -546,12 +545,11 @@
 
 static void __devexit blockmtd_exit(void)
 {
-	struct list_head *temp1, *temp2;
+	struct list_head *pos, *next;
 
 	/* Remove the MTD devices */
-	list_for_each_safe(temp1, temp2, &blkmtd_device_list) {
-		struct blkmtd_dev *dev = list_entry(temp1, struct blkmtd_dev,
-						    list);
+	list_for_each_safe(pos, next, &blkmtd_device_list) {
+		struct blkmtd_dev *dev = list_entry(pos, typeof(*dev), list);
 		blockmtd_sync(&dev->mtd);
 		del_mtd_device(&dev->mtd);
 		INFO("mtd%d: [%s] removed", dev->mtd.index,




More information about the linux-mtd mailing list