[PATCH 4/22] Change init/exit functions

Jörn Engel joern at wohnheim.fh-wedel.de
Tue Dec 21 08:44:08 EST 2004


Move/change the init and exit functions.

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

 blockmtd.c |   53 ++++++++++++++++++++++++++---------------------------
 1 files changed, 26 insertions(+), 27 deletions(-)

--- linux-2.6.9cow/drivers/mtd/devices/blockmtd.c~blockmtd_init_exit	2004-12-20 18:37:15.000000000 +0100
+++ linux-2.6.9cow/drivers/mtd/devices/blockmtd.c	2004-12-20 18:39:30.000000000 +0100
@@ -534,25 +534,6 @@
 	return NULL;
 }
 
-
-/* Cleanup and exit - sync the device and kill of the kernel thread */
-static void __devexit cleanup_blkmtd(void)
-{
-	struct list_head *temp1, *temp2;
-
-	/* Remove the MTD devices */
-	list_for_each_safe(temp1, temp2, &blkmtd_device_list) {
-		struct blkmtd_dev *dev = list_entry(temp1, struct blkmtd_dev,
-						    list);
-		blkmtd_sync(&dev->mtd_info);
-		del_mtd_device(&dev->mtd_info);
-		info("mtd%d: [%s] removed", dev->mtd_info.index,
-		     dev->mtd_info.name + strlen("blkmtd: "));
-		list_del(&dev->list);
-		free_device(dev);
-	}
-}
-
 #ifndef MODULE
 
 /* Handle kernel boot params */
@@ -599,26 +580,44 @@
 #endif
 
 
-/* Startup */
-static int __init init_blkmtd(void)
+static int __init blockmtd_init(void)
 {
 	int i;
 
 	info("version " VERSION);
-	/* Check args - device[0] is the bare minimum*/
-	if(!device[0]) {
+	/* Check args - device[0] is the bare minimum */
+	if (!device[0]) {
 		err("error: missing `device' name\n");
 		return -EINVAL;
 	}
 
-	for(i = 0; i < MAX_DEVICES; i++)
+	for (i = 0; i < MAX_DEVICES; i++)
 		add_device(device[i], erasesz[i] << 10);
 
-	if(list_empty(&blkmtd_device_list))
+	if (list_empty(&blkmtd_device_list))
 		return -EINVAL;
 
 	return 0;
 }
 
-module_init(init_blkmtd);
-module_exit(cleanup_blkmtd);
+
+static void __devexit blockmtd_exit(void)
+{
+	struct list_head *temp1, *temp2;
+
+	/* Remove the MTD devices */
+	list_for_each_safe(temp1, temp2, &blkmtd_device_list) {
+		struct blkmtd_dev *dev = list_entry(temp1, struct blkmtd_dev,
+						    list);
+		blkmtd_sync(&dev->mtd_info);
+		del_mtd_device(&dev->mtd_info);
+		info("mtd%d: [%s] removed", dev->mtd_info.index,
+				dev->mtd_info.name + strlen("blkmtd: "));
+		list_del(&dev->list);
+		free_device(dev);
+	}
+}
+
+
+module_init(blockmtd_init);
+module_exit(blockmtd_exit);




More information about the linux-mtd mailing list