[patch][untested] remove read only devices from mtdchar.c

Jörn Engel joern at wohnheim.fh-wedel.de
Tue Sep 3 08:23:14 EDT 2002


On Tue, 3 September 2002 13:14:04 +0200, Jörn Engel wrote:
> This removes the horrible ro-devices from mtdchar.c.
> 
> Note:
> My job has ended, and so has my access to any test hardware. Until I
> have uml working or some hardware of my own, someone else has to do
> the testing. Sorry!
> 
> Jörn
-------------- next part --------------
diff -Naur 0_staa/drivers/mtd/mtdchar.c 0_staa_no_rodev/drivers/mtd/mtdchar.c
--- 0_staa/drivers/mtd/mtdchar.c	Tue Jul 16 18:28:45 2002
+++ 0_staa_no_rodev/drivers/mtd/mtdchar.c	Tue Sep  3 13:01:29 2002
@@ -24,7 +24,6 @@
 
 static devfs_handle_t devfs_dir_handle;
 static devfs_handle_t devfs_rw_handle[MAX_MTD_DEVICES];
-static devfs_handle_t devfs_ro_handle[MAX_MTD_DEVICES];
 #endif
 
 static loff_t mtd_lseek (struct file *file, loff_t offset, int orig)
@@ -61,7 +60,7 @@
 static int mtd_open(struct inode *inode, struct file *file)
 {
 	int minor = MINOR(inode->i_rdev);
-	int devnum = minor >> 1;
+	int devnum = minor;
 	struct mtd_info *mtd;
 
 	DEBUG(MTD_DEBUG_LEVEL0, "MTD_open\n");
@@ -69,10 +68,6 @@
 	if (devnum >= MAX_MTD_DEVICES)
 		return -ENODEV;
 
-	/* You can't open the RO devices RW */
-	if ((file->f_mode & 2) && (minor & 1))
-		return -EACCES;
-
 	mtd = get_mtd_device(NULL, devnum);
 	
 	if (!mtd)
@@ -478,12 +473,6 @@
 			DEVFS_FL_DEFAULT, MTD_CHAR_MAJOR, mtd->index*2,
 			S_IFCHR | S_IRUGO | S_IWUGO,
 			&mtd_fops, NULL);
-
-	sprintf(name, "%dro", mtd->index);
-	devfs_ro_handle[mtd->index] = devfs_register(devfs_dir_handle, name,
-			DEVFS_FL_DEFAULT, MTD_CHAR_MAJOR, mtd->index*2+1,
-			S_IFCHR | S_IRUGO,
-			&mtd_fops, NULL);
 }
 
 static void mtd_notify_remove(struct mtd_info* mtd)
@@ -492,7 +481,6 @@
 		return;
 
 	devfs_unregister(devfs_rw_handle[mtd->index]);
-	devfs_unregister(devfs_ro_handle[mtd->index]);
 }
 #endif
 


More information about the linux-mtd mailing list