mtd/drivers/mtd/devices block2mtd.c,1.9,1.10

joern at infradead.org joern at infradead.org
Wed Dec 22 08:09:21 EST 2004


Update of /home/cvs/mtd/drivers/mtd/devices
In directory phoenix.infradead.org:/home/joern/mtd/drivers/mtd/devices

Modified Files:
	block2mtd.c 
Log Message:
Change some macros.  "err" and "info" were both macros and variables,
which is at best confusing to the reader.



Index: block2mtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/block2mtd.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- block2mtd.c	22 Dec 2004 13:08:52 -0000	1.9
+++ block2mtd.c	22 Dec 2004 13:09:19 -0000	1.10
@@ -33,12 +33,8 @@
 #include <linux/mtd/mtd.h>
 #include <linux/buffer_head.h>
 
-#define ERROR(fmt, args...) printk(KERN_ERR "blockmtd: " fmt , ## args)
-
-#define err(format, arg...) printk(KERN_ERR "blkmtd: " format "\n" , ## arg)
-#define info(format, arg...) printk(KERN_INFO "blkmtd: " format "\n" , ## arg)
-#define warn(format, arg...) printk(KERN_WARNING "blkmtd: " format "\n" , ## arg)
-#define crit(format, arg...) printk(KERN_CRIT "blkmtd: " format "\n" , ## arg)
+#define ERROR(fmt, args...) printk(KERN_ERR "blockmtd: " fmt "\n" , ## args)
+#define INFO(fmt, args...) printk(KERN_INFO "blockmtd: " fmt "\n" , ## args)
 
 
 /* Default erase size in K, always make it a multiple of PAGE_SIZE */
@@ -57,8 +53,6 @@
 /* Static info about the MTD, used in cleanup_module */
 static LIST_HEAD(blkmtd_device_list);
 
-#define MAX_DEVICES 4
-
 
 #define PAGE_READAHEAD 64
 
@@ -143,7 +137,7 @@
 		err=0;
 		page = page_readahead(mapping,index);
 		if( unlikely(!page) ) {
-			crit("unable to read page (%d) in write_pages\n",index);
+			ERROR("unable to read page (%d) in write_pages\n", index);
 			err=-ENOMEM;
 		}
 		//if(IS_ERR(page)) err=-EIO;
@@ -255,7 +249,7 @@
 
 	if (!numregions) {
 		/* Not a valid erase block */
-		err("erase: invalid erase request 0x%lX @ 0x%08zX", len, from);
+		ERROR("erase: invalid erase request 0x%lX @ 0x%08zX", len,from);
 		instr->state = MTD_ERASE_FAILED;
 		err = -EIO;
 	}
@@ -264,7 +258,7 @@
 		/* do the erase */
 		err = write_pages(dev, NULL, from, len, &retlen);
 		if (err || retlen != len) {
-			err("erase failed err = %d", err);
+			ERROR("erase failed err = %d", err);
 			instr->state = MTD_ERASE_FAILED;
 		} else {
 			instr->state = MTD_ERASE_DONE;
@@ -445,12 +439,12 @@
 	bdev = open_by_devnum(name_to_dev_t(devname), mode);
 #endif
 	if (IS_ERR(bdev)) {
-		err("error: cannot open device %s", devname);
+		ERROR("error: cannot open device %s", devname);
 		return NULL;
 	}
 
 	if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
-		err("attempting to use an MTD device as a block device");
+		ERROR("attempting to use an MTD device as a block device");
 		blkdev_put(bdev);
 		return NULL;
 	}
@@ -497,7 +491,7 @@
 		list_del(&dev->list);
 		goto devinit_err;
 	} else {
-		info("mtd%d: [%s] erase_size = %dKiB [%ld]", dev->mtd_info.index, dev->mtd_info.name + strlen("blkmtd: "), dev->mtd_info.erasesize >> 10, PAGE_SIZE);
+		INFO("mtd%d: [%s] erase_size = %dKiB [%ld]", dev->mtd_info.index, dev->mtd_info.name + strlen("blkmtd: "), dev->mtd_info.erasesize >> 10, PAGE_SIZE);
 	}
 	return dev;
 
@@ -617,7 +611,7 @@
 
 static int __init blockmtd_init(void)
 {
-	info("version " VERSION);
+	INFO("version " VERSION);
 	return 0;
 }
 
@@ -632,7 +626,7 @@
 						    list);
 		blkmtd_sync(&dev->mtd_info);
 		del_mtd_device(&dev->mtd_info);
-		info("mtd%d: [%s] removed", dev->mtd_info.index,
+		INFO("mtd%d: [%s] removed", dev->mtd_info.index,
 				dev->mtd_info.name + strlen("blkmtd: "));
 		list_del(&dev->list);
 		free_device(dev);





More information about the linux-mtd-cvs mailing list