From gleixner at infradead.org  Fri May  2 15:18:01 2003
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:48:09 2006
Subject: mtd/util Makefile,1.31,1.32
Message-ID: <E19Bg2j-0008Pu-00@phoenix.infradead.org>

Update of /home/cvs/mtd/util
In directory phoenix.infradead.org:/tmp/cvs-serv32345

Modified Files:
	Makefile 
Log Message:
fix typo, remove -lz for eraseall

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/util/Makefile,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- Makefile	30 Apr 2003 15:13:00 -0000	1.31
+++ Makefile	2 May 2003 19:17:58 -0000	1.32
@@ -7,6 +7,8 @@
 CC := $(CROSS)gcc
 CFLAGS += -I../include -O2 -Wall -Wstrict-prototypes -Wshadow
 
+LDFLAGS = -lc
+
 TARGETS = ftl_format erase eraseall nftldump nanddump doc_loadbios \
 nftl_format mkfs.jffs ftl_check mkfs.jffs2 lock unlock \
 einfo mtd_debug fcp nandwrite jffs2dump #jffs2reader
@@ -27,7 +29,7 @@
 	$(CC) $(LDFLAGS) -o $@ $^ -lz
 
 eraseall: crc32.o eraseall.o
-	$(CC) $(LDLAGS) -o $@ $^ -lz
+	$(CC) $(LDFLAGS) -o $@ $^
 
 jffs2reader: jffs2reader.o
 	$(CC) $(LDFLAGS) -o $@ $^ -lz 


From gleixner at infradead.org  Fri May  2 15:27:35 2003
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:48:09 2006
Subject: mtd/util eraseall.c,1.11,1.12
Message-ID: <E19BgBz-0008Rw-00@phoenix.infradead.org>

Update of /home/cvs/mtd/util
In directory phoenix.infradead.org:/tmp/cvs-serv32471

Modified Files:
	eraseall.c 
Log Message:
remove zlib.h

Index: eraseall.c
===================================================================
RCS file: /home/cvs/mtd/util/eraseall.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- eraseall.c	3 Apr 2003 11:42:56 -0000	1.11
+++ eraseall.c	2 May 2003 19:27:32 -0000	1.12
@@ -35,10 +35,6 @@
 #include <getopt.h>
 #include <sys/ioctl.h>
 #include <sys/mount.h>
-
-#define crc32 __complete_crap
-#include <zlib.h>
-#undef crc32
 #include "crc32.h"
 
 #include <linux/mtd/mtd.h>


From gleixner at infradead.org  Fri May  2 16:20:56 2003
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:48:09 2006
Subject: mtd/util Makefile,1.32,1.33
Message-ID: <E19Bh1c-0000S9-00@phoenix.infradead.org>

Update of /home/cvs/mtd/util
In directory phoenix.infradead.org:/tmp/cvs-serv1732

Modified Files:
	Makefile 
Log Message:
remove bogus -lc

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/util/Makefile,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- Makefile	2 May 2003 19:17:58 -0000	1.32
+++ Makefile	2 May 2003 20:20:53 -0000	1.33
@@ -7,8 +7,6 @@
 CC := $(CROSS)gcc
 CFLAGS += -I../include -O2 -Wall -Wstrict-prototypes -Wshadow
 
-LDFLAGS = -lc
-
 TARGETS = ftl_format erase eraseall nftldump nanddump doc_loadbios \
 nftl_format mkfs.jffs ftl_check mkfs.jffs2 lock unlock \
 einfo mtd_debug fcp nandwrite jffs2dump #jffs2reader


From tharbaugh at lnxi.com  Tue May  6 17:34:44 2003
From: tharbaugh at lnxi.com (Thayne Harbaugh)
Date: Mon May 15 21:48:09 2006
Subject: mtd/drivers/mtd/chips cfi_cmdset_0002.c,1.68,1.69
	jedec_probe.c,1.25,1.26
Message-ID: <E19DA5E-0005MX-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv20604

Modified Files:
	cfi_cmdset_0002.c jedec_probe.c 
Log Message:
Add FIXME comments.
change __u32 to more correct cfi_word.
Fix problem in cfi_cmdset_0002.c erase functions for multi-byte wide parts.
use more jedec_table[] information in jedec_setup().

Index: cfi_cmdset_0002.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0002.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- cfi_cmdset_0002.c	21 Apr 2003 23:26:25 -0000	1.68
+++ cfi_cmdset_0002.c	6 May 2003 21:34:40 -0000	1.69
@@ -76,6 +76,7 @@
 		cfi_send_gen_cmd(0xaa, 0x555, base, map, cfi, cfi->device_type, NULL);
 		cfi_send_gen_cmd(0x55, 0x2aa, base, map, cfi, cfi->device_type, NULL);
 		cfi_send_gen_cmd(0x90, 0x555, base, map, cfi, cfi->device_type, NULL);
+		/* FIXME - should have a delay before continuing */
 		cfi->mfr = cfi_read_query(map, base);
 		cfi->id = cfi_read_query(map, base + ofs_factor);    
 
@@ -107,6 +108,10 @@
 				cfi->cfiq->EraseRegionInfo[j] = swap;
 			}
 		}
+		/*
+		 * FIXME - These might already be setup (more correctly)
+		 * buy jedec_probe.c.
+		 */
 		switch (cfi->device_type) {
 		case CFI_DEVICETYPE_X8:
 			cfi->addr_unlock1 = 0x555; 
@@ -455,7 +460,7 @@
 	return ret;
 }
 
-static int do_write_oneword(struct map_info *map, struct flchip *chip, unsigned long adr, __u32 datum, int fast)
+static int do_write_oneword(struct map_info *map, struct flchip *chip, unsigned long adr, cfi_word datum, int fast)
 {
 	unsigned long timeo = jiffies + HZ;
 	unsigned int oldstatus, status, prev_oldstatus, prev_status;
@@ -646,6 +651,7 @@
 	ret = -EIO;
 	/* reset on all failures. */
 	cfi_write( map, CMD(0xF0), chip->start );
+	/* FIXME - should have reset delay before continuing */
 
  write_done:
 	DISABLE_VPP(map);
@@ -678,7 +684,7 @@
 		int i = ofs - bus_ofs;
 		int n = 0;
 		u_char tmp_buf[8];
-		__u32 datum;
+		cfi_word datum;
 
 		map->copy_from(map, tmp_buf, bus_ofs + cfi->chips[chipnum].start, CFIDEV_BUSWIDTH);
 		while (len && i < CFIDEV_BUSWIDTH)
@@ -718,7 +724,7 @@
 
 	/* We are now aligned, write as much as possible */
 	while(len >= CFIDEV_BUSWIDTH) {
-		__u32 datum;
+		cfi_word datum;
 
 		if (cfi_buswidth_is_1()) {
 			datum = *(__u8*)buf;
@@ -776,7 +782,7 @@
 	if (len & (CFIDEV_BUSWIDTH-1)) {
 		int i = 0, n = 0;
 		u_char tmp_buf[8];
-		__u32 datum;
+		cfi_word datum;
 
 		map->copy_from(map, tmp_buf, ofs + cfi->chips[chipnum].start, CFIDEV_BUSWIDTH);
 		while (len--)
@@ -811,7 +817,7 @@
 	DECLARE_WAITQUEUE(wait, current);
 	int ret = 0;
 	int ta = 0;
-	__u32 ones = 0;
+	cfi_word ones = 0;
 
  retry:
 	cfi_spin_lock(chip->mutex);
@@ -925,7 +931,16 @@
 	DEBUG( MTD_DEBUG_LEVEL3, "MTD %s(): Check 0x%.8x 0x%.8x\n",
 	       __func__, oldstatus, status );
 
-	ones = CMD( (__u8)~0 );
+	if ( cfi_buswidth_is_1() ) {
+		ones =  (__u8)~0;
+	} else if ( cfi_buswidth_is_2() ) {
+		ones = (__u16)~0;
+	} else if ( cfi_buswidth_is_4() ) {
+		ones = (__u32)~0;
+	} else {
+		printk(KERN_WARNING "Unsupported buswidth\n");
+		goto erase_failed;
+	}
 	
 	if ( oldstatus == ones && status == ones ) {
 		/* success - do nothing */
@@ -962,6 +977,7 @@
 	ret = -EIO;
 	/* reset on all failures. */
 	cfi_write( map, CMD(0xF0), chip->start );
+	/* FIXME - should have reset delay before continuing */
 
  erase_done:
 	DISABLE_VPP(map);
@@ -981,7 +997,7 @@
 	DECLARE_WAITQUEUE(wait, current);
 	int ret = 0;
 	int ta = 0;
-	__u32 ones = 0;
+	cfi_word ones = 0;
 
  retry:
 	cfi_spin_lock(chip->mutex);
@@ -1095,7 +1111,16 @@
 	DEBUG( MTD_DEBUG_LEVEL3, "MTD %s(): Check 0x%.8x 0x%.8x\n",
 	       __func__, oldstatus, status );
 
-	ones = CMD( (__u8)~0 );
+	if ( cfi_buswidth_is_1() ) {
+		ones =  (__u8)~0;
+	} else if ( cfi_buswidth_is_2() ) {
+		ones = (__u16)~0;
+	} else if ( cfi_buswidth_is_4() ) {
+		ones = (__u32)~0;
+	} else {
+		printk(KERN_WARNING "Unsupported buswidth\n");
+		goto erase_failed;
+	}
 
 	if ( oldstatus == ones && status == ones ) {
 		/* success - do nothing */
@@ -1132,6 +1157,7 @@
 	ret = -EIO;
 	/* reset on all failures. */
 	cfi_write( map, CMD(0xF0), chip->start );
+	/* FIXME - should have reset delay before continuing */
 
  erase_done:
 	DISABLE_VPP(map);

Index: jedec_probe.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/jedec_probe.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- jedec_probe.c	18 Apr 2003 16:00:57 -0000	1.25
+++ jedec_probe.c	6 May 2003 21:34:41 -0000	1.26
@@ -1251,11 +1251,36 @@
 	 * this should be safe.
 	 */ 
 	cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL);
+	/* FIXME - should have reset delay before continuing */
+}
+
+
+static inline __u8 finfo_uaddr(const struct amd_flash_info *finfo, int device_type)
+{
+	int uaddr_idx;
+	__u8 uaddr = MTD_UADDR_NOT_SUPPORTED;
+
+	switch ( device_type ) {
+	case CFI_DEVICETYPE_X8:  uaddr_idx = 0; break;
+	case CFI_DEVICETYPE_X16: uaddr_idx = 1; break;
+	case CFI_DEVICETYPE_X32: uaddr_idx = 2; break;
+	default:
+		printk(KERN_NOTICE "MTD: %s(): unknown device_type %d\n",
+		       __func__, device_type);
+		goto uaddr_done;
+	}
+
+	uaddr = finfo->uaddr[uaddr_idx];
 
+ uaddr_done:
+	return uaddr;
 }
+
+
 static int cfi_jedec_setup(struct cfi_private *p_cfi, int index)
 {
 	int i,num_erase_regions;
+	__u8 uaddr;
 
 	printk("Found: %s\n",jedec_table[index].name);
 
@@ -1278,6 +1303,19 @@
 		p_cfi->cfiq->EraseRegionInfo[i] = jedec_table[index].regions[i];
 	}
 	p_cfi->cmdset_priv = 0;
+
+	/* This may be redundant for some cases, but it doesn't hurt */
+	p_cfi->mfr = jedec_table[index].mfr_id;
+	p_cfi->id = jedec_table[index].dev_id;
+
+	uaddr = finfo_uaddr(&jedec_table[index], p_cfi->device_type);
+	if ( MTD_UADDR_NOT_SUPPORTED ) {
+		kfree( p_cfi->cfiq );
+		return 0;
+	}
+	p_cfi->addr_unlock1 = unlock_addrs[uaddr].addr1;
+	p_cfi->addr_unlock2 = unlock_addrs[uaddr].addr2;
+
 	return 1; 	/* ok */
 }
 
@@ -1296,7 +1334,6 @@
 {
 	int rc = 0;           /* failure until all tests pass */
 	u32 mfr, id;
-	__u8 uaddr_idx;
 	__u8 uaddr;
 
 	/* The ID's must match */
@@ -1304,18 +1341,19 @@
 		goto match_done;
 	}
 
-	/* unlock addresses must match */
-	switch ( cfi->device_type ) {
-	case CFI_DEVICETYPE_X8:  uaddr_idx = 0; break;
-	case CFI_DEVICETYPE_X16: uaddr_idx = 1; break;
-	case CFI_DEVICETYPE_X32: uaddr_idx = 2; break;
-	default:
-		printk(KERN_NOTICE "MTD: %s(): unknown device_type %d\n",
-		       __func__, cfi->device_type);
+	/* the part size must fit in the memory window */
+	DEBUG( MTD_DEBUG_LEVEL3,
+	       "MTD %s(): Check fit 0x%.8x + 0x%.8x = 0x%.8x\n",
+	       __func__, base, 1 << finfo->DevSize, base + (1 << finfo->DevSize) );
+	if ( base + ( 1 << finfo->DevSize ) > map->size ) {
+		DEBUG( MTD_DEBUG_LEVEL3,
+		       "MTD %s(): 0x%.4x 0x%.4x %dKiB doesn't fit\n",
+		       __func__, finfo->mfr_id, finfo->dev_id,
+		       1 << finfo->DevSize );
 		goto match_done;
 	}
 
-	uaddr = finfo->uaddr[uaddr_idx];
+	uaddr = finfo_uaddr(finfo, cfi->device_type);
 	if ( MTD_UADDR_NOT_SUPPORTED ) {
 		goto match_done;
 	}
@@ -1369,6 +1407,7 @@
 		cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map, cfi, CFI_DEVICETYPE_X8, NULL);
 	}
 	cfi_send_gen_cmd(0x90, cfi->addr_unlock1, base, map, cfi, CFI_DEVICETYPE_X8, NULL);
+	/* FIXME - should have a delay before continuing */
 
  match_done:	
 	return rc;
@@ -1381,6 +1420,10 @@
 	int i;
 	int unlockpass = 0;
 
+	/*
+	 * FIXME - eventually replace these unlock address seeds with
+	 * information from unlock_addrs[].
+	 */
 	if (!cfi->numchips) {
 		switch (cfi->device_type) {
 		case CFI_DEVICETYPE_X8:
@@ -1439,6 +1482,7 @@
 		cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map, cfi, CFI_DEVICETYPE_X8, NULL);
 	}
 	cfi_send_gen_cmd(0x90, cfi->addr_unlock1, base, map, cfi, CFI_DEVICETYPE_X8, NULL);
+	/* FIXME - should have a delay before continuing */
 
 	if (!cfi->numchips) {
 		/* This is the first time we're called. Set up the CFI 


From spse at infradead.org  Wed May  7 06:13:50 2003
From: spse at infradead.org (spse@infradead.org)
Date: Mon May 15 21:48:09 2006
Subject: mtd/drivers/mtd/maps pcmciamtd.c,1.39,1.40
Message-ID: <E19DLvq-0004C6-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv16111

Modified Files:
	pcmciamtd.c 
Log Message:


Changes for 2.5

Dont use own cs_error anymore

Use pcmcia_register_driver/pcmcia_unregister_driver instead of
    register_pccard_driver/unregister_pccard_driver

Index: pcmciamtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pcmciamtd.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- pcmciamtd.c	6 Jan 2003 17:51:38 -0000	1.39
+++ pcmciamtd.c	7 May 2003 10:13:47 -0000	1.40
@@ -106,11 +106,13 @@
 
 
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69)
 static inline void cs_error(client_handle_t handle, int func, int ret)
 {
 	error_info_t err = { func, ret };
 	CardServices(ReportError, handle, &err);
 }
+#endif
 
 
 /* read/write{8,16} copy_{from,to} routines with window remapping to access whole card */
@@ -828,6 +830,18 @@
 }
 
 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,68)
+static struct pcmcia_driver pcmciamtd_driver = {
+	.drv		= {
+		.name	= "pcmciamtd"
+	},
+	.attach		= pcmciamtd_attach,
+	.detach		= pcmciamtd_detach,
+	.owner		= THIS_MODULE
+};
+#endif
+
+
 static int __init init_pcmciamtd(void)
 {
 	servinfo_t serv;
@@ -851,15 +865,24 @@
 		info("bad mem_type (%d), using default", mem_type);
 		mem_type = 0;
 	}
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,68)
+	return pcmcia_register_driver(&pcmciamtd_driver);
+#else
 	register_pccard_driver(&dev_info, &pcmciamtd_attach, &pcmciamtd_detach);
 	return 0;
+#endif
 }
 
 
 static void __exit exit_pcmciamtd(void)
 {
 	DEBUG(1, DRIVER_DESC " unloading");
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,68)
+	pcmcia_unregister_driver(&pcmciamtd_driver);
+#else
 	unregister_pccard_driver(&dev_info);
+#endif
 
 	while(dev_list) {
 		dev_link_t *link = dev_list;


From gleixner at infradead.org  Wed May  7 16:59:19 2003
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:48:09 2006
Subject: mtd/util mkfs.jffs2.c,1.36,1.37
Message-ID: <E19DW0V-0002JD-00@phoenix.infradead.org>

Update of /home/cvs/mtd/util
In directory phoenix.infradead.org:/tmp/cvs-serv8866

Modified Files:
	mkfs.jffs2.c 
Log Message:
remove bogus :: in short options

Index: mkfs.jffs2.c
===================================================================
RCS file: /home/cvs/mtd/util/mkfs.jffs2.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- mkfs.jffs2.c	3 Apr 2003 11:49:22 -0000	1.36
+++ mkfs.jffs2.c	7 May 2003 20:59:16 -0000	1.37
@@ -1220,7 +1220,7 @@
 	struct filesystem_entry *root;
 
 	while ((opt = getopt_long(argc, argv, 
-					"D:d:r:s:o:qUPfh?vVe:lbp::nc:", long_options, &c)) >= 0) 
+					"D:d:r:s:o:qUPfh?vVe:lbp:nc:", long_options, &c)) >= 0) 
 	{
 		switch (opt) {
 			case 'D':


From dwmw2 at infradead.org  Thu May  8 03:35:31 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:10 2006
Subject: mtd/util mkfs.jffs2.c,1.37,1.38
Message-ID: <E19DfwB-0007Qc-00@phoenix.infradead.org>

Update of /home/cvs/mtd/util
In directory phoenix.infradead.org:/tmp/cvs-serv28072

Modified Files:
	mkfs.jffs2.c 
Log Message:
Put back non-bogus double colon which means 'optional' argument :)


Index: mkfs.jffs2.c
===================================================================
RCS file: /home/cvs/mtd/util/mkfs.jffs2.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- mkfs.jffs2.c	7 May 2003 20:59:16 -0000	1.37
+++ mkfs.jffs2.c	8 May 2003 07:35:28 -0000	1.38
@@ -1220,7 +1220,7 @@
 	struct filesystem_entry *root;
 
 	while ((opt = getopt_long(argc, argv, 
-					"D:d:r:s:o:qUPfh?vVe:lbp:nc:", long_options, &c)) >= 0) 
+					"D:d:r:s:o:qUPfh?vVe:lbp::nc:", long_options, &c)) >= 0) 
 	{
 		switch (opt) {
 			case 'D':


From dwmw2 at infradead.org  Thu May  8 04:07:01 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:10 2006
Subject: mtd/drivers/mtd/nand nand_ids.c,1.2,1.3
Message-ID: <E19DgQf-0007jQ-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv29700

Modified Files:
	nand_ids.c 
Log Message:
http://physics.nist.gov/cuu/Units/binary.html


Index: nand_ids.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_ids.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- nand_ids.c	18 Feb 2003 14:33:31 -0000	1.2
+++ nand_ids.c	8 May 2003 08:06:58 -0000	1.3
@@ -19,21 +19,21 @@
 *	Chip ID list
 */
 struct nand_flash_dev nand_flash_ids[] = {
-	{"NAND 1MB 5V", 0x6e, 20, 0x1000, 1},	// 1Mb 5V
-	{"NAND 2MB 5V", 0x64, 21, 0x1000, 1},	// 2Mb 5V
-	{"NAND 4MB 5V", 0x6b, 22, 0x2000, 0},	// 4Mb 5V
-	{"NAND 1MB 3,3V", 0xe8, 20, 0x1000, 1},	// 1Mb 3.3V
-	{"NAND 1MB 3,3V", 0xec, 20, 0x1000, 1},	// 1Mb 3.3V
-	{"NAND 2MB 3,3V", 0xea, 21, 0x1000, 1},	// 2Mb 3.3V
-	{"NAND 4MB 3,3V", 0xd5, 22, 0x2000, 0},	// 4Mb 3.3V
-	{"NAND 4MB 3,3V", 0xe3, 22, 0x2000, 0},	// 4Mb 3.3V
-	{"NAND 4MB 3,3V", 0xe5, 22, 0x2000, 0},	// 4Mb 3.3V
-	{"NAND 8MB 3,3V", 0xd6, 23, 0x2000, 0},	// 8Mb 3.3V
-	{"NAND 8MB 3,3V", 0xe6, 23, 0x2000, 0},	// 8Mb 3.3V
-	{"NAND 16MB 3,3V", 0x73, 24, 0x4000, 0},// 16Mb 3,3V
-	{"NAND 32MB 3,3V", 0x75, 25, 0x4000, 0}, // 32Mb 3,3V
-	{"NAND 64MB 3,3V", 0x76, 26, 0x4000, 0}, // 64Mb 3,3V
-	{"NAND 128MB 3,3V", 0x79, 27, 0x4000, 0}, // 128Mb 3,3V
+	{"NAND 1MiB 5V", 0x6e, 20, 0x1000, 1},
+	{"NAND 2MiB 5V", 0x64, 21, 0x1000, 1},
+	{"NAND 4MiB 5V", 0x6b, 22, 0x2000, 0},
+	{"NAND 1MiB 3,3V", 0xe8, 20, 0x1000, 1},
+	{"NAND 1MiB 3,3V", 0xec, 20, 0x1000, 1},
+	{"NAND 2MiB 3,3V", 0xea, 21, 0x1000, 1},
+	{"NAND 4MiB 3,3V", 0xd5, 22, 0x2000, 0},
+	{"NAND 4MiB 3,3V", 0xe3, 22, 0x2000, 0},
+	{"NAND 4MiB 3,3V", 0xe5, 22, 0x2000, 0},
+	{"NAND 8MiB 3,3V", 0xd6, 23, 0x2000, 0},
+	{"NAND 8MiB 3,3V", 0xe6, 23, 0x2000, 0},
+	{"NAND 16MiB 3,3V", 0x73, 24, 0x4000, 0},
+	{"NAND 32MiB 3,3V", 0x75, 25, 0x4000, 0},
+	{"NAND 64MiB 3,3V", 0x76, 26, 0x4000, 0},
+	{"NAND 128MiB 3,3V", 0x79, 27, 0x4000, 0},
 	{NULL,}
 };
 


From dwmw2 at infradead.org  Fri May  9 18:53:52 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:10 2006
Subject: mtd/drivers/mtd mtdblock-24.c,1.2,1.3
Message-ID: <E19EGkS-0002nH-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv10719

Modified Files:
	mtdblock-24.c 
Log Message:
urgh. signal crap in 2.4 too now

Index: mtdblock-24.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdblock-24.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- mtdblock-24.c	24 Jan 2003 15:58:49 -0000	1.2
+++ mtdblock-24.c	9 May 2003 22:53:49 -0000	1.3
@@ -247,6 +247,10 @@
 static DECLARE_MUTEX_LOCKED(thread_sem);
 static DECLARE_WAIT_QUEUE_HEAD(thr_wq);
 
+#ifdef __rh_config_h__
+#define sigmask_lock sighand->siglock
+#endif
+
 int mtdblock_thread(void *dummy)
 {
 	struct task_struct *tsk = current;


From dwmw2 at infradead.org  Fri May  9 18:54:30 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:10 2006
Subject: mtd/include/linux/mtd compatmac.h,1.47,1.48
Message-ID: <E19EGl4-0002o8-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv10773

Modified Files:
	compatmac.h 
Log Message:
More compatmac stuff to build with 2.4.20-9.
Ideally we'd have HAVE_SOME_RANDOM_FEATURE macros rather than just
a vendor tag. 


Index: compatmac.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/compatmac.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- compatmac.h	28 Apr 2003 16:53:45 -0000	1.47
+++ compatmac.h	9 May 2003 22:54:28 -0000	1.48
@@ -483,7 +483,7 @@
 #define MODULE_LICENSE(x) /* */
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,5)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,5) && !defined(__rh_config_h__)
 #include <linux/sched.h>
 static inline void __recalc_sigpending(void)
 {
@@ -523,7 +523,7 @@
 #define set_user_nice(tsk, n) do { (tsk)->nice = n; } while(0)
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,21)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,21) && !defined(__rh_config_h__)
 #define rq_data_dir(x)	((x)->cmd)
 #endif
 


From dwmw2 at infradead.org  Sun May 11 06:47:16 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:10 2006
Subject: mtd/fs/jffs2 compr_rtime.c,1.9,1.10
Message-ID: <E19EoMO-0003qE-00@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv14764

Modified Files:
	compr_rtime.c 
Log Message:
Pull in spelling fix from 2.5
Switch 'positions' array to shorts, to reduce stack usage.


Index: compr_rtime.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/compr_rtime.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- compr_rtime.c	20 May 2002 14:56:37 -0000	1.9
+++ compr_rtime.c	11 May 2003 10:47:13 -0000	1.10
@@ -13,7 +13,7 @@
  * Very simple lz77-ish encoder.
  *
  * Theory of operation: Both encoder and decoder have a list of "last
- * occurances" for every possible source-value; after sending the
+ * occurrences" for every possible source-value; after sending the
  * first source-byte, the second byte indicated the "run" length of
  * matches
  *
@@ -30,7 +30,7 @@
 int jffs2_rtime_compress(unsigned char *data_in, unsigned char *cpage_out, 
 		   uint32_t *sourcelen, uint32_t *dstlen)
 {
-	int positions[256];
+	short positions[256];
 	int outpos = 0;
 	int pos=0;
 
@@ -70,7 +70,7 @@
 void jffs2_rtime_decompress(unsigned char *data_in, unsigned char *cpage_out,
 		      uint32_t srclen, uint32_t destlen)
 {
-	int positions[256];
+	short positions[256];
 	int outpos = 0;
 	int pos=0;
 	


From dwmw2 at infradead.org  Sun May 11 18:47:39 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:10 2006
Subject: mtd/fs/jffs2 erase.c,1.50,1.51
Message-ID: <E19EzbX-0000uy-00@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv3526

Modified Files:
	erase.c 
Log Message:
remove bogus comment

Index: erase.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/erase.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- erase.c	19 Feb 2003 10:10:28 -0000	1.50
+++ erase.c	11 May 2003 22:47:36 -0000	1.51
@@ -98,12 +98,6 @@
 	else
 		printk(KERN_WARNING "Erase at 0x%08x failed immediately: errno %d\n", jeb->offset, ret);
 
-	/* Note: This is almost identical to jffs2_erase_failed() except
-	   for the fact that we used spin_lock() not spin_lock(). If
-	   we could use spin_lock() from a BH, we could merge them.
-	   Or if we abandon the idea that MTD drivers may call the erase
-	   callback from a BH, I suppose :)
-	*/
 	jffs2_erase_failed(c, jeb);
 }
 


From dwmw2 at infradead.org  Tue May 13 11:30:00 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:10 2006
Subject: mtd/drivers/mtd/maps lubbock-flash.c,1.1,1.2
Message-ID: <E19Fbj6-00077v-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv27376

Modified Files:
	lubbock-flash.c 
Log Message:
Register both flash devices.


Index: lubbock-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/lubbock-flash.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- lubbock-flash.c	10 Apr 2003 12:20:18 -0000	1.1
+++ lubbock-flash.c	13 May 2003 15:29:58 -0000	1.2
@@ -18,10 +18,12 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/partitions.h>
+#include <asm/hardware.h>
 
 
-#define WINDOW_ADDR 	0
-//#define WINDOW_ADDR 	0x04000000
+#define ROM_ADDR	0x00000000
+#define FLASH_ADDR	0x04000000
+
 #define WINDOW_SIZE 	64*1024*1024
 
 static __u8 lubbock_read8(struct map_info *map, unsigned long ofs)
@@ -64,9 +66,9 @@
 	memcpy((void *)(map->map_priv_1 + to), from, len);
 }
 
-static u_char * lubbock_point(struct map_info *map, loff_t ofs, size_t len)
+static u_char *lubbock_point(struct map_info *map, loff_t ofs, size_t len)
 {
-        return map->map_priv_1 + ofs;
+        return (u_char *)map->map_priv_1 + ofs;
 }
 
 static void lubbock_unpoint(struct map_info *map, u_char *ptr, loff_t ofs, size_t len)
@@ -74,102 +76,145 @@
         return;
 }
 
-static struct map_info lubbock_map = {
-	name: "Lubbock flash",
-	size: WINDOW_SIZE,
-	read8:		lubbock_read8,
-	read16:		lubbock_read16,
-	read32:		lubbock_read32,
-	copy_from:	lubbock_copy_from,
-	write8:		lubbock_write8,
-	write16:	lubbock_write16,
-	write32:	lubbock_write32,
-	copy_to:	lubbock_copy_to,
-	point:		lubbock_point,
-	unpoint:	lubbock_unpoint
-};
+static struct map_info lubbock_maps[2] = { {
+	.size =		WINDOW_SIZE,
+	.read8 =	lubbock_read8,
+	.read16 =	lubbock_read16,
+	.read32 =	lubbock_read32,
+	.copy_from =	lubbock_copy_from,
+	.write8 =	lubbock_write8,
+	.write16 =	lubbock_write16,
+	.write32 =	lubbock_write32,
+	.copy_to =	lubbock_copy_to,
+	.point =	lubbock_point,
+	.unpoint =	lubbock_unpoint,
+	.map_priv_2 =	0x00000000,
+}, {
+	.size =		WINDOW_SIZE,
+	.read8 =	lubbock_read8,
+	.read16 =	lubbock_read16,
+	.read32 =	lubbock_read32,
+	.copy_from =	lubbock_copy_from,
+	.write8 =	lubbock_write8,
+	.write16 =	lubbock_write16,
+	.write32 =	lubbock_write32,
+	.copy_to =	lubbock_copy_to,
+	.point =	lubbock_point,
+	.unpoint =	lubbock_unpoint,
+	.map_priv_2 =	0x04000000,
+} };
 
 static struct mtd_partition lubbock_partitions[] = {
 	{
-		name:		"Bootloader",
-		size:		0x00040000,
-		offset:		0,
-		mask_flags:	MTD_WRITEABLE  /* force read-only */
+		.name =		"Bootloader",
+		.size =		0x00040000,
+		.offset =	0,
+		.mask_flags =	MTD_WRITEABLE  /* force read-only */
 	},{
-		name:		"Kernel",
-		size:		0x00100000,
-		offset:		0x00040000,
+		.name =		"Kernel",
+		.size =		0x00100000,
+		.offset =	0x00040000,
 	},{
-		name:		"Filesystem",
-		size:		MTDPART_SIZ_FULL,
-		offset:		0x00140000
+		.name =		"Filesystem",
+		.size =		MTDPART_SIZ_FULL,
+		.offset =	0x00140000
 	}
 };
 
 #define NB_OF(x)  (sizeof(x)/sizeof(x[0]))
 
-static struct mtd_info *mymtd;
-static struct mtd_partition *parsed_parts;
+static struct mtd_info *mymtds[2];
+static struct mtd_partition *parsed_parts[2];
+static int nr_parsed_parts[2];
+static char *part_type[2];
 
 static int __init init_lubbock(void)
 {
-	struct mtd_partition *parts;
-	int nb_parts = 0;
-	int parsed_nr_parts = 0;
-	char *part_type = "static";
-
-	lubbock_map.buswidth = (BOOT_DEF & 1) ? 2 : 4;
-	printk( "Probing Lubbock flash at physical address 0x%08x (%d-bit buswidth)\n",
-		WINDOW_ADDR, lubbock_map.buswidth * 8 );
-	lubbock_map.map_priv_1 = (unsigned long)__ioremap(WINDOW_ADDR, WINDOW_SIZE, 0);
-	if (!lubbock_map.map_priv_1) {
-		printk("Failed to ioremap\n");
-		return -EIO;
-	}
-	mymtd = do_map_probe("cfi_probe", &lubbock_map);
-	if (!mymtd) {
-		iounmap((void *)lubbock_map.map_priv_1);
-		return -ENXIO;
-	}
-	mymtd->module = THIS_MODULE;
+	int flashboot = (CONF_SWITCHES & 1);
+	int ret = 0, i;
+
+	lubbock_maps[0].buswidth = lubbock_maps[1].buswidth = 
+		(BOOT_DEF & 1) ? 2 : 4;
+
+	/* Compensate for the nROMBT switch which swaps the flash banks */
+	printk(KERN_NOTICE "Lubbock configured to boot from %s (bank %d)\n",
+	       flashboot?"Flash":"ROM", flashboot);
+
+	lubbock_maps[flashboot^1].name = "Lubbock Application Flash";
+	lubbock_maps[flashboot].name = "Lubbock Boot ROM";
+
+	for (i = 0; i < 2; i++) {
+		lubbock_maps[i].map_priv_1 = (unsigned long)__ioremap(lubbock_maps[i].map_priv_2, WINDOW_SIZE, 0);
+		if (!lubbock_maps[i].map_priv_1) {
+			printk(KERN_WARNING "Failed to ioremap %s\n", lubbock_maps[i].name);
+			if (!ret)
+				ret = -ENOMEM;
+			continue;
+		}
+
+		printk(KERN_NOTICE "Probing %s at physical address 0x%08lx (%d-bit buswidth)\n",
+		       lubbock_maps[i].name, lubbock_maps[i].map_priv_2, 
+		       lubbock_maps[i].buswidth * 8);
+
+		mymtds[i] = do_map_probe("cfi_probe", &lubbock_maps[i]);
+		
+		if (!mymtds[i]) {
+			iounmap((void *)lubbock_maps[i].map_priv_1);
+			if (!ret)
+				ret = -EIO;
+			continue;
+		}
+		mymtds[i]->module = THIS_MODULE;
 
 #ifdef CONFIG_MTD_REDBOOT_PARTS
-	if (parsed_nr_parts == 0) {
-		int ret = parse_redboot_partitions(mymtd, &parsed_parts, 0);
+		int ret = parse_redboot_partitions(mymtds[i], &parsed_parts[i], 0);
 
 		if (ret > 0) {
-			part_type = "RedBoot";
-			parsed_nr_parts = ret;
+			part_type[i] = "RedBoot";
+			nr_parsed_parts[i] = ret;
 		}
-	}
 #endif
-
-	if (parsed_nr_parts > 0) {
-		parts = parsed_parts;
-		nb_parts = parsed_nr_parts;
-	} else {
-		parts = lubbock_partitions;
-		nb_parts = NB_OF(lubbock_partitions);
 	}
-	if (nb_parts) {
-		printk(KERN_NOTICE "Using %s partition definition\n", part_type);
-		add_mtd_partitions(mymtd, parts, nb_parts);
-	} else {
-		add_mtd_device(mymtd);
+
+	if (!mymtds[0] && !mymtds[1])
+		return ret;
+	
+	for (i = 0; i < 2; i++) {
+		if (!mymtds[i]) {
+			printk(KERN_WARNING "%s is absent. Skipping\n", lubbock_maps[i].name);
+		} else if (nr_parsed_parts[i]) {
+			printk("Using %s partitions on %s\n", part_type[i], 
+			       lubbock_maps[i].name);
+			add_mtd_partitions(mymtds[i], parsed_parts[i], nr_parsed_parts[i]);
+		} else if (!i) {
+			printk("Using static partitions on %s\n", lubbock_maps[i].name);
+			add_mtd_partitions(mymtds[i], lubbock_partitions, NB_OF(lubbock_partitions));
+		} else {
+			printk("Registering %s as whole device\n", lubbock_maps[i].name);
+			add_mtd_device(mymtds[i]);
+		}
 	}
 	return 0;
 }
 
 static void __exit cleanup_lubbock(void)
 {
-	if (mymtd) {
-		del_mtd_partitions(mymtd);
-		map_destroy(mymtd);
-		if (parsed_parts)
-			kfree(parsed_parts);
+	int i;
+	for (i = 0; i < 2; i++) {
+		if (!mymtds[i])
+			continue;
+
+		if (nr_parsed_parts[i])
+			del_mtd_partitions(mymtds[i]);
+		else
+			del_mtd_device(mymtds[i]);			
+
+		map_destroy(mymtds[i]);
+		iounmap((void *)lubbock_maps[i].map_priv_1);
+
+		if (parsed_parts[i])
+			kfree(parsed_parts[i]);
 	}
-	if (lubbock_map.map_priv_1)
-		iounmap((void *)lubbock_map.map_priv_1);
 }
 
 module_init(init_lubbock);


From dwmw2 at infradead.org  Wed May 14 02:53:29 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:10 2006
Subject: mtd/fs/jffs2 readinode.c,1.105,1.106
Message-ID: <E19Fq8n-0001Hm-00@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv4921

Modified Files:
	readinode.c 
Log Message:
Fix memory leak found by Stanford checker and/or Hollis Blanchard


Index: readinode.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/readinode.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- readinode.c	11 Mar 2003 18:45:14 -0000	1.105
+++ readinode.c	14 May 2003 06:53:26 -0000	1.106
@@ -169,8 +169,10 @@
 		if (lastend < newfrag->node->ofs) {
 			/* ... and we need to put a hole in before the new node */
 			struct jffs2_node_frag *holefrag = jffs2_alloc_node_frag();
-			if (!holefrag)
+			if (!holefrag) {
+				jffs2_free_node_frag(newfrag);
 				return -ENOMEM;
+			}
 			holefrag->ofs = lastend;
 			holefrag->size = newfrag->node->ofs - lastend;
 			holefrag->node = NULL;


From dwmw2 at infradead.org  Wed May 14 11:05:20 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:10 2006
Subject: mtd/include/linux/mtd cfi.h,1.32,1.33 map.h,1.29,1.30
Message-ID: <E19Fxol-0006sD-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv26387/include/linux/mtd

Modified Files:
	cfi.h map.h 
Log Message:
Make support for non-linear mappings conditional

Index: cfi.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/cfi.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- cfi.h	5 Sep 2002 05:15:32 -0000	1.32
+++ cfi.h	14 May 2003 15:05:17 -0000	1.33
@@ -479,5 +479,4 @@
 	spin_unlock_bh(mutex);
 }
 
-
 #endif /* __MTD_CFI_H__ */

Index: map.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/map.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- map.h	21 Oct 2002 13:20:52 -0000	1.29
+++ map.h	14 May 2003 15:05:17 -0000	1.30
@@ -9,6 +9,7 @@
 #include <linux/types.h>
 #include <linux/mtd/mtd.h>
 #include <linux/slab.h>
+#include <asm/io.h>
 
 /* The map stuff is very simple. You fill in your struct map_info with
    a handful of routines for accessing the device, making sure they handle
@@ -29,39 +30,44 @@
 struct map_info {
 	char *name;
 	unsigned long size;
+	unsigned long phys;
+#define NO_XIP (-1UL)
+
+	unsigned long virt;
+	void *cached;
+
 	int buswidth; /* in octets */
-	__u8 (*read8)(struct map_info *, unsigned long);
-	__u16 (*read16)(struct map_info *, unsigned long);
-	__u32 (*read32)(struct map_info *, unsigned long);  
-	__u64 (*read64)(struct map_info *, unsigned long);  
+
+#ifdef CONFIG_MTD_COMPLEX_MAPPINGS
+	u8 (*read8)(struct map_info *, unsigned long);
+	u16 (*read16)(struct map_info *, unsigned long);
+	u32 (*read32)(struct map_info *, unsigned long);  
+	u64 (*read64)(struct map_info *, unsigned long);  
 	/* If it returned a 'long' I'd call it readl.
 	 * It doesn't.
 	 * I won't.
 	 * dwmw2 */
 	
 	void (*copy_from)(struct map_info *, void *, unsigned long, ssize_t);
-	void (*write8)(struct map_info *, __u8, unsigned long);
-	void (*write16)(struct map_info *, __u16, unsigned long);
-	void (*write32)(struct map_info *, __u32, unsigned long);
-	void (*write64)(struct map_info *, __u64, unsigned long);
+	void (*write8)(struct map_info *, u8, unsigned long);
+	void (*write16)(struct map_info *, u16, unsigned long);
+	void (*write32)(struct map_info *, u32, unsigned long);
+	void (*write64)(struct map_info *, u64, unsigned long);
 	void (*copy_to)(struct map_info *, unsigned long, const void *, ssize_t);
 
-	u_char * (*point) (struct map_info *, loff_t, size_t);
-	void (*unpoint) (struct map_info *, u_char *, loff_t, size_t);
-
+	/* We can perhaps put in 'point' and 'unpoint' methods, if we really
+	   want to enable XIP for non-linear mappings. Not yet though. */
+#endif
+	/* set_vpp() must handle being reentered -- enable, enable, disable 
+	   must leave it enabled. */
 	void (*set_vpp)(struct map_info *, int);
-	/* We put these two here rather than a single void *map_priv, 
-	   because we want mappers to be able to have quickly-accessible
-	   cache for the 'currently-mapped page' without the _extra_
-	   redirection that would be necessary. If you need more than
-	   two longs, turn the second into a pointer. dwmw2 */
+
 	unsigned long map_priv_1;
 	unsigned long map_priv_2;
 	void *fldrv_priv;
 	struct mtd_chip_driver *fldrv;
 };
 
-
 struct mtd_chip_driver {
 	struct mtd_info *(*probe)(struct map_info *map);
 	void (*destroy)(struct mtd_info *);
@@ -95,5 +101,89 @@
 
 #define ENABLE_VPP(map) do { if(map->set_vpp) map->set_vpp(map, 1); } while(0)
 #define DISABLE_VPP(map) do { if(map->set_vpp) map->set_vpp(map, 0); } while(0)
+
+#ifdef CONFIG_MTD_COMPLEX_MAPPINGS
+#define map_read8(map, ofs) (map)->read8(map, ofs)
+#define map_read16(map, ofs) (map)->read16(map, ofs)
+#define map_read32(map, ofs) (map)->read32(map, ofs)
+#define map_read64(map, ofs) (map)->read64(map, ofs)
+#define map_copy_from(map, to, from, len) (map)->copy_from(map, to, from, len)
+#define map_write8(map, datum, ofs) (map)->write8(map, datum, ofs)
+#define map_write16(map, datum, ofs) (map)->write16(map, datum, ofs)
+#define map_write32(map, datum, ofs) (map)->write32(map, datum, ofs)
+#define map_write64(map, datum, ofs) (map)->write64(map, datum, ofs)
+#define map_copy_to(map, to, from, len) (map)->copy_to(map, to, from, len)
+
+extern void simple_map_init(struct map_info *);
+#define map_is_linear(map) (map->phys != NO_XIP)
+
+#else
+static inline u8 map_read8(struct map_info *map, unsigned long ofs)
+{
+	return __raw_readb(map->virt + ofs);
+}
+
+static inline u16 map_read16(struct map_info *map, unsigned long ofs)
+{
+	return __raw_readw(map->virt + ofs);
+}
+
+static inline u32 map_read32(struct map_info *map, unsigned long ofs)
+{
+	return __raw_readl(map->virt + ofs);
+}
+
+static inline u64 map_read64(struct map_info *map, unsigned long ofs)
+{
+#ifndef CONFIG_MTD_CFI_B8 /* 64-bit mappings */
+	BUG();
+	return 0;
+#else
+	return __raw_readll(map->virt + ofs);
+#endif
+}
+
+static inline void map_write8(struct map_info *map, u8 datum, unsigned long ofs)
+{
+	__raw_writeb(datum, map->virt + ofs);
+	mb();
+}
+
+static inline void map_write16(struct map_info *map, u16 datum, unsigned long ofs)
+{
+	__raw_writew(datum, map->virt + ofs);
+	mb();
+}
+
+static inline void map_write32(struct map_info *map, u32 datum, unsigned long ofs)
+{
+	__raw_writel(datum, map->virt + ofs);
+	mb();
+}
+
+static inline void map_write64(struct map_info *map, u64 datum, unsigned long ofs)
+{
+#ifndef CONFIG_MTD_CFI_B8 /* 64-bit mappings */
+	BUG();
+#else
+	__raw_writell(datum, map->virt + ofs);
+	mb();
+#endif /* CFI_B8 */
+}
+
+static inline void map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
+{
+	memcpy_fromio(to, map->virt + from, len);
+}
+
+static inline void map_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
+{
+	memcpy_toio(map->virt + to, from, len);
+}
+
+#define simple_map_init(map) do { } while (0)
+#define map_is_linear(struct map_info *map) (1)
+
+#endif /* !CONFIG_COMPLEX_MAPPINGS */
 
 #endif /* __LINUX_MTD_MAP_H__ */


From dwmw2 at infradead.org  Wed May 14 11:05:44 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:10 2006
Subject: mtd/drivers/mtd GNUmakefile,1.12,1.13
Message-ID: <E19Fxog-0006rt-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv26387/drivers/mtd

Modified Files:
	GNUmakefile 
Log Message:
Make support for non-linear mappings conditional

Index: GNUmakefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/GNUmakefile,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- GNUmakefile	13 Sep 2002 14:13:14 -0000	1.12
+++ GNUmakefile	14 May 2003 15:05:11 -0000	1.13
@@ -5,9 +5,13 @@
 ifndef VERSION
 
 # Someone just typed 'make'
+CONFIG_MTD_COMPLEX_MAPPINGS := y
+EXTRA_CFLAGS += -DCONFIG_MTD_COMPLEX_MAPPINGS=1
+
+export CONFIG_MTD_COMPLEX_MAPPINGS EXTRA_CFLAGS
 
 modules:
-	make -C $(LINUXDIR) SUBDIRS=`pwd` modules
+	make -C $(LINUXDIR) SUBDIRS=`pwd` EXTRA_CFLAGS=-DCONFIG_MTD_COMPLEX_MAPPINGS=1 modules
 
 dep:
 	make -C $(LINUXDIR) SUBDIRS=`pwd` dep


From dwmw2 at infradead.org  Wed May 14 11:05:46 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:11 2006
Subject: mtd/drivers/mtd/chips amd_flash.c,1.20,1.21
 cfi_cmdset_0001.c,1.116,1.117 cfi_cmdset_0002.c,1.69,1.70
 cfi_cmdset_0020.c,1.1,1.2 jedec.c,1.14,1.15 map_ram.c,1.14,1.15
 map_rom.c,1.17,1.18 sharp.c,1.9,1.10
Message-ID: <E19Fxoi-0006rz-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv26387/drivers/mtd/chips

Modified Files:
	amd_flash.c cfi_cmdset_0001.c cfi_cmdset_0002.c 
	cfi_cmdset_0020.c jedec.c map_ram.c map_rom.c sharp.c 
Log Message:
Make support for non-linear mappings conditional

Index: amd_flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/amd_flash.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- amd_flash.c	14 Mar 2003 18:31:47 -0000	1.20
+++ amd_flash.c	14 May 2003 15:05:12 -0000	1.21
@@ -140,11 +140,11 @@
 static inline __u32 wide_read(struct map_info *map, __u32 addr)
 {
 	if (map->buswidth == 1) {
-		return map->read8(map, addr);
+		return map_read8(map, addr);
 	} else if (map->buswidth == 2) {
-		return map->read16(map, addr);
+		return map_read16(map, addr);
 	} else if (map->buswidth == 4) {
-		return map->read32(map, addr);
+		return map_read32(map, addr);
         }
 
 	return 0;
@@ -153,11 +153,11 @@
 static inline void wide_write(struct map_info *map, __u32 val, __u32 addr)
 {
 	if (map->buswidth == 1) {
-		map->write8(map, val, addr);
+		map_write8(map, val, addr);
 	} else if (map->buswidth == 2) {
-		map->write16(map, val, addr);
+		map_write16(map, val, addr);
 	} else if (map->buswidth == 4) {
-		map->write32(map, val, addr);
+		map_write32(map, val, addr);
 	}
 }
 
@@ -819,7 +819,7 @@
 
 	chip->state = FL_READY;
 
-	map->copy_from(map, buf, adr, len);
+	map_copy_from(map, buf, adr, len);
 
 	wake_up(&chip->wq);
 	spin_unlock_bh(chip->mutex);
@@ -981,7 +981,7 @@
 		u_char tmp_buf[4];
 		__u32 datum;
 
-		map->copy_from(map, tmp_buf,
+		map_copy_from(map, tmp_buf,
 			       bus_ofs + private->chips[chipnum].start,
 			       map->buswidth);
 		while (len && i < map->buswidth)
@@ -1054,7 +1054,7 @@
 		u_char tmp_buf[2];
 		__u32 datum;
 
-		map->copy_from(map, tmp_buf,
+		map_copy_from(map, tmp_buf,
 			       ofs + private->chips[chipnum].start,
 			       map->buswidth);
 		while (len--) {
@@ -1175,7 +1175,7 @@
 		__u8 verify;
 
 		for (address = adr; address < (adr + size); address++) {
-			if ((verify = map->read8(map, address)) != 0xFF) {
+			if ((verify = map_read8(map, address)) != 0xFF) {
 				error = 1;
 				break;
 			}

Index: cfi_cmdset_0001.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0001.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -r1.116 -r1.117
--- cfi_cmdset_0001.c	28 Apr 2003 15:16:21 -0000	1.116
+++ cfi_cmdset_0001.c	14 May 2003 15:05:12 -0000	1.117
@@ -267,7 +267,7 @@
 	mtd->erase = cfi_intelext_erase_varsize;
 	mtd->read = cfi_intelext_read;
 
-	if(map->point && map->unpoint){
+	if (map_is_linear(map)) {
 		mtd->point = cfi_intelext_point;
 		mtd->unpoint = cfi_intelext_unpoint;
 	}
@@ -476,7 +476,7 @@
 	if (from + len > mtd->size)
 		return -EINVAL;
 	
-	*mtdbuf = map->point(map, from, len);
+	*mtdbuf = (void *)map->virt + from;
 	if(*mtdbuf == NULL)
 		return -EINVAL; /* can not point this region */
 	*retlen = 0;
@@ -518,7 +518,6 @@
 	unsigned long ofs;
 	int chipnum;
 
-	map->unpoint(map, addr, from, len);
 	/* Now unlock the chip(s) POINT state */
 
 	/* ofs: offset within the first chip that the first read should start */
@@ -579,7 +578,7 @@
 		chip->state = FL_READY;
 	}
 
-	map->copy_from(map, buf, adr, len);
+	map_copy_from(map, buf, adr, len);
 
 	put_chip(map, chip, cmd_addr);
 
@@ -661,7 +660,7 @@
 		}
 
 		while (count && ((offst-base_offst) < reg_sz)) {
-			*buf = map->read8(map,(chip->start+((extp->ProtRegAddr+1)*ofs_factor)+offst));
+			*buf = map_read8(map,(chip->start+((extp->ProtRegAddr+1)*ofs_factor)+offst));
 			buf++;
 			offst++;
 			count--;
@@ -999,13 +998,13 @@
 	/* Write data */
 	for (z = 0; z < len; z += CFIDEV_BUSWIDTH) {
 		if (cfi_buswidth_is_1()) {
-			map->write8 (map, *((__u8*)buf)++, adr+z);
+			map_write8 (map, *((__u8*)buf)++, adr+z);
 		} else if (cfi_buswidth_is_2()) {
-			map->write16 (map, *((__u16*)buf)++, adr+z);
+			map_write16 (map, *((__u16*)buf)++, adr+z);
 		} else if (cfi_buswidth_is_4()) {
-			map->write32 (map, *((__u32*)buf)++, adr+z);
+			map_write32 (map, *((__u32*)buf)++, adr+z);
 		} else if (cfi_buswidth_is_8()) {
-			map->write64 (map, *((__u64*)buf)++, adr+z);
+			map_write64 (map, *((__u64*)buf)++, adr+z);
 		} else {
 			ret = -EINVAL;
 			goto out;

Index: cfi_cmdset_0002.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0002.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- cfi_cmdset_0002.c	6 May 2003 21:34:40 -0000	1.69
+++ cfi_cmdset_0002.c	14 May 2003 15:05:12 -0000	1.70
@@ -318,7 +318,7 @@
 
 	chip->state = FL_READY;
 
-	map->copy_from(map, buf, adr, len);
+	map_copy_from(map, buf, adr, len);
 
 	wake_up(&chip->wq);
 	cfi_spin_unlock(chip->mutex);
@@ -404,7 +404,7 @@
 	cfi_send_gen_cmd(0x55, cfi->addr_unlock2, chip->start, map, cfi, cfi->device_type, NULL);
 	cfi_send_gen_cmd(0x88, cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type, NULL);
 	
-	map->copy_from(map, buf, adr, len);
+	map_copy_from(map, buf, adr, len);
 
 	cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type, NULL);
 	cfi_send_gen_cmd(0x55, cfi->addr_unlock2, chip->start, map, cfi, cfi->device_type, NULL);
@@ -686,7 +686,7 @@
 		u_char tmp_buf[8];
 		cfi_word datum;
 
-		map->copy_from(map, tmp_buf, bus_ofs + cfi->chips[chipnum].start, CFIDEV_BUSWIDTH);
+		map_copy_from(map, tmp_buf, bus_ofs + cfi->chips[chipnum].start, CFIDEV_BUSWIDTH);
 		while (len && i < CFIDEV_BUSWIDTH)
 			tmp_buf[i++] = buf[n++], len--;
 
@@ -784,7 +784,7 @@
 		u_char tmp_buf[8];
 		cfi_word datum;
 
-		map->copy_from(map, tmp_buf, ofs + cfi->chips[chipnum].start, CFIDEV_BUSWIDTH);
+		map_copy_from(map, tmp_buf, ofs + cfi->chips[chipnum].start, CFIDEV_BUSWIDTH);
 		while (len--)
 			tmp_buf[i++] = buf[n++];
 

Index: cfi_cmdset_0020.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0020.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- cfi_cmdset_0020.c	3 Sep 2002 13:30:43 -0000	1.1
+++ cfi_cmdset_0020.c	14 May 2003 15:05:13 -0000	1.2
@@ -374,7 +374,7 @@
 		goto retry;
 	}
 
-	map->copy_from(map, buf, adr, len);
+	map_copy_from(map, buf, adr, len);
 
 	if (suspended) {
 		chip->state = chip->oldstate;
@@ -540,11 +540,11 @@
 	/* Write data */
 	for (z = 0; z < len; z += CFIDEV_BUSWIDTH) {
 		if (cfi_buswidth_is_1()) {
-			map->write8 (map, *((__u8*)buf)++, adr+z);
+			map_write8 (map, *((__u8*)buf)++, adr+z);
 		} else if (cfi_buswidth_is_2()) {
-			map->write16 (map, *((__u16*)buf)++, adr+z);
+			map_write16 (map, *((__u16*)buf)++, adr+z);
 		} else if (cfi_buswidth_is_4()) {
-			map->write32 (map, *((__u32*)buf)++, adr+z);
+			map_write32 (map, *((__u32*)buf)++, adr+z);
 		} else {
 			DISABLE_VPP(map);
 			return -EINVAL;

Index: jedec.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/jedec.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- jedec.c	27 Jun 2002 02:19:12 -0000	1.14
+++ jedec.c	14 May 2003 15:05:13 -0000	1.15
@@ -351,8 +351,8 @@
 static int jedec_probe8(struct map_info *map,unsigned long base,
 		  struct jedec_private *priv)
 { 
-   #define flread(x) map->read8(map,base+x)
-   #define flwrite(v,x) map->write8(map,v,base+x)
+   #define flread(x) map_read8(map,base+x)
+   #define flwrite(v,x) map_write8(map,v,base+x)
 
    const unsigned long AutoSel1 = 0xAA;
    const unsigned long AutoSel2 = 0x55;
@@ -411,8 +411,8 @@
 static int jedec_probe32(struct map_info *map,unsigned long base,
 		  struct jedec_private *priv)
 {
-   #define flread(x) map->read32(map,base+((x)<<2))
-   #define flwrite(v,x) map->write32(map,v,base+((x)<<2))
+   #define flread(x) map_read32(map,base+((x)<<2))
+   #define flwrite(v,x) map_write32(map,v,base+((x)<<2))
 
    const unsigned long AutoSel1 = 0xAAAAAAAA;
    const unsigned long AutoSel2 = 0x55555555;
@@ -490,7 +490,7 @@
 {
    struct map_info *map = (struct map_info *)mtd->priv;
    
-   map->copy_from(map, buf, from, len);
+   map_copy_from(map, buf, from, len);
    *retlen = len;
    return 0;   
 }
@@ -514,7 +514,7 @@
 	 get = priv->bank_fill[0] - offset;
 
       bank /= priv->bank_fill[0];      
-      map->copy_from(map,buf + *retlen,bank*my_bank_size + offset,get);
+      map_copy_from(map,buf + *retlen,bank*my_bank_size + offset,get);
       
       len -= get;
       *retlen += get;
@@ -545,8 +545,8 @@
 static int flash_erase(struct mtd_info *mtd, struct erase_info *instr)
 {
    // Does IO to the currently selected chip
-   #define flread(x) map->read8(map,chip->base+((x)<<chip->addrshift))
-   #define flwrite(v,x) map->write8(map,v,chip->base+((x)<<chip->addrshift))
+   #define flread(x) map_read8(map,chip->base+((x)<<chip->addrshift))
+   #define flwrite(v,x) map_write8(map,v,chip->base+((x)<<chip->addrshift))
    
    unsigned long Time = 0;
    unsigned long NoTime = 0;
@@ -651,19 +651,19 @@
   	    or this is not really flash ;> */
 	 switch (map->buswidth) {
 	 case 1:
-	    Last[0] = map->read8(map,(chip->base >> chip->addrshift) + chip->start + off);
-	    Last[1] = map->read8(map,(chip->base >> chip->addrshift) + chip->start + off);
-	    Last[2] = map->read8(map,(chip->base >> chip->addrshift) + chip->start + off);
+	    Last[0] = map_read8(map,(chip->base >> chip->addrshift) + chip->start + off);
+	    Last[1] = map_read8(map,(chip->base >> chip->addrshift) + chip->start + off);
+	    Last[2] = map_read8(map,(chip->base >> chip->addrshift) + chip->start + off);
 	    break;
 	 case 2:
-	    Last[0] = map->read16(map,(chip->base >> chip->addrshift) + chip->start + off);
-	    Last[1] = map->read16(map,(chip->base >> chip->addrshift) + chip->start + off);
-	    Last[2] = map->read16(map,(chip->base >> chip->addrshift) + chip->start + off);
+	    Last[0] = map_read16(map,(chip->base >> chip->addrshift) + chip->start + off);
+	    Last[1] = map_read16(map,(chip->base >> chip->addrshift) + chip->start + off);
+	    Last[2] = map_read16(map,(chip->base >> chip->addrshift) + chip->start + off);
 	    break;
 	 case 3:
-	    Last[0] = map->read32(map,(chip->base >> chip->addrshift) + chip->start + off);
-	    Last[1] = map->read32(map,(chip->base >> chip->addrshift) + chip->start + off);
-	    Last[2] = map->read32(map,(chip->base >> chip->addrshift) + chip->start + off);
+	    Last[0] = map_read32(map,(chip->base >> chip->addrshift) + chip->start + off);
+	    Last[1] = map_read32(map,(chip->base >> chip->addrshift) + chip->start + off);
+	    Last[2] = map_read32(map,(chip->base >> chip->addrshift) + chip->start + off);
 	    break;
 	 }
 	 Count = 3;
@@ -699,13 +699,13 @@
 
 	    switch (map->buswidth) {
 	    case 1:
-	       Last[Count % 4] = map->read8(map,(chip->base >> chip->addrshift) + chip->start + off);
+	       Last[Count % 4] = map_read8(map,(chip->base >> chip->addrshift) + chip->start + off);
 	      break;
 	    case 2:
-	       Last[Count % 4] = map->read16(map,(chip->base >> chip->addrshift) + chip->start + off);
+	       Last[Count % 4] = map_read16(map,(chip->base >> chip->addrshift) + chip->start + off);
 	      break;
 	    case 4:
-	       Last[Count % 4] = map->read32(map,(chip->base >> chip->addrshift) + chip->start + off);
+	       Last[Count % 4] = map_read32(map,(chip->base >> chip->addrshift) + chip->start + off);
 	      break;
 	    }
 	    Count++;
@@ -757,8 +757,8 @@
    /* Does IO to the currently selected chip. It takes the bank addressing
       base (which is divisable by the chip size) adds the necesary lower bits
       of addrshift (interleve index) and then adds the control register index. */
-   #define flread(x) map->read8(map,base+(off&((1<<chip->addrshift)-1))+((x)<<chip->addrshift))
-   #define flwrite(v,x) map->write8(map,v,base+(off&((1<<chip->addrshift)-1))+((x)<<chip->addrshift))
+   #define flread(x) map_read8(map,base+(off&((1<<chip->addrshift)-1))+((x)<<chip->addrshift))
+   #define flwrite(v,x) map_write8(map,v,base+(off&((1<<chip->addrshift)-1))+((x)<<chip->addrshift))
    
    struct map_info *map = (struct map_info *)mtd->priv;
    struct jedec_private *priv = (struct jedec_private *)map->fldrv_priv;
@@ -794,7 +794,7 @@
       // Loop over this page
       for (; off != (chip->size << chip->addrshift) && len != 0; start++, len--, off++,buf++)
       {
-	 unsigned char oldbyte = map->read8(map,base+off);
+	 unsigned char oldbyte = map_read8(map,base+off);
 	 unsigned char Last[4];
 	 unsigned long Count = 0;
 
@@ -809,10 +809,10 @@
 	 flwrite(0xAA,0x555);
 	 flwrite(0x55,0x2AA);
 	 flwrite(0xA0,0x555);
-	 map->write8(map,*buf,base + off);
-	 Last[0] = map->read8(map,base + off);
-	 Last[1] = map->read8(map,base + off);
-	 Last[2] = map->read8(map,base + off);
+	 map_write8(map,*buf,base + off);
+	 Last[0] = map_read8(map,base + off);
+	 Last[1] = map_read8(map,base + off);
+	 Last[2] = map_read8(map,base + off);
 	 
 	 /* Wait for the flash to finish the operation. We store the last 4
 	    status bytes that have been retrieved so we can determine why
@@ -820,7 +820,7 @@
 	    failure */
 	 for (Count = 3; Last[(Count - 1) % 4] != Last[(Count - 2) % 4] &&
 	      Count < 10000; Count++)
-	    Last[Count % 4] = map->read8(map,base + off);
+	    Last[Count % 4] = map_read8(map,base + off);
 	 if (Last[(Count - 1) % 4] != *buf)
 	 {
 	    jedec_flash_failed(Last[(Count - 3) % 4]);

Index: map_ram.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/map_ram.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- map_ram.c	2 Oct 2001 15:05:12 -0000	1.14
+++ map_ram.c	14 May 2003 15:05:13 -0000	1.15
@@ -34,21 +34,21 @@
 
 	/* Check the first byte is RAM */
 #if 0
-	map->write8(map, 0x55, 0);
-	if (map->read8(map, 0) != 0x55)
+	map_write8(map, 0x55, 0);
+	if (map_read8(map, 0) != 0x55)
 		return NULL;
 
-	map->write8(map, 0xAA, 0);
-	if (map->read8(map, 0) != 0xAA)
+	map_write8(map, 0xAA, 0);
+	if (map_read8(map, 0) != 0xAA)
 		return NULL;
 
 	/* Check the last byte is RAM */
-	map->write8(map, 0x55, map->size-1);
-	if (map->read8(map, map->size-1) != 0x55)
+	map_write8(map, 0x55, map->size-1);
+	if (map_read8(map, map->size-1) != 0x55)
 		return NULL;
 
-	map->write8(map, 0xAA, map->size-1);
-	if (map->read8(map, map->size-1) != 0xAA)
+	map_write8(map, 0xAA, map->size-1);
+	if (map_read8(map, map->size-1) != 0xAA)
 		return NULL;
 #endif
 	/* OK. It seems to be RAM. */
@@ -83,7 +83,7 @@
 {
 	struct map_info *map = (struct map_info *)mtd->priv;
 
-	map->copy_from(map, buf, from, len);
+	map_copy_from(map, buf, from, len);
 	*retlen = len;
 	return 0;
 }
@@ -92,7 +92,7 @@
 {
 	struct map_info *map = (struct map_info *)mtd->priv;
 
-	map->copy_to(map, to, buf, len);
+	map_copy_to(map, to, buf, len);
 	*retlen = len;
 	return 0;
 }
@@ -105,7 +105,7 @@
 	unsigned long i;
 
 	for (i=0; i<instr->len; i++)
-		map->write8(map, 0xFF, instr->addr + i);
+		map_write8(map, 0xFF, instr->addr + i);
 
 	if (instr->callback)
 		instr->callback(instr);

Index: map_rom.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/map_rom.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- map_rom.c	2 Oct 2001 15:05:12 -0000	1.17
+++ map_rom.c	14 May 2003 15:05:13 -0000	1.18
@@ -58,7 +58,7 @@
 {
 	struct map_info *map = (struct map_info *)mtd->priv;
 
-	map->copy_from(map, buf, from, len);
+	map_copy_from(map, buf, from, len);
 	*retlen = len;
 	return 0;
 }

Index: sharp.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/sharp.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- sharp.c	13 Feb 2003 21:12:30 -0000	1.9
+++ sharp.c	14 May 2003 15:05:13 -0000	1.10
@@ -165,12 +165,12 @@
 	u32 read0, read4;
 	int width = 4;
 
-	tmp = map->read32(map, base+0);
+	tmp = map_read32(map, base+0);
 
-	map->write32(map, CMD_READ_ID, base+0);
+	map_write32(map, CMD_READ_ID, base+0);
 
-	read0=map->read32(map, base+0);
-	read4=map->read32(map, base+4);
+	read0=map_read32(map, base+0);
+	read4=map_read32(map, base+4);
 	if(read0 == 0x89898989){
 		printk("Looks like sharp flash\n");
 		switch(read4){
@@ -198,10 +198,10 @@
 			printk("Sort-of looks like sharp flash, 0x%08x 0x%08x\n",
 				read0,read4);
 		}
-	}else if((map->read32(map, base+0) == CMD_READ_ID)){
+	}else if((map_read32(map, base+0) == CMD_READ_ID)){
 		/* RAM, probably */
 		printk("Looks like RAM\n");
-		map->write32(map, tmp, base+0);
+		map_write32(map, tmp, base+0);
 	}else{
 		printk("Doesn't look like sharp flash, 0x%08x 0x%08x\n",
 			read0,read4);
@@ -223,10 +223,10 @@
 
 	switch(chip->state){
 	case FL_READY:
-		map->write32(map,CMD_READ_STATUS,adr);
+		map_write32(map,CMD_READ_STATUS,adr);
 		chip->state = FL_STATUS;
 	case FL_STATUS:
-		status = map->read32(map,adr);
+		status = map_read32(map,adr);
 //printk("status=%08x\n",status);
 
 		udelay(100);
@@ -254,7 +254,7 @@
 		goto retry;
 	}
 
-	map->write32(map,CMD_RESET, adr);
+	map_write32(map,CMD_RESET, adr);
 
 	chip->state = FL_READY;
 
@@ -295,7 +295,7 @@
 		if(ret<0)
 			break;
 
-		map->copy_from(map,buf,ofs,thislen);
+		map_copy_from(map,buf,ofs,thislen);
 
 		sharp_release(&sharp->chips[chipnum]);
 
@@ -356,17 +356,17 @@
 	ret = sharp_wait(map,chip);
 
 	for(try=0;try<10;try++){
-		map->write32(map,CMD_BYTE_WRITE,adr);
+		map_write32(map,CMD_BYTE_WRITE,adr);
 		/* cpu_to_le32 -> hack to fix the writel be->le conversion */
-		map->write32(map,cpu_to_le32(datum),adr);
+		map_write32(map,cpu_to_le32(datum),adr);
 
 		chip->state = FL_WRITING;
 
 		timeo = jiffies + (HZ/2);
 
-		map->write32(map,CMD_READ_STATUS,adr);
+		map_write32(map,CMD_READ_STATUS,adr);
 		for(i=0;i<100;i++){
-			status = map->read32(map,adr);
+			status = map_read32(map,adr);
 			if((status & SR_READY)==SR_READY)
 				break;
 		}
@@ -379,9 +379,9 @@
 
 		printk("sharp: error writing byte at addr=%08lx status=%08x\n",adr,status);
 
-		map->write32(map,CMD_CLEAR_STATUS,adr);
+		map_write32(map,CMD_CLEAR_STATUS,adr);
 	}
-	map->write32(map,CMD_RESET,adr);
+	map_write32(map,CMD_RESET,adr);
 	chip->state = FL_READY;
 
 	wake_up(&chip->wq);
@@ -438,14 +438,14 @@
 	int status;
 	DECLARE_WAITQUEUE(wait, current);
 
-	map->write32(map,CMD_READ_STATUS,adr);
-	status = map->read32(map,adr);
+	map_write32(map,CMD_READ_STATUS,adr);
+	status = map_read32(map,adr);
 
 	timeo = jiffies + HZ;
 
 	while(time_before(jiffies, timeo)){
-		map->write32(map,CMD_READ_STATUS,adr);
-		status = map->read32(map,adr);
+		map_write32(map,CMD_READ_STATUS,adr);
+		status = map_read32(map,adr);
 		if((status & SR_READY)==SR_READY){
 			ret = 0;
 			goto out;
@@ -487,26 +487,26 @@
 	sharp_unlock_oneblock(map,chip,adr);
 #endif
 
-	map->write32(map,CMD_BLOCK_ERASE_1,adr);
-	map->write32(map,CMD_BLOCK_ERASE_2,adr);
+	map_write32(map,CMD_BLOCK_ERASE_1,adr);
+	map_write32(map,CMD_BLOCK_ERASE_2,adr);
 
 	chip->state = FL_ERASING;
 
 	ret = sharp_do_wait_for_ready(map,chip,adr);
 	if(ret<0)return ret;
 
-	map->write32(map,CMD_READ_STATUS,adr);
-	status = map->read32(map,adr);
+	map_write32(map,CMD_READ_STATUS,adr);
+	status = map_read32(map,adr);
 
 	if(!(status&SR_ERRORS)){
-		map->write32(map,CMD_RESET,adr);
+		map_write32(map,CMD_RESET,adr);
 		chip->state = FL_READY;
 		//spin_unlock_bh(chip->mutex);
 		return 0;
 	}
 
 	printk("sharp: error erasing block at addr=%08lx status=%08x\n",adr,status);
-	map->write32(map,CMD_CLEAR_STATUS,adr);
+	map_write32(map,CMD_CLEAR_STATUS,adr);
 
 	//spin_unlock_bh(chip->mutex);
 
@@ -520,17 +520,17 @@
 	int i;
 	int status;
 
-	map->write32(map,CMD_CLEAR_BLOCK_LOCKS_1,adr);
-	map->write32(map,CMD_CLEAR_BLOCK_LOCKS_2,adr);
+	map_write32(map,CMD_CLEAR_BLOCK_LOCKS_1,adr);
+	map_write32(map,CMD_CLEAR_BLOCK_LOCKS_2,adr);
 
 	udelay(100);
 
-	status = map->read32(map,adr);
+	status = map_read32(map,adr);
 	printk("status=%08x\n",status);
 
 	for(i=0;i<1000;i++){
-		//map->write32(map,CMD_READ_STATUS,adr);
-		status = map->read32(map,adr);
+		//map_write32(map,CMD_READ_STATUS,adr);
+		status = map_read32(map,adr);
 		if((status & SR_READY)==SR_READY)
 			break;
 		udelay(100);
@@ -540,13 +540,13 @@
 	}
 
 	if(!(status&SR_ERRORS)){
-		map->write32(map,CMD_RESET,adr);
+		map_write32(map,CMD_RESET,adr);
 		chip->state = FL_READY;
 		return;
 	}
 
 	printk("sharp: error unlocking block at addr=%08lx status=%08x\n",adr,status);
-	map->write32(map,CMD_CLEAR_STATUS,adr);
+	map_write32(map,CMD_CLEAR_STATUS,adr);
 }
 #endif
 


From dwmw2 at infradead.org  Wed May 14 11:05:19 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:14 2006
Subject: mtd/drivers/mtd/maps map_funcs.c,NONE,1.1 Config.in,1.47,1.48
 GNUmakefile,1.9,1.10 Kconfig,1.6,1.7 Makefile,1.40,1.41
 amd76xrom.c,1.3,1.4 arctic-mtd.c,1.4,1.5 autcpu12-nvram.c,1.1,1.2
 beech-mtd.c,1.3,1.4 cdb89712.c,1.3,1.4 ceiva.c,1.3,1.4
 cfi_flagadm.c,1.7,1.8 cstm_mips_ixx.c,1.5,1.6 dbox2-flash.c,1.5,1.6
 dc21285.c,1.10,1.11 dilnetpc.c,1.8,1.9 ebony.c,1.3,1.4
 edb7312.c,1.3,1.4 elan-104nc.c,1.13,1.14 epxa10db-flash.c,1.5,1.6
 fortunet.c,1.2,1.3 h720x-flash.c,1.1,1.2 ich2rom.c,1.3,1.4
 impa7.c,1.3,1.4 integrator-flash.c,1.8,1.9 iq80310.c,1.10,1.11
 l440gx.c,1.8,1.9 lasat.c,1.1,1.2 lubbock-flash.c,1.2,1.3
 mbx860.c,1.1,1.2 netsc520.c,1.5,1.6 nettel.c,1.1,1.2
 ocelot.c,1.7,1.8 octagon-5066.c,1.20,1.21 pb1xxx-flash.c,1.4,1.5
 pci.c,1.2,1.3 pcmciamtd.c,1.40,1.41 physmap.c,1.22,1.23
 pnc2000.c,1.10,1.11 redwood.c,1.2,1.3 rpxlite.c,1.15,1.16
 sa1100-flash.c,1.30,1.31 sbc_gxx.c,1.21,1.22 sc520cdp.c,1.11,1.12
 scb2_flash.c,1.2,1.3 scx200_docflash.c,1.1,1.2
 solutionengine.c,1.5,1.6 sun_uflash.c,1.4,1.5 tqm8xxl.c,1.4,1.5
 tsunami_flash.c,1.1,1.2 uclinux.c,1.2,1.3 vmax301.c,1.24,1.25
 physmap64.c,1.1,NONE
Message-ID: <E19Fxol-0006s6-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv26387/drivers/mtd/maps

Modified Files:
	Config.in GNUmakefile Kconfig Makefile amd76xrom.c 
	arctic-mtd.c autcpu12-nvram.c beech-mtd.c cdb89712.c ceiva.c 
	cfi_flagadm.c cstm_mips_ixx.c dbox2-flash.c dc21285.c 
	dilnetpc.c ebony.c edb7312.c elan-104nc.c epxa10db-flash.c 
	fortunet.c h720x-flash.c ich2rom.c impa7.c integrator-flash.c 
	iq80310.c l440gx.c lasat.c lubbock-flash.c mbx860.c netsc520.c 
	nettel.c ocelot.c octagon-5066.c pb1xxx-flash.c pci.c 
	pcmciamtd.c physmap.c pnc2000.c redwood.c rpxlite.c 
	sa1100-flash.c sbc_gxx.c sc520cdp.c scb2_flash.c 
	scx200_docflash.c solutionengine.c sun_uflash.c tqm8xxl.c 
	tsunami_flash.c uclinux.c vmax301.c 
Added Files:
	map_funcs.c 
Removed Files:
	physmap64.c 
Log Message:
Make support for non-linear mappings conditional

***** Error reading new file: [Errno 2] No such file or directory: 'map_funcs.c'
Index: Config.in
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Config.in,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- Config.in	20 Apr 2003 08:38:01 -0000	1.47
+++ Config.in	14 May 2003 15:05:14 -0000	1.48
@@ -21,19 +21,19 @@
    dep_tristate '  CFI Flash device mapped on Photron PNC-2000' CONFIG_MTD_PNC2000 $CONFIG_MTD_CFI $CONFIG_MTD_PARTITIONS
    dep_tristate '  CFI Flash device mapped on AMD SC520 CDP' CONFIG_MTD_SC520CDP $CONFIG_MTD_CFI
    dep_tristate '  CFI Flash device mapped on AMD NetSc520'  CONFIG_MTD_NETSC520 $CONFIG_MTD_CFI $CONFIG_MTD_PARTITIONS
-   dep_tristate '  CFI Flash device mapped on Arcom SBC-GXx boards' CONFIG_MTD_SBC_GXX $CONFIG_MTD_CFI_INTELEXT $CONFIG_MTD_PARTITIONS
-   dep_tristate '  CFI Flash device mapped on Arcom ELAN-104NC' CONFIG_MTD_ELAN_104NC $CONFIG_MTD_CFI_INTELEXT $CONFIG_MTD_PARTITIONS
+   dep_tristate '  CFI Flash device mapped on Arcom SBC-GXx boards' CONFIG_MTD_SBC_GXX $CONFIG_MTD_CFI_INTELEXT $CONFIG_MTD_PARTITIONS $CONFIG_MTD_COMPLEX_MAPPINGS
+   dep_tristate '  CFI Flash device mapped on Arcom ELAN-104NC' CONFIG_MTD_ELAN_104NC $CONFIG_MTD_CFI_INTELEXT $CONFIG_MTD_PARTITIONS $CONFIG_MTD_COMPLEX_MAPPINGS
    dep_tristate '  CFI Flash device mapped on DIL/Net PC' CONFIG_MTD_DILNETPC $CONFIG_MTD_CFI_INTELEXT $CONFIG_MTD_PARTITIONS $CONFIG_MTD_CONCAT
    if [ "$CONFIG_MTD_DILNETPC" = "y" -o "$CONFIG_MTD_DILNETPC" = "m" ]; then
      hex '    Size of boot partition' CONFIG_MTD_DILNETPC_BOOTSIZE 0x80000
    fi
    dep_tristate '  JEDEC Flash device mapped on Mixcom piggyback card' CONFIG_MTD_MIXMEM $CONFIG_MTD_JEDEC
-   dep_tristate '  JEDEC Flash device mapped on Octagon 5066 SBC' CONFIG_MTD_OCTAGON $CONFIG_MTD_JEDEC
-   dep_tristate '  JEDEC Flash device mapped on Tempustech VMAX SBC301' CONFIG_MTD_VMAX $CONFIG_MTD_JEDEC
+   dep_tristate '  JEDEC Flash device mapped on Octagon 5066 SBC' CONFIG_MTD_OCTAGON $CONFIG_MTD_JEDEC $CONFIG_MTD_COMPLEX_MAPPINGS
+   dep_tristate '  JEDEC Flash device mapped on Tempustech VMAX SBC301' CONFIG_MTD_VMAX $CONFIG_MTD_JEDEC $CONFIG_MTD_COMPLEX_MAPPINGS
    dep_tristate '  Flash device mapped with DOCCS on NatSemi SCx200' CONFIG_MTD_SCx200_DOCFLASH $CONFIG_MTD_CFI
    dep_tristate '  BIOS flash chip on Intel L440GX boards' CONFIG_MTD_L440GX $CONFIG_MTD_JEDECPROBE
    dep_tristate '  ROM connected to AMD76X southbridge' CONFIG_MTD_AMD76XROM $CONFIG_MTD_GEN_PROBE   
-   dep_tristate '  ROM connected to Intel Hub Controller 2' CONFIG_MTD_ICH2ROM $CONFIG_MTD_JEDECPROBE
+   dep_tristate '  ROM connected to Intel Hub Controller 2' CONFIG_MTD_ICH2ROM $CONFIG_MTD_JEDECPROBE $CONFIG_MTD_COMPLEX_MAPPINGS
    dep_tristate '  CFI Flash device mapped on SnapGear/SecureEdge' CONFIG_MTD_NETtel $CONFIG_MTD_PARTITIONS
    dep_tristate '  BIOS flash chip on Intel SCB2 boards' CONFIG_MTD_SCB2_FLASH $CONFIG_MTD_GEN_PROBE
 fi
@@ -94,11 +94,10 @@
 fi
 
 if [ "$CONFIG_ARM" = "y" ]; then
-   dep_tristate '  CFI Flash device mapped on Nora' CONFIG_MTD_NORA $CONFIG_MTD_CFI
    dep_tristate '  CFI Flash device mapped on ARM Integrator/P720T' CONFIG_MTD_ARM_INTEGRATOR $CONFIG_MTD_CFI
    dep_tristate '  Cirrus CDB89712 evaluation board mappings' CONFIG_MTD_CDB89712 $CONFIG_MTD_CFI $CONFIG_ARCH_CDB89712
    dep_tristate '  CFI Flash device mapped on StrongARM SA11x0' CONFIG_MTD_SA1100 $CONFIG_MTD_CFI $CONFIG_ARCH_SA1100 $CONFIG_MTD_PARTITIONS
-   dep_tristate '  CFI Flash device mapped on DC21285 Footbridge' CONFIG_MTD_DC21285 $CONFIG_MTD_CFI $CONFIG_ARCH_FOOTBRIDGE
+   dep_tristate '  CFI Flash device mapped on DC21285 Footbridge' CONFIG_MTD_DC21285 $CONFIG_MTD_CFI $CONFIG_ARCH_FOOTBRIDGE $CONFIG_MTD_COMPLEX_MAPPINGS
    dep_tristate '  CFI Flash device mapped on the XScale IQ80310 board' CONFIG_MTD_IQ80310 $CONFIG_MTD_CFI $CONFIG_ARCH_IQ80310
    dep_tristate '  CFI Flash device mapped on the XScale Lubbock board' CONFIG_MTD_LUBBOCK $CONFIG_MTD_CFI $CONFIG_ARCH_LUBBOCK
    dep_tristate '  CFI Flash device mapped on Epxa10db' CONFIG_MTD_EPXA10DB $CONFIG_MTD_CFI  $CONFIG_MTD_PARTITIONS $CONFIG_ARCH_CAMELOT
@@ -110,7 +109,7 @@
    dep_tristate '  JEDEC Flash device mapped on Ceiva/Polaroid PhotoMax Digital Picture Frame' CONFIG_MTD_CEIVA $CONFIG_MTD_JEDECPROBE  $CONFIG_ARCH_CEIVA
 fi
 if [ "$CONFIG_ALPHA" = "y" ]; then
-   dep_tristate '  Flash chip mapping on TSUNAMI' CONFIG_MTD_TSUNAMI $CONFIG_MTD_GENPROBE
+   dep_tristate '  Flash chip mapping on TSUNAMI' CONFIG_MTD_TSUNAMI $CONFIG_MTD_GENPROBE $CONFIG_MTD_COMPLEX_MAPPINGS
 fi
 
 if [ "$CONFIG_UCLINUX" = "y" ]; then
@@ -118,7 +117,7 @@
 fi
 
 # This needs CFI or JEDEC, depending on the cards found.
-dep_tristate '  PCI MTD driver' CONFIG_MTD_PCI $CONFIG_MTD $CONFIG_PCI
-dep_tristate '  PCMCIA MTD driver' CONFIG_MTD_PCMCIA $CONFIG_MTD $CONFIG_PCMCIA
+dep_tristate '  PCI MTD driver' CONFIG_MTD_PCI $CONFIG_MTD $CONFIG_PCI $CONFIG_MTD_COMPLEX_MAPPINGS
+dep_tristate '  PCMCIA MTD driver' CONFIG_MTD_PCMCIA $CONFIG_MTD $CONFIG_PCMCIA $CONFIG_MTD_COMPLEX_MAPPINGS
 
 endmenu

Index: GNUmakefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/GNUmakefile,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- GNUmakefile	13 Sep 2002 15:22:50 -0000	1.9
+++ GNUmakefile	14 May 2003 15:05:14 -0000	1.10
@@ -3,7 +3,6 @@
 ifndef CONFIG_MTD
 
 # We're being invoked outside a normal kernel build. Fake it
-
 # CONFIG_MTD_ARM := m
 CONFIG_MTD_CFI_FLAGADM := m
 # CONFIG_MTD_CSTM_MIPS_IXX := m

Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Kconfig,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Kconfig	20 Apr 2003 08:38:01 -0000	1.6
+++ Kconfig	14 May 2003 15:05:14 -0000	1.7
@@ -4,6 +4,13 @@
 menu "Mapping drivers for chip access"
 	depends on MTD!=n
 
+config MTD_COMPLEX_MAPPINGS
+	bool "Support non-linear mappings of flash chips"
+	depends on MTD
+	help
+	  This causes the chip drivers to allow for complicated
+	  paged mappings of flash chips.
+
 config MTD_PHYSMAP
 	tristate "CFI Flash device in physical memory map"
 	depends on MTD_CFI
@@ -80,7 +87,7 @@
 
 config MTD_SBC_GXX
 	tristate "CFI Flash device mapped on Arcom SBC-GXx boards"
-	depends on X86 && MTD_CFI_INTELEXT && MTD_PARTITIONS
+	depends on X86 && MTD_CFI_INTELEXT && MTD_PARTITIONS && MTD_COMPLEX_MAPPINGS
 	help
 	  This provides a driver for the on-board flash of Arcom Control
 	  Systems' SBC-GXn family of boards, formerly known as SBC-MediaGX.
@@ -91,7 +98,7 @@
 
 config MTD_ELAN_104NC
 	tristate "CFI Flash device mapped on Arcom ELAN-104NC"
-	depends on X86 && MTD_CFI_INTELEXT && MTD_PARTITIONS
+	depends on X86 && MTD_CFI_INTELEXT && MTD_PARTITIONS && MTD_COMPLEX_MAPPINGS
 	help
 	  This provides a driver for the on-board flash of the Arcom Control
 	  System's ELAN-104NC development board. By default the flash
@@ -119,7 +126,7 @@
 
 config MTD_OCTAGON
 	tristate "JEDEC Flash device mapped on Octagon 5066 SBC"
-	depends on X86 && MTD_JEDEC
+	depends on X86 && MTD_JEDEC && MTD_COMPLEX_MAPPINGS
 	help
 	  This provides a 'mapping' driver which supports the way in which
 	  the flash chips are connected in the Octagon-5066 Single Board
@@ -128,7 +135,7 @@
 
 config MTD_VMAX
 	tristate "JEDEC Flash device mapped on Tempustech VMAX SBC301"
-	depends on X86 && MTD_JEDEC
+	depends on X86 && MTD_JEDEC && MTD_COMPLEX_MAPPINGS
 	help
 	  This provides a 'mapping' driver which supports the way in which
 	  the flash chips are connected in the Tempustech VMAX SBC301 Single
@@ -281,12 +288,6 @@
 	  This enables access to the flash chips on the Hitachi SolutionEngine and
 	  similar boards. Say 'Y' if you are building a kernel for such a board.
 
-config MTD_NORA
-	tristate "CFI Flash device mapped on Nora"
-	depends on ARM && MTD_CFI
-	help
-	  If you had to ask, you don't have one. Say 'N'.
-
 config MTD_ARM_INTEGRATOR
 	tristate "CFI Flash device mapped on ARM Integrator/P720T"
 	depends on ARM && MTD_CFI
@@ -308,7 +309,7 @@
 
 config MTD_DC21285
 	tristate "CFI Flash device mapped on DC21285 Footbridge"
-	depends on ARM && MTD_CFI && ARCH_FOOTBRIDGE
+	depends on ARM && MTD_CFI && ARCH_FOOTBRIDGE && MTD_COMPLEX_MAPPINGS
 	help
 	  This provides a driver for the flash accessed using Intel's
 	  21285 bridge used with Intel's StrongARM processors. More info at

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Makefile,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- Makefile	20 Apr 2003 08:38:01 -0000	1.40
+++ Makefile	14 May 2003 15:05:14 -0000	1.41
@@ -9,6 +9,12 @@
 O_TARGET	:= mapslink.o
 endif
 
+export-objs := map_funcs.o
+
+ifeq ($(CONFIG_MTD_COMPLEX_MAPPINGS),y)
+obj-m				+= map_funcs.o
+endif
+
 # Chip mappings
 obj-$(CONFIG_MTD_CDB89712)	+= cdb89712.o
 obj-$(CONFIG_MTD_ARM_INTEGRATOR)+= integrator-flash.o
@@ -25,16 +31,9 @@
 obj-$(CONFIG_MTD_TSUNAMI)	+= tsunami_flash.o
 obj-$(CONFIG_MTD_LUBBOCK)	+= lubbock-flash.o
 obj-$(CONFIG_MTD_MBX860)	+= mbx860.o
-obj-$(CONFIG_MTD_NORA)		+= nora.o
 obj-$(CONFIG_MTD_CEIVA)		+= ceiva.o
 obj-$(CONFIG_MTD_OCTAGON)	+= octagon-5066.o
-ifneq ($(CONFIG_MTD_PHYSMAP),n)
-  ifeq ($(CONFIG_MTD_PHYSMAP_BUSWIDTH),8)
-    obj-$(CONFIG_MTD_PHYSMAP)	+= physmap64.o 
-  else
-    obj-$(CONFIG_MTD_PHYSMAP)	+= physmap.o 
-  endif
-endif
+obj-$(CONFIG_MTD_PHYSMAP)	+= physmap.o 
 obj-$(CONFIG_MTD_PNC2000)	+= pnc2000.o
 obj-$(CONFIG_MTD_PCMCIA)	+= pcmciamtd.o
 obj-$(CONFIG_MTD_RPXLITE)	+= rpxlite.o

Index: amd76xrom.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/amd76xrom.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- amd76xrom.c	8 Apr 2003 13:26:06 -0000	1.3
+++ amd76xrom.c	14 May 2003 15:05:14 -0000	1.4
@@ -24,68 +24,15 @@
 	struct pci_dev *pdev;
 };
 
-static __u8 amd76xrom_read8(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readb(map->map_priv_1 + ofs);
-}
-
-static __u16 amd76xrom_read16(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readw(map->map_priv_1 + ofs);
-}
-
-static __u32 amd76xrom_read32(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readl(map->map_priv_1 + ofs);
-}
-
-static void amd76xrom_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-static void amd76xrom_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	__raw_writeb(d, map->map_priv_1 + adr);
-	mb();
-}
-
-static void amd76xrom_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	__raw_writew(d, map->map_priv_1 + adr);
-	mb();
-}
-
-static void amd76xrom_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	__raw_writel(d, map->map_priv_1 + adr);
-	mb();
-}
-
-static void amd76xrom_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio(map->map_priv_1 + to, from, len);
-}
 
 static struct amd76xrom_map_info amd76xrom_map = {
-	map: {
-		name: "AMD76X rom",
-		size: 0,
-		buswidth: 1,
-		read8: amd76xrom_read8,
-		read16: amd76xrom_read16,
-		read32: amd76xrom_read32,
-		copy_from: amd76xrom_copy_from,
-		write8: amd76xrom_write8,
-		write16: amd76xrom_write16,
-		write32: amd76xrom_write32,
-		copy_to: amd76xrom_copy_to,
-		/* The standard rom socket is for single power supply chips
-		 * that don't have an extra vpp.
-		 */
+	.map = {
+		.name = "AMD76X rom",
+		.size = 0,
+		.buswidth = 1,
 	},
-	mtd: 0,
-	window_addr: 0,
+	.mtd = 0,
+	.window_addr = 0,
 };
 
 static int __devinit amd76xrom_init_one (struct pci_dev *pdev,
@@ -154,9 +101,11 @@
 		if (rom_size > window->size) {
 			continue;
 		}
-		info->map.map_priv_1 = 
+		info->map.phys = window->start + window->size - rom_size
+		info->map.virt = 
 			info->window_addr + window->size - rom_size;
 		info->map.size = rom_size;
+		simple_map_init(&info->map);
 		chip_type = rom_probe_types;
 		for(; !info->mtd && *chip_type; chip_type++) {
 			info->mtd = do_map_probe(*chip_type, &amd76xrom_map.map);
@@ -168,7 +117,7 @@
 	if (!info->mtd) {
 		goto err_out_iounmap;
 	}
-	printk(KERN_NOTICE "amd76xrom chip at offset: %x\n",
+	printk(KERN_NOTICE "amd76xrom chip at offset: 0x%x\n",
 		window->size - rom_size);
 		
 	info->mtd->module = THIS_MODULE;
@@ -196,7 +145,7 @@
 	del_mtd_device(info->mtd);
 	map_destroy(info->mtd);
 	info->mtd = 0;
-	info->map.map_priv_1 = 0;
+	info->map.virt = 0;
 
 	iounmap((void *)(info->window_addr));
 	info->window_addr = 0;
@@ -223,10 +172,10 @@
 
 #if 0
 static struct pci_driver amd76xrom_driver = {
-	name:	  "amd76xrom",
-	id_table: amd76xrom_pci_tbl,
-	probe:    amd76xrom_init_one,
-	remove:   amd76xrom_remove_one,
+	.name =		"amd76xrom",
+	.id_table =	amd76xrom_pci_tbl,
+	.probe =	amd76xrom_init_one,
+	.remove =	amd76xrom_remove_one,
 };
 #endif
 

Index: arctic-mtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/arctic-mtd.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- arctic-mtd.c	2 Apr 2003 18:57:15 -0000	1.4
+++ arctic-mtd.c	14 May 2003 15:05:14 -0000	1.5
@@ -59,64 +59,6 @@
 
 /* Flash memories on these boards are memory resources, accessed big-endian. */
 
-static u8
-arctic_mtd_read8(struct map_info *map, unsigned long offset)
-{
-	return __raw_readb(map->map_priv_1 + offset);
-}
-
-static u16
-arctic_mtd_read16(struct map_info *map, unsigned long offset)
-{
-	return __raw_readw(map->map_priv_1 + offset);
-}
-
-static u32
-arctic_mtd_read32(struct map_info *map, unsigned long offset)
-{
-	return __raw_readl(map->map_priv_1 + offset);
-}
-
-static void
-arctic_mtd_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, (void *) (map->map_priv_1 + from), len);
-}
-
-static void
-arctic_mtd_write8(struct map_info *map, u8 data, unsigned long address)
-{
-	__raw_writeb(data, map->map_priv_1 + address);
-	mb();
-}
-
-static void
-arctic_mtd_write16(struct map_info *map, u16 data, unsigned long address)
-{
-	__raw_writew(data, map->map_priv_1 + address);
-	mb();
-}
-
-static void
-arctic_mtd_write32(struct map_info *map, u32 data, unsigned long address)
-{
-	__raw_writel(data, map->map_priv_1 + address);
-	mb();
-}
-
-static void
-arctic_mtd_copy_to(struct map_info *map,
-		  unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio((void *) (map->map_priv_1 + to), from, len);
-}
-
-u_char * arctic_mtd_point(struct map_info *map, loff_t from, size_t len)
-{
-	return (u_char *)(map->map_priv_1 + (unsigned long)from);
-}
-
-void arctic_mtd_unpoint(struct map_info *map,  u_char *adr, loff_t from, size_t len)
 {
   /* do nothing for now */
 }
@@ -125,16 +67,7 @@
 	.name		= NAME,
 	.size		= SIZE,
 	.buswidth	= BUSWIDTH,
-	.read8		= arctic_mtd_read8,
-	.read16		= arctic_mtd_read16,
-	.read32		= arctic_mtd_read32,
-	.point		= arctic_mtd_point,
-	.unpoint	= arctic_mtd_unpoint,
-	.copy_from	= arctic_mtd_copy_from,
-	.write8		= arctic_mtd_write8,
-	.write16	= arctic_mtd_write16,
-	.write32	= arctic_mtd_write32,
-	.copy_to	= arctic_mtd_copy_to,
+	.phys		= PADDR,
 };
 
 static struct mtd_info *arctic_mtd;
@@ -157,12 +90,13 @@
 {
 	printk("%s: 0x%08x at 0x%08x\n", NAME, SIZE, PADDR);
 
-	arctic_mtd_map.map_priv_1 = (unsigned long) ioremap(PADDR, SIZE);
+	arctic_mtd_map.virt = (unsigned long) ioremap(PADDR, SIZE);
 
-	if (!arctic_mtd_map.map_priv_1) {
+	if (!arctic_mtd_map.virt) {
 		printk("%s: failed to ioremap 0x%x\n", NAME, PADDR);
 		return -EIO;
 	}
+	simple_map_init(&arctic_mtd_map);
 
 	printk("%s: probing %d-bit flash bus\n", NAME, BUSWIDTH * 8);
 	arctic_mtd = do_map_probe("cfi_probe", &arctic_mtd_map);
@@ -181,7 +115,7 @@
 	if (arctic_mtd) {
 		del_mtd_partitions(arctic_mtd);
 		map_destroy(arctic_mtd);
-		iounmap((void *) arctic_mtd_map.map_priv_1);
+		iounmap((void *) arctic_mtd_map.virt);
 	}
 }
 

Index: autcpu12-nvram.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/autcpu12-nvram.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- autcpu12-nvram.c	22 Feb 2002 09:30:24 -0000	1.1
+++ autcpu12-nvram.c	14 May 2003 15:05:14 -0000	1.2
@@ -32,81 +32,28 @@
 #include <linux/mtd/map.h>
 #include <linux/mtd/partitions.h>
 
-__u8 autcpu12_read8(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readb(map->map_priv_1 + ofs);
-}
-
-__u16 autcpu12_read16(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readw(map->map_priv_1 + ofs);
-}
-
-__u32 autcpu12_read32(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void autcpu12_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	__raw_writeb(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void autcpu12_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	__raw_writew(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void autcpu12_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	__raw_writel(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void autcpu12_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void autcpu12_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	while(len) {
-		__raw_writeb(*(unsigned char *) from, map->map_priv_1 + to);
-		from++;
-		to++;
-		len--;
-	}
-}
 
 static struct mtd_info *sram_mtd;
 
 struct map_info autcpu12_sram_map = {
-	name: "SRAM",
-	size: 32768,
-	buswidth: 8,
-	read8: autcpu12_read8,
-	read16: autcpu12_read16,
-	read32: autcpu12_read32,
-	copy_from: autcpu12_copy_from,
-	write8: autcpu12_write8,
-	write16: autcpu12_write16,
-	write32: autcpu12_write32,
-	copy_to: autcpu12_copy_to
+	.name = "SRAM",
+	.size = 32768,
+	.buswidth = 4,
+	.phys = 0x12000000,
 };
 
 static int __init init_autcpu12_sram (void)
 {
 	int err, save0, save1;
 
-	autcpu12_sram_map.map_priv_1 = (unsigned long)ioremap(0x12000000, SZ_128K);
-	if (!autcpu12_sram_map.map_priv_1) {
+	autcpu12_sram_map.virt = (unsigned long)ioremap(0x12000000, SZ_128K);
+	if (!autcpu12_sram_map.virt) {
 		printk("Failed to ioremap autcpu12 NV-RAM space\n");
 		err = -EIO;
 		goto out;
 	}
-	
+	simple_map_init(&autcpu_sram_map);
+
 	/* 
 	 * Check for 32K/128K 
 	 * read ofs 0 
@@ -115,20 +62,20 @@
 	 * Read	and check result on ofs 0x0
 	 * Restore contents
 	 */
-	save0 = autcpu12_read32(&autcpu12_sram_map,0);
-	save1 = autcpu12_read32(&autcpu12_sram_map,0x10000);
-	autcpu12_write32(&autcpu12_sram_map,~save0,0x10000);
+	save0 = map_read32(&autcpu12_sram_map,0);
+	save1 = map_read32(&autcpu12_sram_map,0x10000);
+	map_write32(&autcpu12_sram_map,~save0,0x10000);
 	/* if we find this pattern on 0x0, we have 32K size 
 	 * restore contents and exit
 	 */
-	if ( autcpu12_read32(&autcpu12_sram_map,0) != save0) {
-		autcpu12_write32(&autcpu12_sram_map,save0,0x0);
+	if ( map_read32(&autcpu12_sram_map,0) != save0) {
+		map_write32(&autcpu12_sram_map,save0,0x0);
 		goto map;
 	}
 	/* We have a 128K found, restore 0x10000 and set size
 	 * to 128K
 	 */
-	autcpu12_write32(&autcpu12_sram_map,save1,0x10000);
+	ma[_write32(&autcpu12_sram_map,save1,0x10000);
 	autcpu12_sram_map.size = SZ_128K;
 
 map:
@@ -148,7 +95,7 @@
 		goto out_probe;
 	}
 
-	printk("NV-RAM device size %ldK registered on AUTCPU12\n",autcpu12_sram_map.size/SZ_1K);
+	printk("NV-RAM device size %ldKiB registered on AUTCPU12\n",autcpu12_sram_map.size/SZ_1K);
 		
 	return 0;
 
@@ -157,7 +104,7 @@
 	sram_mtd = 0;
 
 out_ioremap:
-	iounmap((void *)autcpu12_sram_map.map_priv_1);
+	iounmap((void *)autcpu12_sram_map.virt);
 out:
 	return err;
 }
@@ -167,7 +114,7 @@
 	if (sram_mtd) {
 		del_mtd_device(sram_mtd);
 		map_destroy(sram_mtd);
-		iounmap((void *)autcpu12_sram_map.map_priv_1);
+		iounmap((void *)autcpu12_sram_map.virt);
 	}
 }
 

Index: beech-mtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/beech-mtd.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- beech-mtd.c	31 Jan 2003 08:27:38 -0000	1.3
+++ beech-mtd.c	14 May 2003 15:05:14 -0000	1.4
@@ -46,96 +46,25 @@
 
 /* Flash memories on these boards are memory resources, accessed big-endian. */
 
-static __u8
-beech_mtd_read8(struct map_info *map, unsigned long offset)
-{
-	return __raw_readb(map->map_priv_1 + offset);
-}
-
-static __u16
-beech_mtd_read16(struct map_info *map, unsigned long offset)
-{
-	return __raw_readw(map->map_priv_1 + offset);
-}
-
-static __u32
-beech_mtd_read32(struct map_info *map, unsigned long offset)
-{
-	return __raw_readl(map->map_priv_1 + offset);
-}
-
-static void
-beech_mtd_copy_from(struct map_info *map,
-		    void *to, unsigned long from, ssize_t len)
-{
-	memcpy(to, (void *) (map->map_priv_1 + from), len);
-}
-
-static void
-beech_mtd_write8(struct map_info *map, __u8 data, unsigned long address)
-{
-	__raw_writeb(data, map->map_priv_1 + address);
-	mb();
-}
-
-static void
-beech_mtd_write16(struct map_info *map, __u16 data, unsigned long address)
-{
-	__raw_writew(data, map->map_priv_1 + address);
-	mb();
-}
-
-static void
-beech_mtd_write32(struct map_info *map, __u32 data, unsigned long address)
-{
-	__raw_writel(data, map->map_priv_1 + address);
-	mb();
-}
-
-static void
-beech_mtd_copy_to(struct map_info *map,
-		  unsigned long to, const void *from, ssize_t len)
-{
-	memcpy((void *) (map->map_priv_1 + to), from, len);
-}
-
-u_char * beech_mtd_point(struct map_info *map, loff_t from, size_t len)
-{
-	return (u_char *)(map->map_priv_1 + (unsigned long)from);
-}
-
-void beech_mtd_unpoint(struct map_info *map,  u_char *adr, loff_t from, size_t len)
-{
-  /* do nothing for now */
-}
 
 static struct map_info beech_mtd_map = {
-	name:		NAME,
-	size:		SIZE,
-	buswidth:	BUSWIDTH,
-	read8:		beech_mtd_read8,
-	read16:		beech_mtd_read16,
-	read32:		beech_mtd_read32,
-	point: 		beech_mtd_point,
-	unpoint: 	beech_mtd_unpoint,
-	copy_from:	beech_mtd_copy_from,
-	write8:		beech_mtd_write8,
-	write16:	beech_mtd_write16,
-	write32:	beech_mtd_write32,
-	copy_to:	beech_mtd_copy_to
+	.name =		NAME,
+	.size =		SIZE,
+	.buswidth =	BUSWIDTH,
+	.phys =		PADDR
 };
 
 static struct mtd_info *beech_mtd;
 
 static struct mtd_partition beech_partitions[2] = {
 	{
-	      name:"Linux Kernel",
-	      size:BEECH_KERNEL_SIZE,
-	      offset:BEECH_KERNEL_OFFSET
+	      .name = "Linux Kernel",
+	      .size = BEECH_KERNEL_SIZE,
+	      .offset = BEECH_KERNEL_OFFSET
 	}, {
-	      name:"Free Area",
-	      size:BEECH_FREE_AREA_SIZE,
-	      offset:BEECH_FREE_AREA_OFFSET
+	      .name = "Free Area",
+	      .size = BEECH_FREE_AREA_SIZE,
+	      .offset = BEECH_FREE_AREA_OFFSET
 	}
 };
 
@@ -144,13 +73,15 @@
 {
 	printk("%s: 0x%08x at 0x%08x\n", NAME, SIZE, PADDR);
 
-	beech_mtd_map.map_priv_1 = (unsigned long) ioremap(PADDR, SIZE);
+	beech_mtd_map.virt = (unsigned long) ioremap(PADDR, SIZE);
 
-	if (!beech_mtd_map.map_priv_1) {
+	if (!beech_mtd_map.virt) {
 		printk("%s: failed to ioremap 0x%x\n", NAME, PADDR);
 		return -EIO;
 	}
 
+	simple_map_init(&beech_mtd_map);
+
 	printk("%s: probing %d-bit flash bus\n", NAME, BUSWIDTH * 8);
 	beech_mtd = do_map_probe("cfi_probe", &beech_mtd_map);
 
@@ -168,7 +99,7 @@
 	if (beech_mtd) {
 		del_mtd_partitions(beech_mtd);
 		map_destroy(beech_mtd);
-		iounmap((void *) beech_mtd_map.map_priv_1);
+		iounmap((void *) beech_mtd_map.virt);
 	}
 }
 

Index: cdb89712.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/cdb89712.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- cdb89712.c	2 Oct 2001 15:14:43 -0000	1.3
+++ cdb89712.c	14 May 2003 15:05:14 -0000	1.4
@@ -16,77 +16,21 @@
 
 
 
-__u8 cdb89712_read8(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readb(map->map_priv_1 + ofs);
-}
-
-__u16 cdb89712_read16(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readw(map->map_priv_1 + ofs);
-}
-
-__u32 cdb89712_read32(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void cdb89712_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	__raw_writeb(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void cdb89712_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	__raw_writew(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void cdb89712_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	__raw_writel(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void cdb89712_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	// printk ("cdb89712_copy_from: 0x%x@0x%x -> 0x%x\n", len, from, to);
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void cdb89712_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	while(len) {
-		__raw_writeb(*(unsigned char *) from, map->map_priv_1 + to);
-		from++;
-		to++;
-		len--;
-	}
-}
-
 
 static struct mtd_info *flash_mtd;
 
 struct map_info cdb89712_flash_map = {
-	name: "flash",
-	size: FLASH_SIZE,
-	buswidth: FLASH_WIDTH,
-	read8: cdb89712_read8,
-	read16: cdb89712_read16,
-	read32: cdb89712_read32,
-	copy_from: cdb89712_copy_from,
-	write8: cdb89712_write8,
-	write16: cdb89712_write16,
-	write32: cdb89712_write32,
-	copy_to: cdb89712_copy_to
+	.name = "flash",
+	.size = FLASH_SIZE,
+	.buswidth = FLASH_WIDTH,
+	.phys = FLASH_START,
 };
 
 struct resource cdb89712_flash_resource = {
-	name:   "Flash",
-	start:  FLASH_START,
-	end:    FLASH_START + FLASH_SIZE - 1,
-	flags:  IORESOURCE_IO | IORESOURCE_BUSY,
+	.name =   "Flash",
+	.start =  FLASH_START,
+	.end =    FLASH_START + FLASH_SIZE - 1,
+	.flags =  IORESOURCE_IO | IORESOURCE_BUSY,
 };
 
 static int __init init_cdb89712_flash (void)
@@ -99,13 +43,13 @@
 		goto out;
 	}
 	
-	cdb89712_flash_map.map_priv_1 = (unsigned long)ioremap(FLASH_START, FLASH_SIZE);
-	if (!cdb89712_flash_map.map_priv_1) {
+	cdb89712_flash_map.virt = (unsigned long)ioremap(FLASH_START, FLASH_SIZE);
+	if (!cdb89712_flash_map.virt) {
 		printk(KERN_NOTICE "Failed to ioremap Cdb89712 FLASH space\n");
 		err = -EIO;
 		goto out_resource;
 	}
-
+	simple_map_init(&cdb89712_flash_map);
 	flash_mtd = do_map_probe("cfi_probe", &cdb89712_flash_map);
 	if (!flash_mtd) {
 		flash_mtd = do_map_probe("map_rom", &cdb89712_flash_map);
@@ -132,7 +76,7 @@
 	map_destroy(flash_mtd);
 	flash_mtd = 0;
 out_ioremap:
-	iounmap((void *)cdb89712_flash_map.map_priv_1);
+	iounmap((void *)cdb89712_flash_map.virt);
 out_resource:
 	release_resource (&cdb89712_flash_resource);
 out:
@@ -146,24 +90,17 @@
 static struct mtd_info *sram_mtd;
 
 struct map_info cdb89712_sram_map = {
-	name: "SRAM",
-	size: SRAM_SIZE,
-	buswidth: SRAM_WIDTH,
-	read8: cdb89712_read8,
-	read16: cdb89712_read16,
-	read32: cdb89712_read32,
-	copy_from: cdb89712_copy_from,
-	write8: cdb89712_write8,
-	write16: cdb89712_write16,
-	write32: cdb89712_write32,
-	copy_to: cdb89712_copy_to
+	.name = "SRAM",
+	.size = SRAM_SIZE,
+	.buswidth = SRAM_WIDTH,
+	.phys = SRAM_START,
 };
 
 struct resource cdb89712_sram_resource = {
-	name:   "SRAM",
-	start:  SRAM_START,
-	end:    SRAM_START + SRAM_SIZE - 1,
-	flags:  IORESOURCE_IO | IORESOURCE_BUSY,
+	.name =   "SRAM",
+	.start =  SRAM_START,
+	.end =    SRAM_START + SRAM_SIZE - 1,
+	.flags =  IORESOURCE_IO | IORESOURCE_BUSY,
 };
 
 static int __init init_cdb89712_sram (void)
@@ -176,13 +113,13 @@
 		goto out;
 	}
 	
-	cdb89712_sram_map.map_priv_1 = (unsigned long)ioremap(SRAM_START, SRAM_SIZE);
-	if (!cdb89712_sram_map.map_priv_1) {
+	cdb89712_sram_map.virt = (unsigned long)ioremap(SRAM_START, SRAM_SIZE);
+	if (!cdb89712_sram_map.virt) {
 		printk(KERN_NOTICE "Failed to ioremap Cdb89712 SRAM space\n");
 		err = -EIO;
 		goto out_resource;
 	}
-
+	simple_map_init(&cdb89712_sram_map);
 	sram_mtd = do_map_probe("map_ram", &cdb89712_sram_map);
 	if (!sram_mtd) {
 		printk("SRAM probe failed\n");
@@ -205,7 +142,7 @@
 	map_destroy(sram_mtd);
 	sram_mtd = 0;
 out_ioremap:
-	iounmap((void *)cdb89712_sram_map.map_priv_1);
+	iounmap((void *)cdb89712_sram_map.virt);
 out_resource:
 	release_resource (&cdb89712_sram_resource);
 out:
@@ -221,20 +158,17 @@
 static struct mtd_info *bootrom_mtd;
 
 struct map_info cdb89712_bootrom_map = {
-	name: "BootROM",
-	size: BOOTROM_SIZE,
-	buswidth: BOOTROM_WIDTH,
-	read8: cdb89712_read8,
-	read16: cdb89712_read16,
-	read32: cdb89712_read32,
-	copy_from: cdb89712_copy_from,
+	.name = "BootROM",
+	.size = BOOTROM_SIZE,
+	.buswidth = BOOTROM_WIDTH,
+	.phys = BOOTROM_START,
 };
 
 struct resource cdb89712_bootrom_resource = {
-	name:   "BootROM",
-	start:  BOOTROM_START,
-	end:    BOOTROM_START + BOOTROM_SIZE - 1,
-	flags:  IORESOURCE_IO | IORESOURCE_BUSY,
+	.name =   "BootROM",
+	.start =  BOOTROM_START,
+	.end =    BOOTROM_START + BOOTROM_SIZE - 1,
+	.flags =  IORESOURCE_IO | IORESOURCE_BUSY,
 };
 
 static int __init init_cdb89712_bootrom (void)
@@ -247,13 +181,13 @@
 		goto out;
 	}
 	
-	cdb89712_bootrom_map.map_priv_1 = (unsigned long)ioremap(BOOTROM_START, BOOTROM_SIZE);
-	if (!cdb89712_bootrom_map.map_priv_1) {
+	cdb89712_bootrom_map.virt = (unsigned long)ioremap(BOOTROM_START, BOOTROM_SIZE);
+	if (!cdb89712_bootrom_map.virt) {
 		printk(KERN_NOTICE "Failed to ioremap Cdb89712 BootROM space\n");
 		err = -EIO;
 		goto out_resource;
 	}
-
+	simple_map_init(&cdb89712_bootrom_map);
 	bootrom_mtd = do_map_probe("map_rom", &cdb89712_bootrom_map);
 	if (!bootrom_mtd) {
 		printk("BootROM probe failed\n");
@@ -276,7 +210,7 @@
 	map_destroy(bootrom_mtd);
 	bootrom_mtd = 0;
 out_ioremap:
-	iounmap((void *)cdb89712_bootrom_map.map_priv_1);
+	iounmap((void *)cdb89712_bootrom_map.virt);
 out_resource:
 	release_resource (&cdb89712_bootrom_resource);
 out:
@@ -306,21 +240,21 @@
 	if (sram_mtd) {
 		del_mtd_device(sram_mtd);
 		map_destroy(sram_mtd);
-		iounmap((void *)cdb89712_sram_map.map_priv_1);
+		iounmap((void *)cdb89712_sram_map.virt);
 		release_resource (&cdb89712_sram_resource);
 	}
 	
 	if (flash_mtd) {
 		del_mtd_device(flash_mtd);
 		map_destroy(flash_mtd);
-		iounmap((void *)cdb89712_flash_map.map_priv_1);
+		iounmap((void *)cdb89712_flash_map.virt);
 		release_resource (&cdb89712_flash_resource);
 	}
 
 	if (bootrom_mtd) {
 		del_mtd_device(bootrom_mtd);
 		map_destroy(bootrom_mtd);
-		iounmap((void *)cdb89712_bootrom_map.map_priv_1);
+		iounmap((void *)cdb89712_bootrom_map.virt);
 		release_resource (&cdb89712_bootrom_resource);
 	}
 }

Index: ceiva.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ceiva.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ceiva.c	17 Feb 2003 21:49:10 -0000	1.3
+++ ceiva.c	14 May 2003 15:05:14 -0000	1.4
@@ -31,62 +31,10 @@
 #include <asm/sizes.h>
 
 /*
- * This isnt complete yet, so...
+ * This isn't complete yet, so...
  */
 #define CONFIG_MTD_CEIVA_STATICMAP
 
-static __u8 clps_read8(struct map_info *map, unsigned long ofs)
-{
-	return readb(map->map_priv_1 + ofs);
-}
-
-static __u16 clps_read16(struct map_info *map, unsigned long ofs)
-{
-	return readw(map->map_priv_1 + ofs);
-}
-
-static __u32 clps_read32(struct map_info *map, unsigned long ofs)
-{
-	return readl(map->map_priv_1 + ofs);
-}
-
-static void clps_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy(to, (void *)(map->map_priv_1 + from), len);
-}
-
-static void clps_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	writeb(d, map->map_priv_1 + adr);
-}
-
-static void clps_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	writew(d, map->map_priv_1 + adr);
-}
-
-static void clps_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	writel(d, map->map_priv_1 + adr);
-}
-
-static void clps_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy((void *)(map->map_priv_1 + to), from, len);
-}
-
-static struct map_info clps_map __initdata = {
-	name:		"clps flash",
-	read8:		clps_read8,
-	read16:		clps_read16,
-	read32:		clps_read32,
-	copy_from:	clps_copy_from,
-	write8:		clps_write8,
-	write16:	clps_write16,
-	write32:	clps_write32,
-	copy_to:	clps_copy_to,
-};
-
 #ifdef CONFIG_MTD_CEIVA_STATICMAP
 /*
  * See include/linux/mtd/partitions.h for definition of the mtd_partition
@@ -176,7 +124,7 @@
 	maps = kmalloc(sizeof(struct map_info) * nr, GFP_KERNEL);
 	if (!maps)
 		return -ENOMEM;
-
+	memset(maps, 0, sizeof(struct map_info) * nr);
 	/*
 	 * Claim and then map the memory regions.
 	 */
@@ -191,7 +139,9 @@
 		}
 
 		clps[i].map = maps + i;
-		memcpy(clps[i].map, &clps_map, sizeof(struct map_info));
+
+		clps[i].map->name = "clps flash";
+		clps[i].map->phys = clps[i].base;
 
 		clps[i].vbase = ioremap(clps[i].base, clps[i].size);
 		if (!clps[i].vbase) {
@@ -199,9 +149,11 @@
 			break;
 		}
 
-		clps[i].map->map_priv_1 = (unsigned long)clps[i].vbase;
+		clps[i].map->virt = (unsigned long)clps[i].vbase;
 		clps[i].map->buswidth = clps[i].width;
 		clps[i].map->size = clps[i].size;
+
+		simple_map_init(&clps[i].map);
 
 		clps[i].mtd = do_map_probe("jedec_probe", clps[i].map);
 		if (clps[i].mtd == NULL) {

Index: cfi_flagadm.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/cfi_flagadm.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- cfi_flagadm.c	2 Oct 2001 15:05:13 -0000	1.7
+++ cfi_flagadm.c	14 May 2003 15:05:14 -0000	1.8
@@ -55,83 +55,33 @@
 #define FLASH_PARTITION3_ADDR 0x00240000
 #define FLASH_PARTITION3_SIZE 0x001C0000
 
-__u8 flagadm_read8(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readb(map->map_priv_1 + ofs);
-}
-
-__u16 flagadm_read16(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readw(map->map_priv_1 + ofs);
-}
-
-__u32 flagadm_read32(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void flagadm_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void flagadm_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	__raw_writeb(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void flagadm_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	__raw_writew(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void flagadm_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	__raw_writel(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void flagadm_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio(map->map_priv_1 + to, from, len);
-}
 
 struct map_info flagadm_map = {
-		name: "FlagaDM flash device",
-		size: FLASH_SIZE,
-		buswidth: 2,
-		read8: flagadm_read8,
-		read16: flagadm_read16,
-		read32: flagadm_read32,
-		copy_from: flagadm_copy_from,
-		write8: flagadm_write8,
-		write16: flagadm_write16,
-		write32: flagadm_write32,
-		copy_to: flagadm_copy_to
+		.name =		"FlagaDM flash device",
+		.size =		FLASH_SIZE,
+		.buswidth =	2,
 };
 
 struct mtd_partition flagadm_parts[] = {
 	{
-		name	: "Bootloader",
-		offset	: FLASH_PARTITION0_ADDR,
-		size	: FLASH_PARTITION0_SIZE
+		.name =		"Bootloader",
+		.offset	=	FLASH_PARTITION0_ADDR,
+		.size =		FLASH_PARTITION0_SIZE
 	},
 	{
-		name	: "Kernel image",
-		offset	: FLASH_PARTITION1_ADDR,
-		size	: FLASH_PARTITION1_SIZE
+		.name =		"Kernel image",
+		.offset =	FLASH_PARTITION1_ADDR,
+		.size =		FLASH_PARTITION1_SIZE
 	},
 	{
-		name	: "Initial ramdisk image",
-		offset	: FLASH_PARTITION2_ADDR,
-		size	: FLASH_PARTITION2_SIZE
+		.name =		"Initial ramdisk image",
+		.offset =	FLASH_PARTITION2_ADDR,
+		.size =		FLASH_PARTITION2_SIZE
 	},
 	{	
-		name	: "Persistant storage",
-		offset	: FLASH_PARTITION3_ADDR,
-		size	: FLASH_PARTITION3_SIZE
+		.name =		"Persistant storage",
+		.offset =	FLASH_PARTITION3_ADDR,
+		.size =		FLASH_PARTITION3_SIZE
 	}
 };
 
@@ -144,13 +94,17 @@
 	printk(KERN_NOTICE "FlagaDM flash device: %x at %x\n",
 			FLASH_SIZE, FLASH_PHYS_ADDR);
 	
-	flagadm_map.map_priv_1 = (unsigned long)ioremap(FLASH_PHYS_ADDR,
+	flagadm_map.phys = FLASH_PHYS_ADDR;
+	flagadm_map.virt = (unsigned long)ioremap(FLASH_PHYS_ADDR,
 					FLASH_SIZE);
 
-	if (!flagadm_map.map_priv_1) {
+	if (!flagadm_map.virt) {
 		printk("Failed to ioremap\n");
 		return -EIO;
 	}
+
+	simple_map_init(&flagadm_map);
+
 	mymtd = do_map_probe("cfi_probe", &flagadm_map);
 	if (mymtd) {
 		mymtd->module = THIS_MODULE;
@@ -159,7 +113,7 @@
 		return 0;
 	}
 
-	iounmap((void *)flagadm_map.map_priv_1);
+	iounmap((void *)flagadm_map.virt);
 	return -ENXIO;
 }
 
@@ -169,9 +123,9 @@
 		del_mtd_partitions(mymtd);
 		map_destroy(mymtd);
 	}
-	if (flagadm_map.map_priv_1) {
-		iounmap((void *)flagadm_map.map_priv_1);
-		flagadm_map.map_priv_1 = 0;
+	if (flagadm_map.virt) {
+		iounmap((void *)flagadm_map.virt);
+		flagadm_map.virt = 0;
 	}
 }
 

Index: cstm_mips_ixx.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/cstm_mips_ixx.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- cstm_mips_ixx.c	2 Oct 2001 15:05:14 -0000	1.5
+++ cstm_mips_ixx.c	14 May 2003 15:05:14 -0000	1.6
@@ -38,50 +38,7 @@
 #include <linux/mtd/map.h>
 #include <linux/mtd/partitions.h>
 #include <linux/config.h>
-
-#if defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR)
 #include <linux/delay.h>
-#endif
-
-__u8 cstm_mips_ixx_read8(struct map_info *map, unsigned long ofs)
-{
-	return *(__u8 *)(map->map_priv_1 + ofs);
-}
-
-__u16 cstm_mips_ixx_read16(struct map_info *map, unsigned long ofs)
-{
-	return *(__u16 *)(map->map_priv_1 + ofs);
-}
-
-__u32 cstm_mips_ixx_read32(struct map_info *map, unsigned long ofs)
-{
-	return *(__u32 *)(map->map_priv_1 + ofs);
-}
-
-void cstm_mips_ixx_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void cstm_mips_ixx_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	*(__u8 *)(map->map_priv_1 + adr) = d;
-}
-
-void cstm_mips_ixx_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	*(__u16 *)(map->map_priv_1 + adr) = d;
-}
-
-void cstm_mips_ixx_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	*(__u32 *)(map->map_priv_1 + adr) = d;
-}
-
-void cstm_mips_ixx_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio(map->map_priv_1 + to, from, len);
-}
 
 #if defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR)
 #define CC_GCR             0xB4013818
@@ -97,56 +54,47 @@
 #define CC_GPAICR          0xB4013804
 #endif /* defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR) */
 
+#if defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR)
 void cstm_mips_ixx_set_vpp(struct map_info *map,int vpp)
 {
-  if (vpp) {
-#if defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR)
-        __u16	data;
-        __u8	data1;
-	static u8 first = 1;
-
-	// Set GPIO port B pin3 to high
-	data = *(__u16 *)(CC_GPBCR);
-	data = (data & 0xff0f) | 0x0040;
-	*(__u16 *)CC_GPBCR = data;
-	*(__u8 *)CC_GPBDR = (*(__u8*)CC_GPBDR) | 0x08;
-	if (first) {
-		first = 0;
-		/* need to have this delay for first
-		   enabling vpp after powerup */
-		udelay(40);
+	static spinlock_t vpp_lock = SPIN_LOCK_UNLOCKED;
+	static int vpp_count = 0;
+	unsigned long flags;
+
+	spin_lock_irqsave(&vpp_lock, flags);
+
+	if (vpp) {
+		if (!vpp_count++) {
+			__u16	data;
+			__u8	data1;
+			static u8 first = 1;
+		
+			// Set GPIO port B pin3 to high
+			data = *(__u16 *)(CC_GPBCR);
+			data = (data & 0xff0f) | 0x0040;
+			*(__u16 *)CC_GPBCR = data;
+			*(__u8 *)CC_GPBDR = (*(__u8*)CC_GPBDR) | 0x08;
+			if (first) {
+				first = 0;
+				/* need to have this delay for first
+				   enabling vpp after powerup */
+				udelay(40);
+			}
+		}
+	} else {
+		if (!--vpp_count) {
+			__u16	data;
+		
+			// Set GPIO port B pin3 to high
+			data = *(__u16 *)(CC_GPBCR);
+			data = (data & 0xff3f) | 0x0040;
+			*(__u16 *)CC_GPBCR = data;
+			*(__u8 *)CC_GPBDR = (*(__u8*)CC_GPBDR) & 0xf7;
+		}
 	}
-#endif /* CONFIG_MIPS_ITE8172 */
-  }
-  else {
-#if defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR)
-        __u16	data;
-
-	// Set GPIO port B pin3 to high
-	data = *(__u16 *)(CC_GPBCR);
-	data = (data & 0xff3f) | 0x0040;
-	*(__u16 *)CC_GPBCR = data;
-	*(__u8 *)CC_GPBDR = (*(__u8*)CC_GPBDR) & 0xf7;
-#endif /* CONFIG_MIPS_ITE8172 */
-  }
+	spin_unlock_irqrestore(&vpp_lock, flags);
 }
-
-const struct map_info basic_cstm_mips_ixx_map = {
-	NULL,
-	0,
-	0,
-	cstm_mips_ixx_read8,
-	cstm_mips_ixx_read16,
-	cstm_mips_ixx_read32,
-	cstm_mips_ixx_copy_from,
-	cstm_mips_ixx_write8,
-	cstm_mips_ixx_write16,
-	cstm_mips_ixx_write32,
-	cstm_mips_ixx_copy_to,
-        cstm_mips_ixx_set_vpp,
-	0,
-	0
-};
+#endif
 
 /* board and partition description */
 
@@ -175,9 +123,9 @@
 static struct mtd_partition cstm_mips_ixx_partitions[PHYSMAP_NUMBER][MAX_PHYSMAP_PARTITIONS] = {
 {   // 28F128J3A in 2x16 configuration
 	{
-		name: "main partition ",
-		size: 0x02000000, // 128 x 2 x 128k byte sectors
-		offset: 0,
+		.name = "main partition ",
+		.size = 0x02000000, // 128 x 2 x 128k byte sectors
+		.offset = 0,
 	},
 },
 };
@@ -197,9 +145,9 @@
 static struct mtd_partition cstm_mips_ixx_partitions[PHYSMAP_NUMBER][MAX_PHYSMAP_PARTITIONS] = {
 { 
 	{
-		name: "main partition",
-		size:  CONFIG_MTD_CSTM_MIPS_IXX_LEN,
-		offset: 0,
+		.name = "main partition",
+		.size =  CONFIG_MTD_CSTM_MIPS_IXX_LEN,
+		.offset = 0,
 	},
 },
 };
@@ -216,17 +164,24 @@
 
 	/* Initialize mapping */
 	for (i=0;i<PHYSMAP_NUMBER;i++) {
-		printk(KERN_NOTICE "cstm_mips_ixx flash device: %lx at %lx\n", cstm_mips_ixx_board_desc[i].window_size, cstm_mips_ixx_board_desc[i].window_addr);
-                memcpy((char *)&cstm_mips_ixx_map[i],(char *)&basic_cstm_mips_ixx_map,sizeof(struct map_info));
-		cstm_mips_ixx_map[i].map_priv_1 = (unsigned long)ioremap(cstm_mips_ixx_board_desc[i].window_addr, cstm_mips_ixx_board_desc[i].window_size);
-		if (!cstm_mips_ixx_map[i].map_priv_1) {
+		printk(KERN_NOTICE "cstm_mips_ixx flash device: 0x%lx at 0x%lx\n", 
+		       cstm_mips_ixx_board_desc[i].window_size, cstm_mips_ixx_board_desc[i].window_addr);
+
+
+		cstm_mips_ixx_map[i].phys = cstm_mips_ixx_board_desc[i].window_addr;
+		cstm_mips_ixx_map[i].virt = (unsigned long)ioremap(cstm_mips_ixx_board_desc[i].window_addr, cstm_mips_ixx_board_desc[i].window_size);
+		if (!cstm_mips_ixx_map[i].virt) {
 			printk(KERN_WARNING "Failed to ioremap\n");
 			return -EIO;
 	        }
 		cstm_mips_ixx_map[i].name = cstm_mips_ixx_board_desc[i].name;
 		cstm_mips_ixx_map[i].size = cstm_mips_ixx_board_desc[i].window_size;
 		cstm_mips_ixx_map[i].buswidth = cstm_mips_ixx_board_desc[i].buswidth;
-		//printk(KERN_NOTICE "cstm_mips_ixx: ioremap is %x\n",(unsigned int)(cstm_mips_ixx_map[i].map_priv_1));
+#if defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR)
+                cstm_mips_ixx_map[i].set_vpp = cstm_mips_ixx_set_vpp;
+#endif
+		simple_map_init(&cstm_mips_ixx_map[i]);
+		//printk(KERN_NOTICE "cstm_mips_ixx: ioremap is %x\n",(unsigned int)(cstm_mips_ixx_map[i].virt));
 	}
 
 #if defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR)
@@ -266,9 +221,9 @@
 			del_mtd_partitions(mymtd);
 			map_destroy(mymtd);
 		}
-		if (cstm_mips_ixx_map[i].map_priv_1) {
-			iounmap((void *)cstm_mips_ixx_map[i].map_priv_1);
-			cstm_mips_ixx_map[i].map_priv_1 = 0;
+		if (cstm_mips_ixx_map[i].virt) {
+			iounmap((void *)cstm_mips_ixx_map[i].virt);
+			cstm_mips_ixx_map[i].virt = 0;
 		}
 	}
 }

Index: dbox2-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dbox2-flash.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- dbox2-flash.c	11 Apr 2003 11:15:34 -0000	1.5
+++ dbox2-flash.c	14 May 2003 15:05:14 -0000	1.6
@@ -62,72 +62,24 @@
 
 static struct mtd_info *mymtd;
 
-__u8 dbox2_flash_read8(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readb(map->map_priv_1 + ofs);
-}
-
-__u16 dbox2_flash_read16(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readw(map->map_priv_1 + ofs);
-}
-
-__u32 dbox2_flash_read32(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void dbox2_flash_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void dbox2_flash_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	__raw_writeb(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void dbox2_flash_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	__raw_writew(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void dbox2_flash_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	__raw_writel(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void dbox2_flash_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio(map->map_priv_1 + to, from, len);
-}
 
 struct map_info dbox2_flash_map = {
 	.name		= "D-Box 2 flash memory",
 	.size		= WINDOW_SIZE,
 	.buswidth	= 4,
-	.read8		= dbox2_flash_read8,
-	.read16		= dbox2_flash_read16,
-	.read32		= dbox2_flash_read32,
-	.copy_from	= dbox2_flash_copy_from,
-	.write8		= dbox2_flash_write8,
-	.write16	= dbox2_flash_write16,
-	.write32	= dbox2_flash_write32,
-	.copy_to	= dbox2_flash_copy_to
+	.phys		= WINDOW_ADDR,
 };
 
 int __init init_dbox2_flash(void)
 {
        	printk(KERN_NOTICE "D-Box 2 flash driver (size->0x%X mem->0x%X)\n", WINDOW_SIZE, WINDOW_ADDR);
-	dbox2_flash_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
+	dbox2_flash_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
 
-	if (!dbox2_flash_map.map_priv_1) {
+	if (!dbox2_flash_map.virt) {
 		printk("Failed to ioremap\n");
 		return -EIO;
 	}
+	simple_map_init(&dbox2_flash_map);
 
 	// Probe for dual Intel 28F320 or dual AMD
 	mymtd = do_map_probe("cfi_probe", &dbox2_flash_map);
@@ -147,7 +99,7 @@
 		return 0;
 	}
 
-	iounmap((void *)dbox2_flash_map.map_priv_1);
+	iounmap((void *)dbox2_flash_map.virt);
 	return -ENXIO;
 }
 
@@ -157,9 +109,9 @@
 		del_mtd_partitions(mymtd);
 		map_destroy(mymtd);
 	}
-	if (dbox2_flash_map.map_priv_1) {
-		iounmap((void *)dbox2_flash_map.map_priv_1);
-		dbox2_flash_map.map_priv_1 = 0;
+	if (dbox2_flash_map.virt) {
+		iounmap((void *)dbox2_flash_map.virt);
+		dbox2_flash_map.virt = 0;
 	}
 }
 

Index: dc21285.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dc21285.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- dc21285.c	17 Feb 2003 21:49:10 -0000	1.10
+++ dc21285.c	14 May 2003 15:05:14 -0000	1.11
@@ -92,16 +92,17 @@
 }
 
 struct map_info dc21285_map = {
-	name: "DC21285 flash",
-	size: 16*1024*1024,
-	read8: dc21285_read8,
-	read16: dc21285_read16,
-	read32: dc21285_read32,
-	copy_from: dc21285_copy_from,
-	write8: dc21285_write8,
-	write16: dc21285_write16,
-	write32: dc21285_write32,
-	copy_to: dc21285_copy_to
+	.name = "DC21285 flash",
+	.phys = NO_XIP,
+	.size = 16*1024*1024,
+	.read8 = dc21285_read8,
+	.read16 = dc21285_read16,
+	.read32 = dc21285_read32,
+	.copy_from = dc21285_copy_from,
+	.write8 = dc21285_write8,
+	.write16 = dc21285_write16,
+	.write32 = dc21285_write32,
+	.copy_to = dc21285_copy_to
 };
 
 

Index: dilnetpc.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dilnetpc.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- dilnetpc.c	12 Mar 2002 13:07:26 -0000	1.8
+++ dilnetpc.c	14 May 2003 15:05:14 -0000	1.9
@@ -36,7 +36,7 @@
 #include <linux/mtd/concat.h>
 
 /*
-** The DIL/NetPC keeps it's BIOS in two distinct flash blocks.
+** The DIL/NetPC keeps its BIOS in two distinct flash blocks.
 ** Destroying any of these blocks transforms the DNPC into
 ** a paperweight (albeit not a very useful one, considering
 ** it only weighs a few grams).
@@ -189,45 +189,6 @@
 }
 
 
-static __u8 dnpc_read8(struct map_info *map, unsigned long ofs)
-{
-	return readb(map->map_priv_1 + ofs);
-}
-
-static __u16 dnpc_read16(struct map_info *map, unsigned long ofs)
-{
-	return readw(map->map_priv_1 + ofs);
-}
-
-static __u32 dnpc_read32(struct map_info *map, unsigned long ofs)
-{
-	return readl(map->map_priv_1 + ofs);
-}
-
-static void dnpc_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, (void *)(map->map_priv_1 + from), len);
-}
-
-static void dnpc_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	writeb(d, map->map_priv_1 + adr);
-}
-
-static void dnpc_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	writew(d, map->map_priv_1 + adr);
-}
-
-static void dnpc_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	writel(d, map->map_priv_1 + adr);
-}
-
-static void dnpc_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio((void *)(map->map_priv_1 + to), from, len);
-}
 
 /*
 ************************************************************
@@ -285,22 +246,14 @@
 
 #define DNP_WINDOW_SIZE		0x00200000	/*  DNP flash size is 2MiB  */
 #define ADNP_WINDOW_SIZE	0x00400000	/* ADNP flash size is 4MiB */
-#define WINDOW_ADDR			FLASH_BASE
+#define WINDOW_ADDR		FLASH_BASE
 
 static struct map_info dnpc_map = {
-	name: "ADNP Flash Bank",
-	size: ADNP_WINDOW_SIZE,
-	buswidth: 1,
-	read8: dnpc_read8,
-	read16: dnpc_read16,
-	read32: dnpc_read32,
-	copy_from: dnpc_copy_from,
-	write8: dnpc_write8,
-	write16: dnpc_write16,
-	write32: dnpc_write32,
-	copy_to: dnpc_copy_to,
-	set_vpp: adnp_set_vpp,
-	map_priv_2: WINDOW_ADDR
+	.name = "ADNP Flash Bank",
+	.size = ADNP_WINDOW_SIZE,
+	.buswidth = 1,
+	.set_vpp = adnp_set_vpp,
+	.phys = WINDOW_ADDR
 };
 
 /*
@@ -316,29 +269,29 @@
 static struct mtd_partition partition_info[]=
 {
 	{ 
-		name:		"ADNP boot", 
-		offset:		0, 
-		size:		0xf0000,
+		.name =		"ADNP boot", 
+		.offset =	0, 
+		.size =		0xf0000,
 	},
 	{ 
-		name:		"ADNP system BIOS", 
-		offset:		MTDPART_OFS_NXTBLK,
-		size:		0x10000,
+		.name =		"ADNP system BIOS", 
+		.offset =	MTDPART_OFS_NXTBLK,
+		.size =		0x10000,
 #ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED
-		mask_flags:	MTD_WRITEABLE,
+		.mask_flags =	MTD_WRITEABLE,
 #endif
 	},
 	{
-		name:		"ADNP file system",
-		offset:		MTDPART_OFS_NXTBLK,
-		size:		0x2f0000,
+		.name =		"ADNP file system",
+		.offset =	MTDPART_OFS_NXTBLK,
+		.size =		0x2f0000,
 	},
 	{
-		name:		"ADNP system BIOS entry", 
-		offset:		MTDPART_OFS_NXTBLK,
-		size:		MTDPART_SIZ_FULL,
+		.name =		"ADNP system BIOS entry", 
+		.offset =	MTDPART_OFS_NXTBLK,
+		.size =		MTDPART_SIZ_FULL,
 #ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED
-		mask_flags:	MTD_WRITEABLE,
+		.mask_flags =	MTD_WRITEABLE,
 #endif
 	},
 };
@@ -369,21 +322,21 @@
 static struct mtd_partition higlvl_partition_info[]=
 {
 	{ 
-		name:		"ADNP boot block", 
-		offset:		0, 
-		size:		CONFIG_MTD_DILNETPC_BOOTSIZE,
+		.name =		"ADNP boot block", 
+		.offset =	0, 
+		.size =		CONFIG_MTD_DILNETPC_BOOTSIZE,
 	},
 	{
-		name:		"ADNP file system space",
-		offset:		MTDPART_OFS_NXTBLK,
-		size:		ADNP_WINDOW_SIZE-CONFIG_MTD_DILNETPC_BOOTSIZE-0x20000,
+		.name =		"ADNP file system space",
+		.offset =	MTDPART_OFS_NXTBLK,
+		.size =		ADNP_WINDOW_SIZE-CONFIG_MTD_DILNETPC_BOOTSIZE-0x20000,
 	},
 	{ 
-		name:		"ADNP system BIOS + BIOS Entry", 
-		offset:		MTDPART_OFS_NXTBLK,
-		size:		MTDPART_SIZ_FULL,
+		.name =		"ADNP system BIOS + BIOS Entry", 
+		.offset =	MTDPART_OFS_NXTBLK,
+		.size =		MTDPART_SIZ_FULL,
 #ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED
-		mask_flags:	MTD_WRITEABLE,
+		.mask_flags =	MTD_WRITEABLE,
 #endif
 	},
 };
@@ -447,18 +400,19 @@
 	}
 
 	printk(KERN_NOTICE "DIL/Net %s flash: 0x%lx at 0x%lx\n", 
-		is_dnp ? "DNPC" : "ADNP", dnpc_map.size, dnpc_map.map_priv_2);
+		is_dnp ? "DNPC" : "ADNP", dnpc_map.size, dnpc_map.phys);
 
-	dnpc_map.map_priv_1 = (unsigned long)ioremap_nocache(dnpc_map.map_priv_2, dnpc_map.size);
+	dnpc_map.virt = (unsigned long)ioremap_nocache(dnpc_map.phys, dnpc_map.size);
 
-	dnpc_map_flash(dnpc_map.map_priv_2, dnpc_map.size);
+	dnpc_map_flash(dnpc_map.phys, dnpc_map.size);
 
-	if (!dnpc_map.map_priv_1) {
+	if (!dnpc_map.virt) {
 		printk("Failed to ioremap_nocache\n");
 		return -EIO;
 	}
+	simple_map_init(&dnpc_map);
 
-	printk("FLASH virtual address: 0x%lx\n", dnpc_map.map_priv_1);
+	printk("FLASH virtual address: 0x%lx\n", dnpc_map.virt);
 
 	mymtd = do_map_probe("jedec_probe", &dnpc_map);
 
@@ -475,7 +429,7 @@
 			mymtd->erasesize = 0x10000;
 
 	if (!mymtd) {
-		iounmap((void *)dnpc_map.map_priv_1);
+		iounmap((void *)dnpc_map.virt);
 		return -ENXIO;
 	}
 		
@@ -525,10 +479,10 @@
 		del_mtd_partitions(mymtd);
 		map_destroy(mymtd);
 	}
-	if (dnpc_map.map_priv_1) {
-		iounmap((void *)dnpc_map.map_priv_1);
+	if (dnpc_map.virt) {
+		iounmap((void *)dnpc_map.virt);
 		dnpc_unmap_flash();
-		dnpc_map.map_priv_1 = 0;
+		dnpc_map.virt = 0;
 	}
 }
 

Index: ebony.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ebony.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ebony.c	31 Jan 2003 08:27:38 -0000	1.3
+++ ebony.c	14 May 2003 15:05:14 -0000	1.4
@@ -26,109 +26,36 @@
 
 static struct mtd_info *flash;
 
-static __u8 ebony_read8(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readb(map->map_priv_1 + ofs);
-}
-
-static __u16 ebony_read16(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readw(map->map_priv_1 + ofs);
-}
-
-static __u32 ebony_read32(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readl(map->map_priv_1 + ofs);
-}
-
-static void ebony_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-static void ebony_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	__raw_writeb(d, map->map_priv_1 + adr);
-	mb();
-}
-
-static void ebony_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	__raw_writew(d, map->map_priv_1 + adr);
-	mb();
-}
-
-static void ebony_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	__raw_writel(d, map->map_priv_1 + adr);
-	mb();
-}
-
-static void ebony_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio(map->map_priv_1 + to, from, len);
-}
-
-u_char * ebony_point(struct map_info *map, loff_t from, size_t len)
-{
-	return (u_char *)(map->map_priv_1 + (unsigned long)from);
-}
-
-void ebony_unpoint(struct map_info *map,  u_char *adr, loff_t from, size_t len)
-{
-  /* do nothing for now */
-}
-
 static struct map_info ebony_small_map = {
-	name:		"Ebony small flash",
-	size:		EBONY_SMALL_FLASH_SIZE,
-	buswidth:	1,
-	read8:		ebony_read8,
-	read16:		ebony_read16,
-	read32:		ebony_read32,
-	point:		ebony_point,
-	unpoint:	ebony_unpoint,
-	copy_from:	ebony_copy_from,
-	write8:		ebony_write8,
-	write16:	ebony_write16,
-	write32:	ebony_write32,
-	copy_to:	ebony_copy_to,
+	.name =		"Ebony small flash",
+	.size =		EBONY_SMALL_FLASH_SIZE,
+	.buswidth =	1,
 };
 
 static struct map_info ebony_large_map = {
-	name:		"Ebony large flash",
-	size:		EBONY_LARGE_FLASH_SIZE,
-	buswidth:	1,
-	read8:		ebony_read8,
-	read16:		ebony_read16,
-	read32:		ebony_read32,
-	point:		ebony_point,
-	unpoint:	ebony_unpoint,
-	copy_from:	ebony_copy_from,
-	write8:		ebony_write8,
-	write16:	ebony_write16,
-	write32:	ebony_write32,
-	copy_to:	ebony_copy_to,
+	.name =		"Ebony large flash",
+	.size =		EBONY_LARGE_FLASH_SIZE,
+	.buswidth =	1,
 };
 
 static struct mtd_partition ebony_small_partitions[] = {
 	{
-		name:	"OpenBIOS",
-		offset:	0x0,
-		size:	0x80000,
+		.name =   "OpenBIOS",
+		.offset = 0x0,
+		.size =   0x80000,
 	}
 };
 
 static struct mtd_partition ebony_large_partitions[] = {
 	{
-		name:	"fs",
-		offset:	0,
-		size:	0x380000,
+		.name =   "fs",
+		.offset = 0,
+		.size =   0x380000,
 	},
 	{
-		name:	"firmware",
-		offset:	0x380000,
-		size:	0x80000,
+		.name =   "firmware",
+		.offset = 0x380000,
+		.size =   0x80000,
 	}
 };
 
@@ -137,9 +64,15 @@
 int __init init_ebony(void)
 {
 	u8 fpga0_reg;
+	unsigned long fpga0_adr;
 	unsigned long long small_flash_base, large_flash_base;
 
-	fpga0_reg = readb(ioremap64(EBONY_FPGA_ADDR, 16));
+	fpga0_adr = ioremap64(EBONY_FPGA_ADDR, 16);
+	if (!fpga0_adr)
+		return -ENOMEM;
+
+	fpga0_reg = readb(fpga0_adr);
+	iounmap64(fpga0_adr);
 
 	if (EBONY_BOOT_SMALL_FLASH(fpga0_reg) &&
 			!EBONY_FLASH_SEL(fpga0_reg))
@@ -159,15 +92,18 @@
 	else
 		large_flash_base = EBONY_LARGE_FLASH_HIGH;
 
-	ebony_small_map.map_priv_1 =
+	ebony_small_map.phys = small_flash_base;
+	ebony_small_map.virt =
 		(unsigned long)ioremap64(small_flash_base,
 					 ebony_small_map.size);
 
-	if (!ebony_small_map.map_priv_1) {
+	if (!ebony_small_map.virt) {
 		printk("Failed to ioremap flash\n");
 		return -EIO;
 	}
 
+	simple_map_init(&ebony_small_map);
+
 	flash = do_map_probe("map_rom", &ebony_small_map);
 	if (flash) {
 		flash->module = THIS_MODULE;
@@ -178,15 +114,18 @@
 		return -ENXIO;
 	}
 
-	ebony_large_map.map_priv_1 =
+	ebony_large_map.phys = large_flash_base;
+	ebony_large_map.virt =
 		(unsigned long)ioremap64(large_flash_base,
 					 ebony_large_map.size);
 
-	if (!ebony_large_map.map_priv_1) {
+	if (!ebony_large_map.virt) {
 		printk("Failed to ioremap flash\n");
 		return -EIO;
 	}
 
+	simple_map_init(&ebony_large_map);
+
 	flash = do_map_probe("cfi_probe", &ebony_large_map);
 	if (flash) {
 		flash->module = THIS_MODULE;
@@ -207,14 +146,14 @@
 		map_destroy(flash);
 	}
 
-	if (ebony_small_map.map_priv_1) {
-		iounmap((void *)ebony_small_map.map_priv_1);
-		ebony_small_map.map_priv_1 = 0;
+	if (ebony_small_map.virt) {
+		iounmap((void *)ebony_small_map.virt);
+		ebony_small_map.virt = 0;
 	}
 
-	if (ebony_large_map.map_priv_1) {
-		iounmap((void *)ebony_large_map.map_priv_1);
-		ebony_large_map.map_priv_1 = 0;
+	if (ebony_large_map.virt) {
+		iounmap((void *)ebony_large_map.virt);
+		ebony_large_map.virt = 0;
 	}
 }
 

Index: edb7312.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/edb7312.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- edb7312.c	17 Feb 2003 21:49:10 -0000	1.3
+++ edb7312.c	14 May 2003 15:05:14 -0000	1.4
@@ -35,61 +35,11 @@
 
 static struct mtd_info *mymtd;
 
-__u8 edb7312nor_read8(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readb(map->map_priv_1 + ofs);
-}
-
-__u16 edb7312nor_read16(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readw(map->map_priv_1 + ofs);
-}
-
-__u32 edb7312nor_read32(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void edb7312nor_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void edb7312nor_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	__raw_writeb(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void edb7312nor_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	__raw_writew(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void edb7312nor_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	__raw_writel(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void edb7312nor_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio(map->map_priv_1 + to, from, len);
-}
-
 struct map_info edb7312nor_map = {
-	name: "NOR flash on EDB7312",
-	size: WINDOW_SIZE,
-	buswidth: BUSWIDTH,
-	read8: edb7312nor_read8,
-	read16: edb7312nor_read16,
-	read32: edb7312nor_read32,
-	copy_from: edb7312nor_copy_from,
-	write8: edb7312nor_write8,
-	write16: edb7312nor_write16,
-	write32: edb7312nor_write32,
-	copy_to: edb7312nor_copy_to
+	.name = "NOR flash on EDB7312",
+	.size = WINDOW_SIZE,
+	.buswidth = BUSWIDTH,
+	.phys = WINDOW_ADDR,
 };
 
 #ifdef CONFIG_MTD_PARTITIONS
@@ -99,21 +49,21 @@
  */
 static struct mtd_partition static_partitions[3] =
 {
-    {
-	name: "ARMboot",
-	  size: 0x40000,
-	  offset: 0
-    },
-    {
-	name: "Kernel",
-	  size: 0x200000,
-	  offset: 0x40000
-    },
-    {
-	name: "RootFS",
-	  size: 0xDC0000,
-	  offset: 0x240000
-    },
+	{
+		.name = "ARMboot",
+		.size = 0x40000,
+		.offset = 0
+	},
+	{
+		.name = "Kernel",
+		.size = 0x200000,
+		.offset = 0x40000
+	},
+	{
+		.name = "RootFS",
+		.size = 0xDC0000,
+		.offset = 0x240000
+	},
 };
 
 #define NB_OF(x) (sizeof (x) / sizeof (x[0]))
@@ -131,13 +81,15 @@
 
        	printk(KERN_NOTICE MSG_PREFIX "0x%08x at 0x%08x\n", 
 	       WINDOW_SIZE, WINDOW_ADDR);
-	edb7312nor_map.map_priv_1 = (unsigned long)
+	edb7312nor_map.virt = (unsigned long)
 	  ioremap(WINDOW_ADDR, WINDOW_SIZE);
 
-	if (!edb7312nor_map.map_priv_1) {
+	if (!edb7312nor_map.virt) {
 		printk(MSG_PREFIX "failed to ioremap\n");
 		return -EIO;
 	}
+	
+	simple_map_init(&edb7312nor_map);
 
 	mymtd = 0;
 	type = rom_probe_types;
@@ -172,7 +124,7 @@
 		return 0;
 	}
 
-	iounmap((void *)edb7312nor_map.map_priv_1);
+	iounmap((void *)edb7312nor_map.virt);
 	return -ENXIO;
 }
 
@@ -182,9 +134,9 @@
 		del_mtd_device(mymtd);
 		map_destroy(mymtd);
 	}
-	if (edb7312nor_map.map_priv_1) {
-		iounmap((void *)edb7312nor_map.map_priv_1);
-		edb7312nor_map.map_priv_1 = 0;
+	if (edb7312nor_map.virt) {
+		iounmap((void *)edb7312nor_map.virt);
+		edb7312nor_map.virt = 0;
 	}
 }
 

Index: elan-104nc.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/elan-104nc.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- elan-104nc.c	13 Feb 2002 15:30:20 -0000	1.13
+++ elan-104nc.c	14 May 2003 15:05:14 -0000	1.14
@@ -59,14 +59,14 @@
  * single flash device into. If the size if zero we use up to the end of the
  * device. */
 static struct mtd_partition partition_info[]={
-    { name: "ELAN-104NC flash boot partition", 
-      offset: 0, 
-      size: 640*1024 },
-    { name: "ELAN-104NC flash partition 1", 
-      offset: 640*1024, 
-      size: 896*1024 },
-    { name: "ELAN-104NC flash partition 2", 
-      offset: (640+896)*1024 }
+    { .name = "ELAN-104NC flash boot partition", 
+      .offset = 0, 
+      .size = 640*1024 },
+    { .name = "ELAN-104NC flash partition 1", 
+      .offset = 640*1024, 
+      .size = 896*1024 },
+    { .name = "ELAN-104NC flash partition 2", 
+      .offset = (640+896)*1024 }
 };
 #define NUM_PARTITIONS (sizeof(partition_info)/sizeof(partition_info[0]))
 
@@ -195,19 +195,20 @@
 }
 
 static struct map_info elan_104nc_map = {
-	name: "ELAN-104NC flash",
-	size: 8*1024*1024, /* this must be set to a maximum possible amount
+	.name = "ELAN-104NC flash",
+	.phys = NO_XIP,
+	.size = 8*1024*1024, /* this must be set to a maximum possible amount
 			of flash so the cfi probe routines find all
 			the chips */
-	buswidth: 2,
-	read8: elan_104nc_read8,
-	read16: elan_104nc_read16,
-	read32: elan_104nc_read32,
-	copy_from: elan_104nc_copy_from,
-	write8: elan_104nc_write8,
-	write16: elan_104nc_write16,
-	write32: elan_104nc_write32,
-	copy_to: elan_104nc_copy_to
+	.buswidth = 2,
+	.read8 = elan_104nc_read8,
+	.read16 = elan_104nc_read16,
+	.read32 = elan_104nc_read32,
+	.copy_from = elan_104nc_copy_from,
+	.write8 = elan_104nc_write8,
+	.write16 = elan_104nc_write16,
+	.write32 = elan_104nc_write32,
+	.copy_to = elan_104nc_copy_to
 };
 
 /* MTD device for all of the flash. */

Index: epxa10db-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/epxa10db-flash.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- epxa10db-flash.c	17 Feb 2003 21:49:10 -0000	1.5
+++ epxa10db-flash.c	14 May 2003 15:05:14 -0000	1.6
@@ -45,63 +45,12 @@
 
 static int epxa_default_partitions(struct mtd_info *master, struct mtd_partition **pparts);
 
-static __u8 epxa_read8(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readb(map->map_priv_1 + ofs);
-}
-
-static __u16 epxa_read16(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readw(map->map_priv_1 + ofs);
-}
-
-static __u32 epxa_read32(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readl(map->map_priv_1 + ofs);
-}
-
-static void epxa_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, (void *)(map->map_priv_1 + from), len);
-}
-
-static void epxa_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	__raw_writeb(d, map->map_priv_1 + adr);
-	mb();
-}
-
-static void epxa_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	__raw_writew(d, map->map_priv_1 + adr);
-	mb();
-}
-
-static void epxa_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	__raw_writel(d, map->map_priv_1 + adr);
-	mb();
-}
-
-static void epxa_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio((void *)(map->map_priv_1 + to), from, len);
-}
-
-
 
 static struct map_info epxa_map = {
-	name:		"EPXA flash",
-	size:		FLASH_SIZE,
-	buswidth:	2,
-	read8:		epxa_read8,
-	read16:		epxa_read16,
-	read32:		epxa_read32,
-	copy_from:	epxa_copy_from,
-	write8:		epxa_write8,
-	write16:	epxa_write16,
-	write32:	epxa_write32,
-	copy_to:	epxa_copy_to
+	.name =		"EPXA flash",
+	.size =		FLASH_SIZE,
+	.buswidth =	2,
+	.phys =		FLASH_START,
 };
 
 
@@ -109,16 +58,18 @@
 {
 	int i;
 	
-	printk(KERN_NOTICE "%s flash device: %x at %x\n", BOARD_NAME, FLASH_SIZE, FLASH_START);
-	epxa_map.map_priv_1 = (unsigned long)ioremap(FLASH_START, FLASH_SIZE);
-	if (!epxa_map.map_priv_1) {
+	printk(KERN_NOTICE "%s flash device: 0x%x at 0x%x\n", BOARD_NAME, FLASH_SIZE, FLASH_START);
+
+	epxa_map.virt = (unsigned long)ioremap(FLASH_START, FLASH_SIZE);
+	if (!epxa_map.virt) {
 		printk("Failed to ioremap %s flash\n",BOARD_NAME);
 		return -EIO;
 	}
+	simple_map_init(&epxa_map);
 
 	mymtd = do_map_probe("cfi_probe", &epxa_map);
 	if (!mymtd) {
-		iounmap((void *)epxa_map.map_priv_1);
+		iounmap((void *)epxa_map.virt);
 		return -ENXIO;
 	}
 
@@ -172,9 +123,9 @@
 			del_mtd_device(mymtd);
 		map_destroy(mymtd);
 	}
-	if (epxa_map.map_priv_1) {
-		iounmap((void *)epxa_map.map_priv_1);
-		epxa_map.map_priv_1 = 0;
+	if (epxa_map.virt) {
+		iounmap((void *)epxa_map.virt);
+		epxa_map.virt = 0;
 	}
 }
 

Index: fortunet.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/fortunet.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- fortunet.c	14 Oct 2002 12:50:22 -0000	1.2
+++ fortunet.c	14 May 2003 15:05:14 -0000	1.3
@@ -23,7 +23,7 @@
 
 struct map_region
 {
-	int			window_addr_phyical;
+	int			window_addr_physical;
 	int			altbuswidth;
 	struct map_info		map_info;
 	struct mtd_info		*mymtd;
@@ -37,57 +37,10 @@
 static int			map_regions_parts[MAX_NUM_REGIONS] = {0,0,0,0};
 
 
-__u8 fortunet_read8(struct map_info *map, unsigned long ofs)
-{
-	return *(__u8 *)(map->map_priv_1 + ofs);
-}
-
-__u16 fortunet_read16(struct map_info *map, unsigned long ofs)
-{
-	return *(__u16 *)(map->map_priv_1 + ofs);
-}
-
-__u32 fortunet_read32(struct map_info *map, unsigned long ofs)
-{
-	return *(__u32 *)(map->map_priv_1 + ofs);
-}
-
-void fortunet_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy(to, (void *)(map->map_priv_1 + from), len);
-}
-
-void fortunet_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	*(__u8 *)(map->map_priv_1 + adr) = d;
-}
-
-void fortunet_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	*(__u16 *)(map->map_priv_1 + adr) = d;
-}
-
-void fortunet_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	*(__u32 *)(map->map_priv_1 + adr) = d;
-}
-
-void fortunet_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy((void *)(map->map_priv_1 + to), from, len);
-}
 
 struct map_info default_map = {
-	size: DEF_WINDOW_SIZE,
-	buswidth: 4,
-	read8: fortunet_read8,
-	read16: fortunet_read16,
-	read32: fortunet_read32,
-	copy_from: fortunet_copy_from,
-	write8: fortunet_write8,
-	write16: fortunet_write16,
-	write32: fortunet_write32,
-	copy_to: fortunet_copy_to
+	.size = DEF_WINDOW_SIZE,
+	.buswidth = 4,
 };
 
 static char * __init get_string_option(char *dest,int dest_size,char *sor)
@@ -147,7 +100,7 @@
 	get_options (get_string_option(string,sizeof(string),line),6,params);
 	if(params[0]<1)
 	{
-		printk(MTD_FORTUNET_PK "Bad paramters for MTD Region "
+		printk(MTD_FORTUNET_PK "Bad parameters for MTD Region "
 			" name,region-number[,base,size,buswidth,altbuswidth]\n");
 		return 1;
 	}
@@ -161,14 +114,14 @@
 	memcpy(&map_regions[params[1]].map_info,
 		&default_map,sizeof(map_regions[params[1]].map_info));
         map_regions_set[params[1]] = 1;
-        map_regions[params[1]].window_addr_phyical = DEF_WINDOW_ADDR_PHY;
+        map_regions[params[1]].window_addr_physical = DEF_WINDOW_ADDR_PHY;
         map_regions[params[1]].altbuswidth = 2;
         map_regions[params[1]].mymtd = NULL;
 	map_regions[params[1]].map_info.name = map_regions[params[1]].map_name;
 	strcpy(map_regions[params[1]].map_info.name,string);
 	if(params[0]>1)
 	{
-		map_regions[params[1]].window_addr_phyical = params[2];
+		map_regions[params[1]].window_addr_physical = params[2];
 	}
 	if(params[0]>2)
 	{
@@ -185,14 +138,14 @@
 	return 1;
 }
 
-static int __init MTD_New_Partion(char *line)
+static int __init MTD_New_Partition(char *line)
 {
 	char	string[MAX_NAME_SIZE];
 	int	params[4];
 	get_options (get_string_option(string,sizeof(string),line),4,params);
 	if(params[0]<3)
 	{
-		printk(MTD_FORTUNET_PK "Bad paramters for MTD Partion "
+		printk(MTD_FORTUNET_PK "Bad parameters for MTD Partition "
 			" name,region-number,size,offset\n");
 		return 1;
 	}
@@ -204,7 +157,7 @@
 	}
 	if(map_regions_parts[params[1]]>=MAX_NUM_PARTITIONS)
 	{
-		printk(MTD_FORTUNET_PK "Out of space for partion in this region\n");
+		printk(MTD_FORTUNET_PK "Out of space for partition in this region\n");
 		return 1;
 	}
 	map_regions[params[1]].parts[map_regions_parts[params[1]]].name =
@@ -220,7 +173,10 @@
 }
 
 __setup("MTD_Region=", MTD_New_Region);
-__setup("MTD_Partion=", MTD_New_Partion);
+__setup("MTD_Partition=", MTD_New_Partition);
+
+/* Backwards-spelling-compatibility */
+__setup("MTD_Partion=", MTD_New_Partition);
 
 int __init init_fortunet(void)
 {
@@ -229,13 +185,13 @@
 	{
 		if(map_regions_parts[ix]&&(!map_regions_set[ix]))
 		{
-			printk(MTD_FORTUNET_PK "Region %d is not setup (Seting to default)\n",
+			printk(MTD_FORTUNET_PK "Region %d is not setup (Setting to default)\n",
 				ix);
 			memset(&map_regions[ix],0,sizeof(map_regions[ix]));
 			memcpy(&map_regions[ix].map_info,&default_map,
 				sizeof(map_regions[ix].map_info));
 			map_regions_set[ix] = 1;
-			map_regions[ix].window_addr_phyical = DEF_WINDOW_ADDR_PHY;
+			map_regions[ix].window_addr_physical = DEF_WINDOW_ADDR_PHY;
 			map_regions[ix].altbuswidth = 2;
 			map_regions[ix].mymtd = NULL;
 			map_regions[ix].map_info.name = map_regions[ix].map_name;
@@ -244,30 +200,35 @@
 		if(map_regions_set[ix])
 		{
 			iy++;
-			printk(KERN_NOTICE MTD_FORTUNET_PK "%s flash device at phyicaly "
+			printk(KERN_NOTICE MTD_FORTUNET_PK "%s flash device at physically "
 				" address %x size %x\n",
 				map_regions[ix].map_info.name,
-				map_regions[ix].window_addr_phyical,
+				map_regions[ix].window_addr_physical,
 				map_regions[ix].map_info.size);
-			map_regions[ix].map_info.map_priv_1 =
+
+			map_regions[ix].map_info.phys =	map_regions[ix].window_addr_physical,
+
+			map_regions[ix].map_info.virt =
 				(int)ioremap_nocache(
-				map_regions[ix].window_addr_phyical,
+				map_regions[ix].window_addr_physical,
 				map_regions[ix].map_info.size);
-			if(!map_regions[ix].map_info.map_priv_1)
+			if(!map_regions[ix].map_info.virt)
 			{
 				printk(MTD_FORTUNET_PK "%s flash failed to ioremap!\n",
 					map_regions[ix].map_info.name);
 				return -ENXIO;
 			}
-			printk(KERN_NOTICE MTD_FORTUNET_PK "%s flash is veritualy at: %x\n",
+			simple_map_init(&map_regions[ix].map_info);
+
+			printk(KERN_NOTICE MTD_FORTUNET_PK "%s flash is virtually at: %x\n",
 				map_regions[ix].map_info.name,
-				map_regions[ix].map_info.map_priv_1);
+				map_regions[ix].map_info.virt);
 			map_regions[ix].mymtd = do_map_probe("cfi_probe",
 				&map_regions[ix].map_info);
 			if((!map_regions[ix].mymtd)&&(
 				map_regions[ix].altbuswidth!=map_regions[ix].map_info.buswidth))
 			{
-				printk(KERN_NOTICE MTD_FORTUNET_PK "Trying alternet buswidth "
+				printk(KERN_NOTICE MTD_FORTUNET_PK "Trying alternate buswidth "
 					"for %s flash.\n",
 					map_regions[ix].map_info.name);
 				map_regions[ix].map_info.buswidth =
@@ -297,7 +258,7 @@
 				del_mtd_partitions( map_regions[ix].mymtd );
 				map_destroy( map_regions[ix].mymtd );
 			}
-			iounmap((void *)map_regions[ix].map_info.map_priv_1);
+			iounmap((void *)map_regions[ix].map_info.virt);
 		}
 	}
 }

Index: h720x-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/h720x-flash.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- h720x-flash.c	20 Apr 2003 08:38:01 -0000	1.1
+++ h720x-flash.c	14 May 2003 15:05:14 -0000	1.2
@@ -20,85 +20,38 @@
 
 static struct mtd_info *mymtd;
 
-static __u8 h720x_read8(struct map_info *map, unsigned long ofs)
-{
-	return readb(map->map_priv_1 + ofs);
-}
-
-static __u16 h720x_read16(struct map_info *map, unsigned long ofs)
-{
-	return readw(map->map_priv_1 + ofs);
-}
-
-static __u32 h720x_read32(struct map_info *map, unsigned long ofs)
-{
-	return readl(map->map_priv_1 + ofs);
-}
-
-static void h720x_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-static void h720x_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	writeb(d, map->map_priv_1 + adr);
-}
-
-static void h720x_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	writew(d, map->map_priv_1 + adr);
-}
-
-static void h720x_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	writel(d, map->map_priv_1 + adr);
-}
-
-static void h720x_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio(map->map_priv_1 + to, from, len);
-}
-
 static struct map_info h720x_map = {
-	name:		"H720X",
-	read8:		h720x_read8,
-	read16:		h720x_read16,
-	read32:		h720x_read32,
-	copy_from:	h720x_copy_from,
-	write8:		h720x_write8,
-	write16:	h720x_write16,
-	write32:	h720x_write32,
-	copy_to:	h720x_copy_to,
-	buswidth:	4,
-	size:		FLASH_SIZE
+	.name =		"H720X",
+	.buswidth =	4,
+	.size =		FLASH_SIZE,
+	.phys =		FLASH_PHYS,
 };
 
 static struct mtd_partition h720x_partitions[] = {
         {
-                name: "ArMon",
-                size: 0x00080000,
-                offset: 0,
-                mask_flags: MTD_WRITEABLE
+                .name = "ArMon",
+                .size = 0x00080000,
+                .offset = 0,
+                .mask_flags = MTD_WRITEABLE
         },{
-                name: "Env",
-                size: 0x00040000,
-                offset: 0x00080000,
-                mask_flags: MTD_WRITEABLE
+                .name = "Env",
+                .size = 0x00040000,
+                .offset = 0x00080000,
+                .mask_flags = MTD_WRITEABLE
         },{
-                name: "Kernel",
-                size: 0x00180000,
-                offset: 0x000c0000,
-                mask_flags: MTD_WRITEABLE
+                .name = "Kernel",
+                .size = 0x00180000,
+                .offset = 0x000c0000,
+                .mask_flags = MTD_WRITEABLE
         },{
-                name: "Ramdisk",
-                size: 0x00400000,
-                offset: 0x00240000,
-                mask_flags: MTD_WRITEABLE
+                .name = "Ramdisk",
+                .size = 0x00400000,
+                .offset = 0x00240000,
+                .mask_flags = MTD_WRITEABLE
         },{
-                name: "jffs2",
-                size: MTDPART_SIZ_FULL,
-                offset: MTDPART_OFS_APPEND
+                .name = "jffs2",
+                .size = MTDPART_SIZ_FULL,
+                .offset = MTDPART_OFS_APPEND
         }
 };
 
@@ -115,13 +68,15 @@
 
 	char	*part_type = NULL;
 	
-	h720x_map.map_priv_1 = (unsigned long)ioremap(FLASH_PHYS, FLASH_SIZE);
+	h720x_map.virt = (unsigned long)ioremap(FLASH_PHYS, FLASH_SIZE);
 
-	if (!h720x_map.map_priv_1) {
+	if (!h720x_map.virt) {
 		printk(KERN_ERR "H720x-MTD: ioremap failed\n");
 		return -EIO;
 	}
 
+	simple_map_init(&h720x_map);
+
 	// Probe for flash buswidth 4
 	printk (KERN_INFO "H720x-MTD probing 32bit FLASH\n");
 	mymtd = do_map_probe("cfi_probe", &h720x_map);
@@ -150,7 +105,7 @@
 		return 0;
 	}
 
-	iounmap((void *)h720x_map.map_priv_1);
+	iounmap((void *)h720x_map.virt);
 	return -ENXIO;
 }
 
@@ -169,9 +124,9 @@
 	if (mtd_parts && (mtd_parts != h720x_partitions))
 		kfree (mtd_parts);
 	
-	if (h720x_map.map_priv_1) {
-		iounmap((void *)h720x_map.map_priv_1);
-		h720x_map.map_priv_1 = 0;
+	if (h720x_map.virt) {
+		iounmap((void *)h720x_map.virt);
+		h720x_map.virt = 0;
 	}
 }
 

Index: ich2rom.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ich2rom.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ich2rom.c	20 Feb 2003 20:44:28 -0000	1.3
+++ ich2rom.c	14 May 2003 15:05:14 -0000	1.4
@@ -90,25 +90,26 @@
 }
 
 static struct ich2rom_map_info ich2rom_map = {
-	map: {
-		name: "ICH2 rom",
-		size: 0,
-		buswidth: 1,
-		read8: ich2rom_read8,
-		read16: ich2rom_read16,
-		read32: ich2rom_read32,
-		copy_from: ich2rom_copy_from,
-		write8: ich2rom_write8,
-		write16: ich2rom_write16,
-		write32: ich2rom_write32,
-		copy_to: ich2rom_copy_to,
+	.map = {
+		.name = "ICH2 rom",
+		.phys = NO_XIP,
+		.size = 0,
+		.buswidth = 1,
+		.read8 = ich2rom_read8,
+		.read16 = ich2rom_read16,
+		.read32 = ich2rom_read32,
+		.copy_from = ich2rom_copy_from,
+		.write8 = ich2rom_write8,
+		.write16 = ich2rom_write16,
+		.write32 = ich2rom_write32,
+		.copy_to = ich2rom_copy_to,
 		/* Firmware hubs only use vpp when being programmed
 		 * in a factory setting.  So in place programming
 		 * needs to use a different method.
 		 */
 	},
-	mtd: 0,
-	window_addr: 0,
+	.mtd = 0,
+	.window_addr = 0,
 };
 
 enum fwh_lock_state {
@@ -196,7 +197,7 @@
 		goto err_out_free_mmio_region;
 	}
 
-	/* For now assume the firmware has setup all relavent firmware
+	/* For now assume the firmware has setup all relevant firmware
 	 * windows.  We don't have enough information to handle this case
 	 * intelligently.
 	 */
@@ -272,10 +273,10 @@
 
 #if 0
 static struct pci_driver ich2rom_driver = {
-	name:	  "ich2rom",
-	id_table: ich2rom_pci_tbl,
-	probe:    ich2rom_init_one,
-	remove:   ich2rom_remove_one,
+	.name =		"ich2rom",
+	.id_table =	ich2rom_pci_tbl,
+	.probe =	ich2rom_init_one,
+	.remove =	ich2rom_remove_one,
 };
 #endif
 

Index: impa7.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/impa7.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- impa7.c	17 Feb 2003 21:49:10 -0000	1.3
+++ impa7.c	14 May 2003 15:05:14 -0000	1.4
@@ -37,75 +37,17 @@
 
 static struct mtd_info *impa7_mtd[NUM_FLASHBANKS] = { 0 };
 
-__u8 impa7_read8(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readb(map->map_priv_1 + ofs);
-}
-
-__u16 impa7_read16(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readw(map->map_priv_1 + ofs);
-}
-
-__u32 impa7_read32(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void impa7_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void impa7_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	__raw_writeb(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void impa7_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	__raw_writew(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void impa7_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	__raw_writel(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void impa7_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio(map->map_priv_1 + to, from, len);
-}
 
 static struct map_info impa7_map[NUM_FLASHBANKS] = {
 	{
-	name: "impA7 NOR Flash Bank #0",
-	size: WINDOW_SIZE0,
-	buswidth: BUSWIDTH,
-	read8: impa7_read8,
-	read16: impa7_read16,
-	read32: impa7_read32,
-	copy_from: impa7_copy_from,
-	write8: impa7_write8,
-	write16: impa7_write16,
-	write32: impa7_write32,
-	copy_to: impa7_copy_to
+		.name = "impA7 NOR Flash Bank #0",
+		.size = WINDOW_SIZE0,
+		.buswidth = BUSWIDTH,
 	},
 	{
-	name: "impA7 NOR Flash Bank #1",
-	size: WINDOW_SIZE1,
-	buswidth: BUSWIDTH,
-	read8: impa7_read8,
-	read16: impa7_read16,
-	read32: impa7_read32,
-	copy_from: impa7_copy_from,
-	write8: impa7_write8,
-	write16: impa7_write16,
-	write32: impa7_write32,
-	copy_to: impa7_copy_to
+		.name = "impA7 NOR Flash Bank #1",
+		.size = WINDOW_SIZE1,
+		.buswidth = BUSWIDTH,
 	},
 };
 
@@ -116,11 +58,11 @@
  */
 static struct mtd_partition static_partitions[] =
 {
-    {
-	name: "FileSystem",
-	  size: 0x800000,
-	  offset: 0x00000000
-    },
+	{
+		.name = "FileSystem",
+		.size = 0x800000,
+		.offset = 0x00000000
+	},
 };
 
 #define NB_OF(x) (sizeof (x) / sizeof (x[0]))
@@ -147,13 +89,15 @@
 	{
 		printk(KERN_NOTICE MSG_PREFIX "probing 0x%08lx at 0x%08lx\n",
 		       pt[i].size, pt[i].addr);
-		impa7_map[i].map_priv_1 = (unsigned long)
-		  ioremap(pt[i].addr, pt[i].size);
 
-		if (!impa7_map[i].map_priv_1) {
+		impa7_map[i].phys = pt[i].addr;
+		impa7_map[i].virt = (unsigned long)
+		  ioremap(pt[i].addr, pt[i].size);
+		if (!impa7_map[i].virt) {
 			printk(MSG_PREFIX "failed to ioremap\n");
 			return -EIO;
 		}
+		simple_map_init(&impa7_map[i]);
 
 		impa7_mtd[i] = 0;
 		type = rom_probe_types;
@@ -197,7 +141,7 @@
 #endif
 		}
 		else 
-		  iounmap((void *)impa7_map[i].map_priv_1);
+		  iounmap((void *)impa7_map[i].virt);
 	}
 	return devicesfound == 0 ? -ENXIO : 0;
 }
@@ -212,10 +156,10 @@
 			del_mtd_device(impa7_mtd[i]);
 			map_destroy(impa7_mtd[i]);
 		}
-		if (impa7_map[i].map_priv_1)
+		if (impa7_map[i].virt)
 		{
-			iounmap((void *)impa7_map[i].map_priv_1);
-			impa7_map[i].map_priv_1 = 0;
+			iounmap((void *)impa7_map[i].virt);
+			impa7_map[i].virt = 0;
 		}
 	}
 }

Index: integrator-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/integrator-flash.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- integrator-flash.c	17 Feb 2003 21:49:10 -0000	1.8
+++ integrator-flash.c	14 May 2003 15:05:14 -0000	1.9
@@ -151,58 +151,12 @@
 }
 #endif
 
-static __u8 armflash_read8(struct map_info *map, unsigned long ofs)
-{
-	return readb(ofs + map->map_priv_2);
-}
-
-static __u16 armflash_read16(struct map_info *map, unsigned long ofs)
-{
-	return readw(ofs + map->map_priv_2);
-}
-
-static __u32 armflash_read32(struct map_info *map, unsigned long ofs)
-{
-	return readl(ofs + map->map_priv_2);
-}
-
-static void armflash_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy(to, (void *) (from + map->map_priv_2), len);
-}
-
-static void armflash_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	writeb(d, adr + map->map_priv_2);
-}
-
-static void armflash_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	writew(d, adr + map->map_priv_2);
-}
-
-static void armflash_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	writel(d, adr + map->map_priv_2);
-}
-
-static void armflash_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy((void *) (to + map->map_priv_2), from, len);
-}
 
 static struct map_info armflash_map =
 {
-	name:		"AFS",
-	read8:		armflash_read8,
-	read16:		armflash_read16,
-	read32:		armflash_read32,
-	copy_from:	armflash_copy_from,
-	write8:		armflash_write8,
-	write16:	armflash_write16,
-	write32:	armflash_write32,
-	copy_to:	armflash_copy_to,
-	set_vpp:	armflash_set_vpp,
+	.name =		"AFS",
+	.set_vpp =	armflash_set_vpp,
+	.phys =		FLASH_BASE,
 };
 
 static struct mtd_info *mtd;
@@ -220,7 +174,9 @@
 	 */
 	armflash_map.size       = size;
 	armflash_map.buswidth   = 4;
-	armflash_map.map_priv_2 = (unsigned long) base;
+	armflash_map.virt = (unsigned long) base;
+
+	simple_map_init(&armflash_map);
 
 	/*
 	 * Also, the CFI layer automatically works out what size
@@ -288,7 +244,7 @@
 static void __exit armflash_exit(void)
 {
 	armflash_cfi_exit();
-	iounmap((void *)armflash_map.map_priv_2);
+	iounmap((void *)armflash_map.virt);
 	release_mem_region(FLASH_BASE, FLASH_SIZE);
 	armflash_flash_exit();
 }

Index: iq80310.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/iq80310.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- iq80310.c	17 Feb 2003 21:49:10 -0000	1.10
+++ iq80310.c	14 May 2003 15:05:15 -0000	1.11
@@ -26,79 +26,32 @@
 
 static struct mtd_info *mymtd;
 
-static __u8 iq80310_read8(struct map_info *map, unsigned long ofs)
-{
-	return *(__u8 *)(map->map_priv_1 + ofs);
-}
-
-static __u16 iq80310_read16(struct map_info *map, unsigned long ofs)
-{
-	return *(__u16 *)(map->map_priv_1 + ofs);
-}
-
-static __u32 iq80310_read32(struct map_info *map, unsigned long ofs)
-{
-	return *(__u32 *)(map->map_priv_1 + ofs);
-}
-
-static void iq80310_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy(to, (void *)(map->map_priv_1 + from), len);
-}
-
-static void iq80310_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	*(__u8 *)(map->map_priv_1 + adr) = d;
-}
-
-static void iq80310_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	*(__u16 *)(map->map_priv_1 + adr) = d;
-}
-
-static void iq80310_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	*(__u32 *)(map->map_priv_1 + adr) = d;
-}
-
-static void iq80310_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy((void *)(map->map_priv_1 + to), from, len);
-}
-
 static struct map_info iq80310_map = {
-	name: "IQ80310 flash",
-	size: WINDOW_SIZE,
-	buswidth: BUSWIDTH,
-	read8:		iq80310_read8,
-	read16:		iq80310_read16,
-	read32:		iq80310_read32,
-	copy_from:	iq80310_copy_from,
-	write8:		iq80310_write8,
-	write16:	iq80310_write16,
-	write32:	iq80310_write32,
-	copy_to:	iq80310_copy_to
+	.name = "IQ80310 flash",
+	.size = WINDOW_SIZE,
+	.buswidth = BUSWIDTH,
+	.phys = WINDOW_ADDR
 };
 
 static struct mtd_partition iq80310_partitions[4] = {
 	{
-		name:		"Firmware",
-		size:		0x00080000,
-		offset:		0,
-		mask_flags:	MTD_WRITEABLE  /* force read-only */
+		.name =		"Firmware",
+		.size =		0x00080000,
+		.offset =	0,
+		.mask_flags =	MTD_WRITEABLE  /* force read-only */
 	},{
-		name:		"Kernel",
-		size:		0x000a0000,
-		offset:		0x00080000,
+		.name =		"Kernel",
+		.size =		0x000a0000,
+		.offset =	0x00080000,
 	},{
-		name:		"Filesystem",
-		size:		0x00600000,
-		offset:		0x00120000
+		.name =		"Filesystem",
+		.size =		0x00600000,
+		.offset =	0x00120000
 	},{
-		name:		"RedBoot",
-		size:		0x000e0000,
-		offset:		0x00720000,
-		mask_flags:	MTD_WRITEABLE
+		.name =		"RedBoot",
+		.size =		0x000e0000,
+		.offset =	0x00720000,
+		.mask_flags =	MTD_WRITEABLE
 	}
 };
 
@@ -114,14 +67,16 @@
 	int parsed_nr_parts = 0;
 	char *part_type = "static";
 
-	iq80310_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
-	if (!iq80310_map.map_priv_1) {
+	iq80310_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
+	if (!iq80310_map.virt) {
 		printk("Failed to ioremap\n");
 		return -EIO;
 	}
+	simple_map_init(&iq80310_map);
+
 	mymtd = do_map_probe("cfi_probe", &iq80310_map);
 	if (!mymtd) {
-		iounmap((void *)iq80310_map.map_priv_1);
+		iounmap((void *)iq80310_map.virt);
 		return -ENXIO;
 	}
 	mymtd->module = THIS_MODULE;
@@ -157,8 +112,8 @@
 		if (parsed_parts)
 			kfree(parsed_parts);
 	}
-	if (iq80310_map.map_priv_1)
-		iounmap((void *)iq80310_map.map_priv_1);
+	if (iq80310_map.virt)
+		iounmap((void *)iq80310_map.virt);
 }
 
 module_init(init_iq80310);

Index: l440gx.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/l440gx.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- l440gx.c	10 Jan 2002 20:27:40 -0000	1.8
+++ l440gx.c	14 May 2003 15:05:15 -0000	1.9
@@ -27,48 +27,6 @@
 
 static struct mtd_info *mymtd;
 
-__u8 l440gx_read8(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readb(map->map_priv_1 + ofs);
-}
-
-__u16 l440gx_read16(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readw(map->map_priv_1 + ofs);
-}
-
-__u32 l440gx_read32(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void l440gx_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void l440gx_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	__raw_writeb(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void l440gx_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	__raw_writew(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void l440gx_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	__raw_writel(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void l440gx_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio(map->map_priv_1 + to, from, len);
-}
 
 /* Is this really the vpp port? */
 void l440gx_set_vpp(struct map_info *map, int vpp)
@@ -85,22 +43,15 @@
 }
 
 struct map_info l440gx_map = {
-	name: "L440GX BIOS",
-	size: WINDOW_SIZE,
-	buswidth: BUSWIDTH,
-	read8: l440gx_read8,
-	read16: l440gx_read16,
-	read32: l440gx_read32,
-	copy_from: l440gx_copy_from,
-	write8: l440gx_write8,
-	write16: l440gx_write16,
-	write32: l440gx_write32,
-	copy_to: l440gx_copy_to,
+	.name = "L440GX BIOS",
+	.size = WINDOW_SIZE,
+	.buswidth = BUSWIDTH,
+	.phys = WINDOW_ADDR,
 #if 0
 	/* FIXME verify that this is the 
 	 * appripriate code for vpp enable/disable
 	 */
-	set_vpp: l440gx_set_vpp
+	.set_vpp = l440gx_set_vpp
 #endif
 };
 
@@ -113,7 +64,6 @@
 	dev = pci_find_device(PCI_VENDOR_ID_INTEL, 
 		PCI_DEVICE_ID_INTEL_82371AB_0, NULL);
 
-
 	pm_dev = pci_find_device(PCI_VENDOR_ID_INTEL, 
 		PCI_DEVICE_ID_INTEL_82371AB_3, NULL);
 
@@ -122,15 +72,14 @@
 		return -ENODEV;
 	}
 
+	l440gx_map.virt = (unsigned long)ioremap_nocache(WINDOW_ADDR, WINDOW_SIZE);
 
-	l440gx_map.map_priv_1 = (unsigned long)ioremap_nocache(WINDOW_ADDR, WINDOW_SIZE);
-
-	if (!l440gx_map.map_priv_1) {
+	if (!l440gx_map.virt) {
 		printk(KERN_WARNING "Failed to ioremap L440GX flash region\n");
 		return -ENOMEM;
 	}
-
-	printk(KERN_NOTICE "window_addr = 0x%08lx\n", (unsigned long)l440gx_map.map_priv_1);
+	simple_map_init(&l440gx_map);
+	printk(KERN_NOTICE "window_addr = 0x%08lx\n", (unsigned long)l440gx_map.virt);
 
 	/* Setup the pm iobase resource 
 	 * This code should move into some kind of generic bridge
@@ -153,7 +102,7 @@
 		/* Allocate the resource region */
 		if (pci_assign_resource(pm_dev, PIIXE_IOBASE_RESOURCE) != 0) {
 			printk(KERN_WARNING "Could not allocate pm iobase resource\n");
-			iounmap((void *)l440gx_map.map_priv_1);
+			iounmap((void *)l440gx_map.virt);
 			return -ENXIO;
 		}
 	}
@@ -187,7 +136,7 @@
 		return 0;
 	}
 
-	iounmap((void *)l440gx_map.map_priv_1);
+	iounmap((void *)l440gx_map.virt);
 	return -ENXIO;
 }
 
@@ -196,7 +145,7 @@
 	del_mtd_device(mymtd);
 	map_destroy(mymtd);
 	
-	iounmap((void *)l440gx_map.map_priv_1);
+	iounmap((void *)l440gx_map.virt);
 }
 
 module_init(init_l440gx);

Index: lasat.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/lasat.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- lasat.c	24 Jan 2003 14:26:38 -0000	1.1
+++ lasat.c	14 May 2003 15:05:15 -0000	1.2
@@ -25,60 +25,9 @@
 
 static struct mtd_info *mymtd;
 
-static __u8 sp_read8(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readb(map->map_priv_1 + ofs);
-}
-
-static __u16 sp_read16(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readw(map->map_priv_1 + ofs);
-}
-
-static __u32 sp_read32(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readl(map->map_priv_1 + ofs);
-}
-
-static void sp_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-static void sp_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	__raw_writeb(d, map->map_priv_1 + adr);
-	mb();
-}
-
-static void sp_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	__raw_writew(d, map->map_priv_1 + adr);
-	mb();
-}
-
-static void sp_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	__raw_writel(d, map->map_priv_1 + adr);
-	mb();
-}
-
-static void sp_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio(map->map_priv_1 + to, from, len);
-}
-
 static struct map_info sp_map = {
 	.name = "SP flash",
 	.buswidth = 4,
-	.read8 = sp_read8,
-	.read16 = sp_read16,
-	.read32 = sp_read32,
-	.copy_from = sp_copy_from,
-	.write8 = sp_write8,
-	.write16 = sp_write16,
-	.write32 = sp_write32,
-	.copy_to = sp_copy_to
 };
 
 static struct mtd_partition partition_info[LASAT_MTD_LAST];
@@ -89,14 +38,18 @@
 	int i;
 	/* this does not play well with the old flash code which 
 	 * protects and uprotects the flash when necessary */
+	/* FIXME: Implement set_vpp() */
        	printk(KERN_NOTICE "Unprotecting flash\n");
 	*lasat_misc->flash_wp_reg |= 1 << lasat_misc->flash_wp_bit;
 
-	sp_map.map_priv_1 = lasat_flash_partition_start(LASAT_MTD_BOOTLOADER);
+	sp_map.virt = lasat_flash_partition_start(LASAT_MTD_BOOTLOADER);
+	sp_map.phys = virt_to_phys(sp_map.virt);
 	sp_map.size = lasat_board_info.li_flash_size;
 
+	simple_map_init(&sp_map);
+
        	printk(KERN_NOTICE "sp flash device: %lx at %lx\n", 
-			sp_map.size, sp_map.map_priv_1);
+			sp_map.size, sp_map.phys);
 
 	for (i=0; i < LASAT_MTD_LAST; i++)
 		partition_info[i].name = lasat_mtd_partnames[i];
@@ -127,8 +80,8 @@
 		del_mtd_partitions(mymtd);
 		map_destroy(mymtd);
 	}
-	if (sp_map.map_priv_1) {
-		sp_map.map_priv_1 = 0;
+	if (sp_map.virt) {
+		sp_map.virt = 0;
 	}
 }
 

Index: lubbock-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/lubbock-flash.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- lubbock-flash.c	13 May 2003 15:29:58 -0000	1.2
+++ lubbock-flash.c	14 May 2003 15:05:15 -0000	1.3
@@ -26,82 +26,12 @@
 
 #define WINDOW_SIZE 	64*1024*1024
 
-static __u8 lubbock_read8(struct map_info *map, unsigned long ofs)
-{
-	return *(__u8 *)(map->map_priv_1 + ofs);
-}
-
-static __u16 lubbock_read16(struct map_info *map, unsigned long ofs)
-{
-	return *(__u16 *)(map->map_priv_1 + ofs);
-}
-
-static __u32 lubbock_read32(struct map_info *map, unsigned long ofs)
-{
-	return *(__u32 *)(map->map_priv_1 + ofs);
-}
-
-static void lubbock_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy(to, (void *)(map->map_priv_1 + from), len);
-}
-
-static void lubbock_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	*(__u8 *)(map->map_priv_1 + adr) = d;
-}
-
-static void lubbock_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	*(__u16 *)(map->map_priv_1 + adr) = d;
-}
-
-static void lubbock_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	*(__u32 *)(map->map_priv_1 + adr) = d;
-}
-
-static void lubbock_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy((void *)(map->map_priv_1 + to), from, len);
-}
-
-static u_char *lubbock_point(struct map_info *map, loff_t ofs, size_t len)
-{
-        return (u_char *)map->map_priv_1 + ofs;
-}
-
-static void lubbock_unpoint(struct map_info *map, u_char *ptr, loff_t ofs, size_t len)
-{
-        return;
-}
-
 static struct map_info lubbock_maps[2] = { {
 	.size =		WINDOW_SIZE,
-	.read8 =	lubbock_read8,
-	.read16 =	lubbock_read16,
-	.read32 =	lubbock_read32,
-	.copy_from =	lubbock_copy_from,
-	.write8 =	lubbock_write8,
-	.write16 =	lubbock_write16,
-	.write32 =	lubbock_write32,
-	.copy_to =	lubbock_copy_to,
-	.point =	lubbock_point,
-	.unpoint =	lubbock_unpoint,
-	.map_priv_2 =	0x00000000,
+	.phys =		0x00000000,
 }, {
 	.size =		WINDOW_SIZE,
-	.read8 =	lubbock_read8,
-	.read16 =	lubbock_read16,
-	.read32 =	lubbock_read32,
-	.copy_from =	lubbock_copy_from,
-	.write8 =	lubbock_write8,
-	.write16 =	lubbock_write16,
-	.write32 =	lubbock_write32,
-	.copy_to =	lubbock_copy_to,
-	.point =	lubbock_point,
-	.unpoint =	lubbock_unpoint,
-	.map_priv_2 =	0x04000000,
+	.phys =		0x04000000,
 } };
 
 static struct mtd_partition lubbock_partitions[] = {
@@ -144,22 +74,23 @@
 	lubbock_maps[flashboot].name = "Lubbock Boot ROM";
 
 	for (i = 0; i < 2; i++) {
-		lubbock_maps[i].map_priv_1 = (unsigned long)__ioremap(lubbock_maps[i].map_priv_2, WINDOW_SIZE, 0);
-		if (!lubbock_maps[i].map_priv_1) {
+		lubbock_maps[i].virt = (unsigned long)__ioremap(lubbock_maps[i].phys, WINDOW_SIZE, 0);
+		if (!lubbock_maps[i].virt) {
 			printk(KERN_WARNING "Failed to ioremap %s\n", lubbock_maps[i].name);
 			if (!ret)
 				ret = -ENOMEM;
 			continue;
 		}
+		simple_map_init(&lubbock_maps[i]);
 
 		printk(KERN_NOTICE "Probing %s at physical address 0x%08lx (%d-bit buswidth)\n",
-		       lubbock_maps[i].name, lubbock_maps[i].map_priv_2, 
+		       lubbock_maps[i].name, lubbock_maps[i].phys, 
 		       lubbock_maps[i].buswidth * 8);
 
 		mymtds[i] = do_map_probe("cfi_probe", &lubbock_maps[i]);
 		
 		if (!mymtds[i]) {
-			iounmap((void *)lubbock_maps[i].map_priv_1);
+			iounmap((void *)lubbock_maps[i].virt);
 			if (!ret)
 				ret = -EIO;
 			continue;
@@ -210,7 +141,7 @@
 			del_mtd_device(mymtds[i]);			
 
 		map_destroy(mymtds[i]);
-		iounmap((void *)lubbock_maps[i].map_priv_1);
+		iounmap((void *)lubbock_maps[i].virt);
 
 		if (parsed_parts[i])
 			kfree(parsed_parts[i]);

Index: mbx860.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/mbx860.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mbx860.c	18 Nov 2001 19:43:09 -0000	1.1
+++ mbx860.c	14 May 2003 15:05:15 -0000	1.2
@@ -36,82 +36,37 @@
  * single flash device into. If the size if zero we use up to the end of the
  * device. */
 static struct mtd_partition partition_info[]={
-	{ name: "MBX flash BOOT partition",
-	offset: 0,
-	size:   BOOT_PARTITION_SIZE_KiB*1024 },
-	{ name: "MBX flash DATA partition",
-	offset: BOOT_PARTITION_SIZE_KiB*1024,
-	size: (KERNEL_PARTITION_SIZE_KiB)*1024 },
-	{ name: "MBX flash APPLICATION partition",
-	offset: (BOOT_PARTITION_SIZE_KiB+KERNEL_PARTITION_SIZE_KiB)*1024 }
+	{ .name = "MBX flash BOOT partition",
+	.offset = 0,
+	.size =   BOOT_PARTITION_SIZE_KiB*1024 },
+	{ .name = "MBX flash DATA partition",
+	.offset = BOOT_PARTITION_SIZE_KiB*1024,
+	.size = (KERNEL_PARTITION_SIZE_KiB)*1024 },
+	{ .name = "MBX flash APPLICATION partition",
+	.offset = (BOOT_PARTITION_SIZE_KiB+KERNEL_PARTITION_SIZE_KiB)*1024 }
 };
 				   
 
 static struct mtd_info *mymtd;
 
-__u8 mbx_read8(struct map_info *map, unsigned long ofs)
-{
-	return readb(map->map_priv_1 + ofs);
-}
-
-__u16 mbx_read16(struct map_info *map, unsigned long ofs)
-{
-	return readw(map->map_priv_1 + ofs);
-}
-
-__u32 mbx_read32(struct map_info *map, unsigned long ofs)
-{
-	return readl(map->map_priv_1 + ofs);
-}
-
-void mbx_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, (void *)(map->map_priv_1 + from), len);
-}
-
-void mbx_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	writeb(d, map->map_priv_1 + adr);
-}
-
-void mbx_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	writew(d, map->map_priv_1 + adr);
-}
-
-void mbx_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	writel(d, map->map_priv_1 + adr);
-}
-
-void mbx_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio((void *)(map->map_priv_1 + to), from, len);
-}
-
 struct map_info mbx_map = {
-	name: "MBX flash",
-	size: WINDOW_SIZE,
-	buswidth: 4,
-	read8: mbx_read8,
-	read16: mbx_read16,
-	read32: mbx_read32,
-	copy_from: mbx_copy_from,
-	write8: mbx_write8,
-	write16: mbx_write16,
-	write32: mbx_write32,
-	copy_to: mbx_copy_to
+	.name = "MBX flash",
+	.size = WINDOW_SIZE,
+	.phys = WINDOW_ADDR,
+	.buswidth = 4,
 };
 
 int __init init_mbx(void)
 {
-	printk(KERN_NOTICE "Motorola MBX flash device: %x at %x\n", WINDOW_SIZE*4, WINDOW_ADDR);
-	mbx_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE * 4);
+	printk(KERN_NOTICE "Motorola MBX flash device: 0x%x at 0x%x\n", WINDOW_SIZE*4, WINDOW_ADDR);
+	mbx_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE * 4);
 
-	if (!mbx_map.map_priv_1) {
+	if (!mbx_map.virt) {
 		printk("Failed to ioremap\n");
 		return -EIO;
 	}
+	simple_map_init(&mbx_map);
+
 	mymtd = do_map_probe("jedec_probe", &mbx_map);
 	if (mymtd) {
 		mymtd->module = THIS_MODULE;
@@ -120,7 +75,7 @@
 		return 0;
 	}
 
-	iounmap((void *)mbx_map.map_priv_1);
+	iounmap((void *)mbx_map.virt);
 	return -ENXIO;
 }
 
@@ -130,9 +85,9 @@
 		del_mtd_device(mymtd);
 		map_destroy(mymtd);
 	}
-	if (mbx_map.map_priv_1) {
-		iounmap((void *)mbx_map.map_priv_1);
-		mbx_map.map_priv_1 = 0;
+	if (mbx_map.virt) {
+		iounmap((void *)mbx_map.virt);
+		mbx_map.virt = 0;
 	}
 }
 

Index: netsc520.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/netsc520.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- netsc520.c	2 Oct 2001 15:05:14 -0000	1.5
+++ netsc520.c	14 May 2003 15:05:15 -0000	1.6
@@ -50,95 +50,41 @@
 ** recoverable afterwards.
 */
 
-static __u8 netsc520_read8(struct map_info *map, unsigned long ofs)
-{
-	return readb(map->map_priv_1 + ofs);
-}
-
-static __u16 netsc520_read16(struct map_info *map, unsigned long ofs)
-{
-	return readw(map->map_priv_1 + ofs);
-}
-
-static __u32 netsc520_read32(struct map_info *map, unsigned long ofs)
-{
-	return readl(map->map_priv_1 + ofs);
-}
-
-static void netsc520_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, (void *)(map->map_priv_1 + from), len);
-}
-
-static void netsc520_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	writeb(d, map->map_priv_1 + adr);
-}
-
-static void netsc520_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	writew(d, map->map_priv_1 + adr);
-}
-
-static void netsc520_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	writel(d, map->map_priv_1 + adr);
-}
-
-static void netsc520_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio((void *)(map->map_priv_1 + to), from, len);
-}
-
 /* partition_info gives details on the logical partitions that the split the 
  * single flash device into. If the size if zero we use up to the end of the
  * device. */
 static struct mtd_partition partition_info[]={
     { 
-	    name: "NetSc520 boot kernel", 
-	    offset: 0, 
-	    size: 	0xc0000
+	    .name = "NetSc520 boot kernel", 
+	    .offset = 0, 
+	    .size = 0xc0000
     },
     { 
-	    name: "NetSc520 Low BIOS", 
-	    offset: 0xc0000, 
-	    size: 	0x40000
+	    .name = "NetSc520 Low BIOS", 
+	    .offset = 0xc0000, 
+	    .size = 0x40000
     },
     { 
-	    name: "NetSc520 file system", 
-	    offset: 0x100000, 
-	    size: 	0xe80000
+	    .name = "NetSc520 file system", 
+	    .offset = 0x100000, 
+	    .size = 0xe80000
     },
     { 
-	    name: "NetSc520 High BIOS", 
-	    offset: 0xf80000, 
-	    size: 0x80000
+	    .name = "NetSc520 High BIOS", 
+	    .offset = 0xf80000, 
+	    .size = 0x80000
     },
 };
 #define NUM_PARTITIONS (sizeof(partition_info)/sizeof(partition_info[0]))
 
-/*
- * If no idea what is going on here.  This is taken from the FlashFX stuff.
- */
-#define ROMCS 1
-
-
 #define WINDOW_SIZE	0x00100000
 #define WINDOW_ADDR	0x00200000
 
 static struct map_info netsc520_map = {
-	name: "netsc520 Flash Bank",
-	size: WINDOW_SIZE,
-	buswidth: 4,
-	read8: netsc520_read8,
-	read16: netsc520_read16,
-	read32: netsc520_read32,
-	copy_from: netsc520_copy_from,
-	write8: netsc520_write8,
-	write16: netsc520_write16,
-	write32: netsc520_write32,
-	copy_to: netsc520_copy_to,
-	map_priv_2: WINDOW_ADDR
+	.name = "netsc520 Flash Bank",
+	.size = WINDOW_SIZE,
+	.buswidth = 4,
+	.phys = WINDOW_ADDR,
 };
 
 #define NUM_FLASH_BANKS	(sizeof(netsc520_map)/sizeof(struct map_info))
@@ -147,13 +93,16 @@
 
 static int __init init_netsc520(void)
 {
-	printk(KERN_NOTICE "NetSc520 flash device: %lx at %lx\n", netsc520_map.size, netsc520_map.map_priv_2);
-	netsc520_map.map_priv_1 = (unsigned long)ioremap_nocache(netsc520_map.map_priv_2, netsc520_map.size);
+	printk(KERN_NOTICE "NetSc520 flash device: 0x%lx at 0x%lx\n", netsc520_map.size, netsc520_map.phys);
+	netsc520_map.virt = (unsigned long)ioremap_nocache(netsc520_map.phys, netsc520_map.size);
 
-	if (!netsc520_map.map_priv_1) {
+	if (!netsc520_map.virt) {
 		printk("Failed to ioremap_nocache\n");
 		return -EIO;
 	}
+
+	simple_map_init(&netsc520_map);
+
 	mymtd = do_map_probe("cfi_probe", &netsc520_map);
 	if(!mymtd)
 		mymtd = do_map_probe("map_ram", &netsc520_map);
@@ -161,7 +110,7 @@
 		mymtd = do_map_probe("map_rom", &netsc520_map);
 
 	if (!mymtd) {
-		iounmap((void *)netsc520_map.map_priv_1);
+		iounmap((void *)netsc520_map.virt);
 		return -ENXIO;
 	}
 		
@@ -176,9 +125,9 @@
 		del_mtd_partitions(mymtd);
 		map_destroy(mymtd);
 	}
-	if (netsc520_map.map_priv_1) {
-		iounmap((void *)netsc520_map.map_priv_1);
-		netsc520_map.map_priv_1 = 0;
+	if (netsc520_map.virt) {
+		iounmap((void *)netsc520_map.virt);
+		netsc520_map.virt = 0;
 	}
 }
 

Index: nettel.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/nettel.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- nettel.c	8 Aug 2002 06:30:13 -0000	1.1
+++ nettel.c	14 May 2003 15:05:15 -0000	1.2
@@ -59,128 +59,72 @@
 
 /****************************************************************************/
 
-static __u8 nettel_read8(struct map_info *map, unsigned long ofs)
-{
-	return(readb(map->map_priv_1 + ofs));
-}
-
-static __u16 nettel_read16(struct map_info *map, unsigned long ofs)
-{
-	return(readw(map->map_priv_1 + ofs));
-}
-
-static __u32 nettel_read32(struct map_info *map, unsigned long ofs)
-{
-	return(readl(map->map_priv_1 + ofs));
-}
-
-static void nettel_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-static void nettel_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	writeb(d, map->map_priv_1 + adr);
-}
-
-static void nettel_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	writew(d, map->map_priv_1 + adr);
-}
-
-static void nettel_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	writel(d, map->map_priv_1 + adr);
-}
-
-static void nettel_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio(map->map_priv_1 + to, from, len);
-}
-
 /****************************************************************************/
 
 #ifdef CONFIG_MTD_CFI_INTELEXT
 static struct map_info nettel_intel_map = {
-	name: "SnapGear Intel",
-	size: 0,
-	buswidth: INTEL_BUSWIDTH,
-	read8: nettel_read8,
-	read16: nettel_read16,
-	read32: nettel_read32,
-	copy_from: nettel_copy_from,
-	write8: nettel_write8,
-	write16: nettel_write16,
-	write32: nettel_write32,
-	copy_to: nettel_copy_to
+	.name = "SnapGear Intel",
+	.size = 0,
+	.buswidth = INTEL_BUSWIDTH,
 };
 
 static struct mtd_partition nettel_intel_partitions[] = {
 	{
-		name: "SnapGear kernel",
-		offset: 0,
-		size: 0x000e0000
+		.name = "SnapGear kernel",
+		.offset = 0,
+		.size = 0x000e0000
 	},
 	{
-		name: "SnapGear filesystem",
-		offset: 0x00100000,
+		.name = "SnapGear filesystem",
+		.offset = 0x00100000,
 	},
 	{
-		name: "SnapGear config",
-		offset: 0x000e0000,
-		size: 0x00020000
+		.name = "SnapGear config",
+		.offset = 0x000e0000,
+		.size = 0x00020000
 	},
 	{
-		name: "SnapGear Intel",
-		offset: 0
+		.name = "SnapGear Intel",
+		.offset = 0
 	},
 	{
-		name: "SnapGear BIOS Config",
-		offset: 0x007e0000,
-		size: 0x00020000
+		.name = "SnapGear BIOS Config",
+		.offset = 0x007e0000,
+		.size = 0x00020000
 	},
 	{
-		name: "SnapGear BIOS",
-		offset: 0x007e0000,
-		size: 0x00020000
+		.name = "SnapGear BIOS",
+		.offset = 0x007e0000,
+		.size = 0x00020000
 	},
 };
 #endif
 
 static struct map_info nettel_amd_map = {
-	name: "SnapGear AMD",
-	size: AMD_WINDOW_MAXSIZE,
-	buswidth: AMD_BUSWIDTH,
-	read8: nettel_read8,
-	read16: nettel_read16,
-	read32: nettel_read32,
-	copy_from: nettel_copy_from,
-	write8: nettel_write8,
-	write16: nettel_write16,
-	write32: nettel_write32,
-	copy_to: nettel_copy_to
+	.name = "SnapGear AMD",
+	.size = AMD_WINDOW_MAXSIZE,
+	.buswidth = AMD_BUSWIDTH,
 };
 
 static struct mtd_partition nettel_amd_partitions[] = {
 	{
-		name: "SnapGear BIOS config",
-		offset: 0x000e0000,
-		size: 0x00010000
+		.name = "SnapGear BIOS config",
+		.offset = 0x000e0000,
+		.size = 0x00010000
 	},
 	{
-		name: "SnapGear BIOS",
-		offset: 0x000f0000,
-		size: 0x00010000
+		.name = "SnapGear BIOS",
+		.offset = 0x000f0000,
+		.size = 0x00010000
 	},
 	{
-		name: "SnapGear AMD",
-		offset: 0
+		.name = "SnapGear AMD",
+		.offset = 0
 	},
 	{
-		name: "SnapGear high BIOS",
-		offset: 0x001f0000,
-		size: 0x00010000
+		.name = "SnapGear high BIOS",
+		.offset = 0x001f0000,
+		.size = 0x00010000
 	}
 };
 
@@ -328,12 +272,14 @@
 	*amdpar = SC520_PAR(SC520_PAR_BOOTCS, amdaddr, maxsize);
 	__asm__ ("wbinvd");
 
-	nettel_amd_map.map_priv_1 = (unsigned long)
+	nettel_amd_map.phys = amdaddr;
+	nettel_amd_map.virt = (unsigned long)
 		ioremap_nocache(amdaddr, maxsize);
-	if (!nettel_amd_map.map_priv_1) {
+	if (!nettel_amd_map.virt) {
 		printk("SNAPGEAR: failed to ioremap() BOOTCS\n");
 		return(-EIO);
 	}
+	simple_map_init(&nettel_amd_map);
 
 	if ((amd_mtd = do_map_probe("jedec_probe", &nettel_amd_map))) {
 		printk(KERN_NOTICE "SNAPGEAR: AMD flash device size = %dK\n",
@@ -387,8 +333,8 @@
 
 		/* Destroy useless AMD MTD mapping */
 		amd_mtd = NULL;
-		iounmap((void *) nettel_amd_map.map_priv_1);
-		nettel_amd_map.map_priv_1 = (unsigned long) NULL;
+		iounmap((void *) nettel_amd_map.virt);
+		nettel_amd_map.virt = (unsigned long) NULL;
 #else
 		/* Only AMD flash supported */
 		return(-ENXIO);
@@ -411,16 +357,18 @@
 
 	/* Probe for the the size of the first Intel flash */
 	nettel_intel_map.size = maxsize;
-	nettel_intel_map.map_priv_1 = (unsigned long)
+	nettel_intel_map.phys = intel0addr;
+	nettel_intel_map.virt = (unsigned long)
 		ioremap_nocache(intel0addr, maxsize);
-	if (!nettel_intel_map.map_priv_1) {
+	if (!nettel_intel_map.virt) {
 		printk("SNAPGEAR: failed to ioremap() ROMCS1\n");
 		return(-EIO);
 	}
+	simple_map_init(&nettel_intel_map);
 
 	intel_mtd = do_map_probe("cfi_probe", &nettel_intel_map);
 	if (! intel_mtd) {
-		iounmap((void *) nettel_intel_map.map_priv_1);
+		iounmap((void *) nettel_intel_map.virt);
 		return(-ENXIO);
 	}
 
@@ -441,19 +389,19 @@
 	/* Delete the old map and probe again to do both chips */
 	map_destroy(intel_mtd);
 	intel_mtd = NULL;
-	iounmap((void *) nettel_intel_map.map_priv_1);
+	iounmap((void *) nettel_intel_map.virt);
 
 	nettel_intel_map.size = maxsize;
-	nettel_intel_map.map_priv_1 = (unsigned long)
+	nettel_intel_map.virt = (unsigned long)
 		ioremap_nocache(intel0addr, maxsize);
-	if (!nettel_intel_map.map_priv_1) {
+	if (!nettel_intel_map.virt) {
 		printk("SNAPGEAR: failed to ioremap() ROMCS1/2\n");
 		return(-EIO);
 	}
 
 	intel_mtd = do_map_probe("cfi_probe", &nettel_intel_map);
 	if (! intel_mtd) {
-		iounmap((void *) nettel_intel_map.map_priv_1);
+		iounmap((void *) nettel_intel_map.virt);
 		return(-ENXIO);
 	}
 
@@ -523,18 +471,18 @@
 		del_mtd_partitions(amd_mtd);
 		map_destroy(amd_mtd);
 	}
-	if (nettel_amd_map.map_priv_1) {
-		iounmap((void *)nettel_amd_map.map_priv_1);
-		nettel_amd_map.map_priv_1 = 0;
+	if (nettel_amd_map.virt) {
+		iounmap((void *)nettel_amd_map.virt);
+		nettel_amd_map.virt = 0;
 	}
 #ifdef CONFIG_MTD_CFI_INTELEXT
 	if (intel_mtd) {
 		del_mtd_partitions(intel_mtd);
 		map_destroy(intel_mtd);
 	}
-	if (nettel_intel_map.map_priv_1) {
-		iounmap((void *)nettel_intel_map.map_priv_1);
-		nettel_intel_map.map_priv_1 = 0;
+	if (nettel_intel_map.virt) {
+		iounmap((void *)nettel_intel_map.virt);
+		nettel_intel_map.virt = 0;
 	}
 #endif
 }

Index: ocelot.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ocelot.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ocelot.c	17 Feb 2003 21:49:10 -0000	1.7
+++ ocelot.c	14 May 2003 15:05:15 -0000	1.8
@@ -25,40 +25,18 @@
 static struct mtd_info *flash_mtd;
 static struct mtd_info *nvram_mtd;
 
-__u8 ocelot_read8(struct map_info *map, unsigned long ofs)
+static void ocelot_ram_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf)
 {
-	return __raw_readb(map->map_priv_1 + ofs);
-}
-
-void ocelot_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	cacheflush = 1;
-	__raw_writeb(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void ocelot_copy_from_cache(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	if (cacheflush) {
-		dma_cache_inv(map->map_priv_2, map->size);
-		cacheflush = 0;
-	}
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void ocelot_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
+        struct map_info *map = (struct map_info *)mtd->priv;
+	size_t done = 0;
 
-void ocelot_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
 	/* If we use memcpy, it does word-wide writes. Even though we told the 
 	   GT64120A that it's an 8-bit wide region, word-wide writes don't work.
 	   We end up just writing the first byte of the four to all four bytes.
 	   So we have this loop instead */
+	*retlen = len;
 	while(len) {
-		__raw_writeb(*(unsigned char *) from, map->map_priv_1 + to);
+		__raw_writeb(*(unsigned char *) from, map->virt + to);
 		from++;
 		to++;
 		len--;
@@ -68,22 +46,17 @@
 static struct mtd_partition *parsed_parts;
 
 struct map_info ocelot_flash_map = {
-	name: "Ocelot boot flash",
-	size: FLASH_WINDOW_SIZE,
-	buswidth: FLASH_BUSWIDTH,
-	read8: ocelot_read8,
-	copy_from: ocelot_copy_from_cache,
-	write8: ocelot_write8,
+	.name = "Ocelot boot flash",
+	.size = FLASH_WINDOW_SIZE,
+	.buswidth = FLASH_BUSWIDTH,
+	.phys = FLASH_WINDOW_ADDR,
 };
 
 struct map_info ocelot_nvram_map = {
-	name: "Ocelot NVRAM",
-	size: NVRAM_WINDOW_SIZE,
-	buswidth: NVRAM_BUSWIDTH,
-	read8: ocelot_read8,
-	copy_from: ocelot_copy_from,
-	write8: ocelot_write8,
-	copy_to: ocelot_copy_to
+	.name = "Ocelot NVRAM",
+	.size = NVRAM_WINDOW_SIZE,
+	.buswidth = NVRAM_BUSWIDTH,
+	.phys = NVRAM_WINDOW_ADDR,
 };
 
 static int __init init_ocelot_maps(void)
@@ -105,12 +78,13 @@
 	iounmap(pld);
 
 	/* Now ioremap the NVRAM space */
-	ocelot_nvram_map.map_priv_1 = (unsigned long)ioremap_nocache(NVRAM_WINDOW_ADDR, NVRAM_WINDOW_SIZE);
-	if (!ocelot_nvram_map.map_priv_1) {
+	ocelot_nvram_map.virt = (unsigned long)ioremap_nocache(NVRAM_WINDOW_ADDR, NVRAM_WINDOW_SIZE);
+	if (!ocelot_nvram_map.virt) {
 		printk(KERN_NOTICE "Failed to ioremap Ocelot NVRAM space\n");
 		return -EIO;
 	}
-	//	ocelot_nvram_map.map_priv_2 = ocelot_nvram_map.map_priv_1;
+
+	simple_map_init(&ocelot_nvram_map);
 
 	/* And do the RAM probe on it to get an MTD device */
 	nvram_mtd = do_map_probe("map_ram", &ocelot_nvram_map);
@@ -120,20 +94,19 @@
 	}
 	nvram_mtd->module = THIS_MODULE;
 	nvram_mtd->erasesize = 16;
+	/* Override the write() method */
+	nvram_mtd->write = ocelot_ram_write;
 
 	/* Now map the flash space */
-	ocelot_flash_map.map_priv_1 = (unsigned long)ioremap_nocache(FLASH_WINDOW_ADDR, FLASH_WINDOW_SIZE);
-	if (!ocelot_flash_map.map_priv_1) {
+	ocelot_flash_map.virt = (unsigned long)ioremap_nocache(FLASH_WINDOW_ADDR, FLASH_WINDOW_SIZE);
+	if (!ocelot_flash_map.virt) {
 		printk(KERN_NOTICE "Failed to ioremap Ocelot flash space\n");
 		goto fail_2;
 	}
 	/* Now the cached version */
-	ocelot_flash_map.map_priv_2 = (unsigned long)__ioremap(FLASH_WINDOW_ADDR, FLASH_WINDOW_SIZE, 0);
+	ocelot_flash_map.cached = (unsigned long)__ioremap(FLASH_WINDOW_ADDR, FLASH_WINDOW_SIZE, 0);
 
-	if (!ocelot_flash_map.map_priv_2) {
-		/* Doesn't matter if it failed. Just use the uncached version */
-		ocelot_flash_map.map_priv_2 = ocelot_flash_map.map_priv_1;
-	}
+	simple_map_init(&ocelot_flash_map);
 
 	/* Only probe for flash if the write jumper is present */
 	if (brd_status & 0x40) {
@@ -164,14 +137,13 @@
 	return 0;
 	
  fail3:	
-	iounmap((void *)ocelot_flash_map.map_priv_1);
-	if (ocelot_flash_map.map_priv_2 &&
-	    ocelot_flash_map.map_priv_2 != ocelot_flash_map.map_priv_1)
-			iounmap((void *)ocelot_flash_map.map_priv_2);
+	iounmap((void *)ocelot_flash_map.virt);
+	if (ocelot_flash_map.cached)
+			iounmap((void *)ocelot_flash_map.cached);
  fail_2:
 	map_destroy(nvram_mtd);
  fail_1:
-	iounmap((void *)ocelot_nvram_map.map_priv_1);
+	iounmap((void *)ocelot_nvram_map.virt);
 
 	return -ENXIO;
 }
@@ -180,16 +152,16 @@
 {
 	del_mtd_device(nvram_mtd);
 	map_destroy(nvram_mtd);
-	iounmap((void *)ocelot_nvram_map.map_priv_1);
+	iounmap((void *)ocelot_nvram_map.virt);
 
 	if (parsed_parts)
 		del_mtd_partitions(flash_mtd);
 	else
 		del_mtd_device(flash_mtd);
 	map_destroy(flash_mtd);
-	iounmap((void *)ocelot_flash_map.map_priv_1);
-	if (ocelot_flash_map.map_priv_2 != ocelot_flash_map.map_priv_1)
-		iounmap((void *)ocelot_flash_map.map_priv_2);
+	iounmap((void *)ocelot_flash_map.virt);
+	if (ocelot_flash_map.cached)
+		iounmap((void *)ocelot_flash_map.cached);
 }
 
 module_init(init_ocelot_maps);

Index: octagon-5066.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/octagon-5066.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- octagon-5066.c	7 Jan 2003 17:21:55 -0000	1.20
+++ octagon-5066.c	14 May 2003 15:05:15 -0000	1.21
@@ -151,32 +151,34 @@
 
 static struct map_info oct5066_map[2] = {
 	{
-		name: "Octagon 5066 Socket",
-		size: 512 * 1024,
-		buswidth: 1,
-		read8: oct5066_read8,
-		read16: oct5066_read16,
-		read32: oct5066_read32,
-		copy_from: oct5066_copy_from,
-		write8: oct5066_write8,
-		write16: oct5066_write16,
-		write32: oct5066_write32,
-		copy_to: oct5066_copy_to,
-		map_priv_1: 1<<6
+		.name = "Octagon 5066 Socket",
+		.phys = NO_XIP,
+		.size = 512 * 1024,
+		.buswidth = 1,
+		.read8 = oct5066_read8,
+		.read16 = oct5066_read16,
+		.read32 = oct5066_read32,
+		.copy_from = oct5066_copy_from,
+		.write8 = oct5066_write8,
+		.write16 = oct5066_write16,
+		.write32 = oct5066_write32,
+		.copy_to = oct5066_copy_to,
+		.map_priv_1 = 1<<6
 	},
 	{
-		name: "Octagon 5066 Internal Flash",
-		size: 2 * 1024 * 1024,
-		buswidth: 1,
-		read8: oct5066_read8,
-		read16: oct5066_read16,
-		read32: oct5066_read32,
-		copy_from: oct5066_copy_from,
-		write8: oct5066_write8,
-		write16: oct5066_write16,
-		write32: oct5066_write32,
-		copy_to: oct5066_copy_to,
-		map_priv_1: 2<<6
+		.name = "Octagon 5066 Internal Flash",
+		.phys = NO_XIP,
+		.size = 2 * 1024 * 1024,
+		.buswidth = 1,
+		.read8 = oct5066_read8,
+		.read16 = oct5066_read16,
+		.read32 = oct5066_read32,
+		.copy_from = oct5066_copy_from,
+		.write8 = oct5066_write8,
+		.write16 = oct5066_write16,
+		.write32 = oct5066_write32,
+		.copy_to = oct5066_copy_to,
+		.map_priv_1 = 2<<6
 	}
 };
 

Index: pb1xxx-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pb1xxx-flash.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- pb1xxx-flash.c	13 Sep 2002 13:51:54 -0000	1.4
+++ pb1xxx-flash.c	14 May 2003 15:05:15 -0000	1.5
@@ -29,75 +29,9 @@
 #define WINDOW_SIZE 0x800000
 #endif
 
-__u8 physmap_read8(struct map_info *map, unsigned long ofs)
-{
-	__u8 ret;
-	ret = __raw_readb(map->map_priv_1 + ofs);
-	DBG("read8 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret);
-	return ret;
-}
-
-__u16 physmap_read16(struct map_info *map, unsigned long ofs)
-{
-	__u16 ret;
-	ret = __raw_readw(map->map_priv_1 + ofs);
-	DBG("read16 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret);
-	return ret;
-}
-
-__u32 physmap_read32(struct map_info *map, unsigned long ofs)
-{
-	__u32 ret;
-	ret = __raw_readl(map->map_priv_1 + ofs);
-	DBG("read32 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret);
-	return ret;
-}
-
-void physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	DBG("physmap_copy from %x to %x\n", (unsigned)from, (unsigned)to);
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void physmap_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	DBG("write8 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d);
-	__raw_writeb(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void physmap_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	DBG("write16 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d);
-	__raw_writew(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void physmap_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	DBG("write32 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d);
-	__raw_writel(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void physmap_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	DBG("physmap_copy_to %x from %x\n", (unsigned)to, (unsigned)from);
-	memcpy_toio(map->map_priv_1 + to, from, len);
-}
-
-
 
 static struct map_info pb1xxx_map = {
-	name:		"Pb1xxx flash",
-	read8: physmap_read8,
-	read16: physmap_read16,
-	read32: physmap_read32,
-	copy_from: physmap_copy_from,
-	write8: physmap_write8,
-	write16: physmap_write16,
-	write32: physmap_write32,
-	copy_to: physmap_copy_to,
+	.name =	"Pb1xxx flash",
 };
 
 
@@ -107,23 +41,23 @@
 static unsigned char flash_buswidth = 4;
 static struct mtd_partition pb1xxx_partitions[] = {
         {
-                name: "yamon env",
-                size: 0x00020000,
-                offset: 0,
-                mask_flags: MTD_WRITEABLE
-        },{
-                name: "User FS",
-                size: 0x003e0000,
-                offset: 0x20000,
-        },{
-                name: "boot code",
-                size: 0x100000,
-                offset: 0x400000,
-                mask_flags: MTD_WRITEABLE
-        },{
-                name: "raw/kernel",
-                size: 0x300000,
-                offset: 0x500000
+                .name = "yamon env",
+                .size = 0x00020000,
+                .offset = 0,
+                .mask_flags = MTD_WRITEABLE
+        },{
+                .name = "User FS",
+                .size = 0x003e0000,
+                .offset = 0x20000,
+        },{
+                .name = "boot code",
+                .size = 0x100000,
+                .offset = 0x400000,
+                .mask_flags = MTD_WRITEABLE
+        },{
+                .name = "raw/kernel",
+                .size = 0x300000,
+                .offset = 0x500000
         }
 };
 
@@ -140,18 +74,18 @@
 #define WINDOW_SIZE 0x4000000
 static struct mtd_partition pb1xxx_partitions[] = {
         {
-                name: "User FS",
-                size:   0x3c00000,
-                offset: 0x0000000
-        },{
-                name: "yamon",
-                size: 0x0100000,
-                offset: 0x3c00000,
-                mask_flags: MTD_WRITEABLE
-        },{
-                name: "raw kernel",
-                size: 0x02c0000,
-                offset: 0x3d00000
+                .name = "User FS",
+                .size =   0x3c00000,
+                .offset = 0x0000000
+        },{
+                .name = "yamon",
+                .size = 0x0100000,
+                .offset = 0x3c00000,
+                .mask_flags = MTD_WRITEABLE
+        },{
+                .name = "raw kernel",
+                .size = 0x02c0000,
+                .offset = 0x3d00000
         }
 };
 #elif defined(CONFIG_MTD_PB1500_BOOT) && !defined(CONFIG_MTD_PB1500_USER)
@@ -160,18 +94,18 @@
 #define WINDOW_SIZE 0x2000000
 static struct mtd_partition pb1xxx_partitions[] = {
         {
-                name: "User FS",
-                size:   0x1c00000,
-                offset: 0x0000000
-        },{
-                name: "yamon",
-                size: 0x0100000,
-                offset: 0x1c00000,
-                mask_flags: MTD_WRITEABLE
-        },{
-                name: "raw kernel",
-                size: 0x02c0000,
-                offset: 0x1d00000
+                .name = "User FS",
+                .size =   0x1c00000,
+                .offset = 0x0000000
+        },{
+                .name = "yamon",
+                .size = 0x0100000,
+                .offset = 0x1c00000,
+                .mask_flags = MTD_WRITEABLE
+        },{
+                .name = "raw kernel",
+                .size = 0x02c0000,
+                .offset = 0x1d00000
         }
 };
 #elif !defined(CONFIG_MTD_PB1500_BOOT) && defined(CONFIG_MTD_PB1500_USER)
@@ -180,13 +114,13 @@
 #define WINDOW_SIZE 0x2000000
 static struct mtd_partition pb1xxx_partitions[] = {
         {
-                name: "User FS",
-                size:   0x1e00000,
-                offset: 0x0000000
-        },{
-                name: "raw kernel",
-                size: 0x0200000,
-                offset: 0x1e00000,
+                .name = "User FS",
+                .size =   0x1e00000,
+                .offset = 0x0000000
+        },{
+                .name = "raw kernel",
+                .size = 0x0200000,
+                .offset = 0x1e00000,
         }
 };
 #else
@@ -225,10 +159,16 @@
 	 */
 	printk(KERN_NOTICE "Pb1xxx flash: probing %d-bit flash bus\n", 
 			pb1xxx_map.buswidth*8);
-	pb1xxx_map.map_priv_1 = 
-		(unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
+	pb1xxx_map.phys = WINDOW_ADDR;
+	pb1xxx_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
+
+	simple_map_init(&pb1xxx_map);
+
 	mymtd = do_map_probe("cfi_probe", &pb1xxx_map);
-	if (!mymtd) return -ENXIO;
+	if (!mymtd) {
+		iounmap(pb1xxx_map.virt);
+		return -ENXIO;
+	}
 	mymtd->module = THIS_MODULE;
 
 	add_mtd_partitions(mymtd, parts, nb_parts);
@@ -243,6 +183,8 @@
 		if (parsed_parts)
 			kfree(parsed_parts);
 	}
+	if (pb1xxx_map.virt)
+		iounmap(pb1xxx_map.virt);
 }
 
 module_init(pb1xxx_mtd_init);

Index: pci.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pci.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pci.c	24 Jan 2003 13:11:43 -0000	1.2
+++ pci.c	14 May 2003 15:05:15 -0000	1.3
@@ -98,10 +98,10 @@
 }
 
 static struct mtd_pci_info intel_iq80310_info = {
-	init:		intel_iq80310_init,
-	exit:		intel_iq80310_exit,
-	translate:	intel_iq80310_translate,
-	map_name:	"cfi_probe",
+	.init =		intel_iq80310_init,
+	.exit =		intel_iq80310_exit,
+	.translate =	intel_iq80310_translate,
+	.map_name =	"cfi_probe",
 };
 
 /*
@@ -181,10 +181,10 @@
 }
 
 static struct mtd_pci_info intel_dc21285_info = {
-	init:		intel_dc21285_init,
-	exit:		intel_dc21285_exit,
-	translate:	intel_dc21285_translate,
-	map_name:	"jedec_probe",
+	.init =		intel_dc21285_init,
+	.exit =		intel_dc21285_exit,
+	.translate =	intel_dc21285_translate,
+	.map_name =	"jedec_probe",
 };
 
 /*
@@ -193,22 +193,20 @@
 
 static struct pci_device_id mtd_pci_ids[] __devinitdata = {
 	{
-		vendor:		PCI_VENDOR_ID_INTEL,
-		device:		0x530d,
-		subvendor:	PCI_ANY_ID,
-		subdevice:	PCI_ANY_ID,
-		class:		PCI_CLASS_MEMORY_OTHER << 8,
-		class_mask:	0xffff00,
-		driver_data:	(unsigned long)&intel_iq80310_info,
+		.vendor =	PCI_VENDOR_ID_INTEL,
+		.device =	0x530d,
+		.subvendor =	PCI_ANY_ID,
+		.subdevice =	PCI_ANY_ID,
+		.class =	PCI_CLASS_MEMORY_OTHER << 8,
+		.class_mask =	0xffff00,
+		.driver_data =	(unsigned long)&intel_iq80310_info,
 	},
 	{
-		vendor:		PCI_VENDOR_ID_DEC,
-		device:		PCI_DEVICE_ID_DEC_21285,
-		subvendor:	0,	/* DC21285 defaults to 0 on reset */
-		subdevice:	0,	/* DC21285 defaults to 0 on reset */
-		class:		0,
-		class_mask:	0,
-		driver_data:	(unsigned long)&intel_dc21285_info,
+		.vendor =	PCI_VENDOR_ID_DEC,
+		.device =	PCI_DEVICE_ID_DEC_21285,
+		.subvendor =	0,	/* DC21285 defaults to 0 on reset */
+		.subdevice =	0,	/* DC21285 defaults to 0 on reset */
+		.driver_data =	(unsigned long)&intel_dc21285_info,
 	},
 	{ 0, }
 };
@@ -275,14 +273,15 @@
 }
 
 static struct map_info mtd_pci_map = {
-	read8:		mtd_pci_read8,
-	read16:		mtd_pci_read16,
-	read32:		mtd_pci_read32,
-	copy_from:	mtd_pci_copyfrom,
-	write8:		mtd_pci_write8,
-	write16:	mtd_pci_write16,
-	write32:	mtd_pci_write32,
-	copy_to:	mtd_pci_copyto,
+	.phys =		NO_XIP,
+	.read8 =	mtd_pci_read8,
+	.read16 =	mtd_pci_read16,
+	.read32 =	mtd_pci_read32,
+	.copy_from =	mtd_pci_copyfrom,
+	.write8 =	mtd_pci_write8,
+	.write16 =	mtd_pci_write16,
+	.write32 =	mtd_pci_write32,
+	.copy_to =	mtd_pci_copyto,
 };
 
 static int __devinit
@@ -359,10 +358,10 @@
 }
 
 static struct pci_driver mtd_pci_driver = {
-	name:		"MTD PCI",
-	probe:		mtd_pci_probe,
-	remove:		__devexit_p(mtd_pci_remove),
-	id_table:	mtd_pci_ids,
+	.name =		"MTD PCI",
+	.probe =	mtd_pci_probe,
+	.remove =	__devexit_p(mtd_pci_remove),
+	.id_table =	mtd_pci_ids,
 };
 
 static int __init mtd_pci_maps_init(void)

Index: pcmciamtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pcmciamtd.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- pcmciamtd.c	7 May 2003 10:13:47 -0000	1.40
+++ pcmciamtd.c	14 May 2003 15:05:15 -0000	1.41
@@ -531,6 +531,7 @@
 
 	card_settings(dev, link, &new_name);
 
+	dev->pcmcia_map.phys = NO_XIP;
 	dev->pcmcia_map.read8 = pcmcia_read8_remap;
 	dev->pcmcia_map.read16 = pcmcia_read16_remap;
 	dev->pcmcia_map.copy_from = pcmcia_copy_from_remap;

Index: physmap.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/physmap.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- physmap.c	29 Jan 2003 23:45:41 -0000	1.22
+++ physmap.c	14 May 2003 15:05:15 -0000	1.23
@@ -22,73 +22,12 @@
 
 static struct mtd_info *mymtd;
 
-__u8 physmap_read8(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readb(map->map_priv_1 + ofs);
-}
-
-__u16 physmap_read16(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readw(map->map_priv_1 + ofs);
-}
-
-__u32 physmap_read32(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void physmap_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	__raw_writeb(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void physmap_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	__raw_writew(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void physmap_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	__raw_writel(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void physmap_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio(map->map_priv_1 + to, from, len);
-}
-
-u_char * physmap_point(struct map_info *map, loff_t from, size_t len)
-{
-	return (u_char *)(map->map_priv_1 + (unsigned long)from);
-}
-
-void physmap_unpoint(struct map_info *map,  u_char *adr, loff_t from, size_t len)
-{
-  /* do nothing for now */
-}
 
 struct map_info physmap_map = {
-	name: "Physically mapped flash",
-	size: WINDOW_SIZE,
-	buswidth: BUSWIDTH,
-	read8: physmap_read8,
-	read16: physmap_read16,
-	read32: physmap_read32,
-	point: physmap_point,
-	unpoint: physmap_unpoint,
-	copy_from: physmap_copy_from,
-	write8: physmap_write8,
-	write16: physmap_write16,
-	write32: physmap_write32,
-	copy_to: physmap_copy_to
+	.name = "Physically mapped flash",
+	.size = WINDOW_SIZE,
+	.buswidth = BUSWIDTH,
+	.phys = WINDOW_ADDR,
 };
 
 #ifdef CONFIG_MTD_PARTITIONS
@@ -100,24 +39,24 @@
 /* Put your own partition definitions here */
 #if 0
 	{
-		name:		"bootROM",
-		size:		0x80000,
-		offset:		0,
-		mask_flags:	MTD_WRITEABLE,  /* force read-only */
+		.name =		"bootROM",
+		.size =		0x80000,
+		.offset =		0,
+		.mask_flags =	MTD_WRITEABLE,  /* force read-only */
 	}, {
-		name:		"zImage",
-		size:		0x100000,
-		offset:		MTDPART_OFS_APPEND,
-		mask_flags:	MTD_WRITEABLE,  /* force read-only */
+		.name =		"zImage",
+		.size =		0x100000,
+		.offset =		MTDPART_OFS_APPEND,
+		.mask_flags =	MTD_WRITEABLE,  /* force read-only */
 	}, {
-		name:		"ramdisk.gz",
-		size:		0x300000,
-		offset:		MTDPART_OFS_APPEND,
-		mask_flags:	MTD_WRITEABLE,  /* force read-only */
+		.name =		"ramdisk.gz",
+		.size =		0x300000,
+		.offset =		MTDPART_OFS_APPEND,
+		.mask_flags =	MTD_WRITEABLE,  /* force read-only */
 	}, {
-		name:		"User FS",
-		size:		MTDPART_SIZ_FULL,
-		offset:		MTDPART_OFS_APPEND,
+		.name =		"User FS",
+		.size =		MTDPART_SIZ_FULL,
+		.offset =		MTDPART_OFS_APPEND,
 	}
 #endif
 };
@@ -133,13 +72,15 @@
 	const char **type;
 
        	printk(KERN_NOTICE "physmap flash device: %x at %x\n", WINDOW_SIZE, WINDOW_ADDR);
-	physmap_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
+	physmap_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
 
-	if (!physmap_map.map_priv_1) {
+	if (!physmap_map.virt) {
 		printk("Failed to ioremap\n");
 		return -EIO;
 	}
-	
+
+	simple_map_init(&physmap_map);
+
 	mymtd = 0;
 	type = rom_probe_types;
 	for(; !mymtd && *type; type++) {
@@ -172,7 +113,7 @@
 		return 0;
 	}
 
-	iounmap((void *)physmap_map.map_priv_1);
+	iounmap((void *)physmap_map.virt);
 	return -ENXIO;
 }
 
@@ -182,9 +123,9 @@
 		del_mtd_device(mymtd);
 		map_destroy(mymtd);
 	}
-	if (physmap_map.map_priv_1) {
-		iounmap((void *)physmap_map.map_priv_1);
-		physmap_map.map_priv_1 = 0;
+	if (physmap_map.virt) {
+		iounmap((void *)physmap_map.virt);
+		physmap_map.virt = 0;
 	}
 }
 

Index: pnc2000.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pnc2000.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- pnc2000.c	2 Oct 2001 15:05:14 -0000	1.10
+++ pnc2000.c	14 May 2003 15:05:15 -0000	1.11
@@ -24,58 +24,13 @@
  * MAP DRIVER STUFF
  */
 
-__u8 pnc_read8(struct map_info *map, unsigned long ofs)
-{
-  return *(__u8 *)(WINDOW_ADDR + ofs);
-}
-
-__u16 pnc_read16(struct map_info *map, unsigned long ofs)
-{
-  return *(__u16 *)(WINDOW_ADDR + ofs);
-}
-
-__u32 pnc_read32(struct map_info *map, unsigned long ofs)
-{
-  return *(volatile unsigned int *)(WINDOW_ADDR + ofs);
-}
-
-void pnc_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-  memcpy(to, (void *)(WINDOW_ADDR + from), len);
-}
-
-void pnc_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-  *(__u8 *)(WINDOW_ADDR + adr) = d;
-}
-
-void pnc_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-  *(__u16 *)(WINDOW_ADDR + adr) = d;
-}
-
-void pnc_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-  *(__u32 *)(WINDOW_ADDR + adr) = d;
-}
-
-void pnc_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-  memcpy((void *)(WINDOW_ADDR + to), from, len);
-}
 
 struct map_info pnc_map = {
-	name: "PNC-2000",
-	size: WINDOW_SIZE,
-	buswidth: 4,
-	read8: pnc_read8,
-	read16: pnc_read16,
-	read32: pnc_read32,
-	copy_from: pnc_copy_from,
-	write8: pnc_write8,
-	write16: pnc_write16,
-	write32: pnc_write32,
-	copy_to: pnc_copy_to
+	.name = "PNC-2000",
+	.size = WINDOW_SIZE,
+	.buswidth = 4,
+	.phys = 0xFFFFFFFF,
+	.virt = WINDOW_ADDR,
 };
 
 
@@ -84,19 +39,19 @@
  */
 static struct mtd_partition pnc_partitions[3] = {
 	{
-		name: "PNC-2000 boot firmware",
-		size: 0x20000,
-		offset: 0
+		.name = "PNC-2000 boot firmware",
+		.size = 0x20000,
+		.offset = 0
 	},
 	{
-		name: "PNC-2000 kernel",
-		size: 0x1a0000,
-		offset: 0x20000
+		.name = "PNC-2000 kernel",
+		.size = 0x1a0000,
+		.offset = 0x20000
 	},
 	{
-		name: "PNC-2000 filesystem",
-		size: 0x240000,
-		offset: 0x1c0000
+		.name = "PNC-2000 filesystem",
+		.size = 0x240000,
+		.offset = 0x1c0000
 	}
 };
 
@@ -109,6 +64,8 @@
 int __init init_pnc2000(void)
 {
 	printk(KERN_NOTICE "Photron PNC-2000 flash mapping: %x at %x\n", WINDOW_SIZE, WINDOW_ADDR);
+
+	simple_map_init(&pnc_map);
 
 	mymtd = do_map_probe("cfi_probe", &pnc_map);
 	if (mymtd) {

Index: redwood.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/redwood.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- redwood.c	1 Apr 2003 18:07:13 -0000	1.2
+++ redwood.c	14 May 2003 15:05:15 -0000	1.3
@@ -1,5 +1,5 @@
 /*
- * $Id:
+ * $Id$
  *
  * drivers/mtd/maps/redwood.c
  *
@@ -24,11 +24,9 @@
 #include <linux/mtd/partitions.h>
 
 #include <asm/io.h>
-#define STBXX_VPD_SZ	0x10000
-#define STBXX_OB_SZ	0x20000
-#define STBXX_4MB	0x4000000
 
 #if !defined (CONFIG_REDWOOD_6)
+
 #define WINDOW_ADDR 0xffc00000
 #define WINDOW_SIZE 0x00400000
 
@@ -42,131 +40,84 @@
 #define RW_PART3_SZ	0x200000 - (0x10000 + 0x20000)
 #define RW_PART4_OF	0x3e0000
 #define RW_PART4_SZ	0x20000
+
 static struct mtd_partition redwood_flash_partitions[] = {
 	{
-		name: "Redwood OpenBIOS Vital Product Data",
-		offset: RW_PART0_OF,
-		size: RW_PART0_SZ,
-		mask_flags: MTD_WRITEABLE	/* force read-only */
+		.name = "Redwood OpenBIOS Vital Product Data",
+		.offset = RW_PART0_OF,
+		.size = RW_PART0_SZ,
+		.mask_flags = MTD_WRITEABLE	/* force read-only */
 	},
 	{
-		name: "Redwood kernel",
-		offset: RW_PART1_OF,
-		size: RW_PART1_SZ
+		.name = "Redwood kernel",
+		.offset = RW_PART1_OF,
+		.size = RW_PART1_SZ
 	},
 	{
-		name: "Redwood OpenBIOS non-volatile storage",
-		offset: RW_PART2_OF,
-		size: RW_PART2_SZ,
-		mask_flags: MTD_WRITEABLE	/* force read-only */
+		.name = "Redwood OpenBIOS non-volatile storage",
+		.offset = RW_PART2_OF,
+		.size = RW_PART2_SZ,
+		.mask_flags = MTD_WRITEABLE	/* force read-only */
 	},
 	{
-		name: "Redwood filesystem",
-		offset: RW_PART3_OF,
-		size: RW_PART3_SZ
+		.name = "Redwood filesystem",
+		.offset = RW_PART3_OF,
+		.size = RW_PART3_SZ
 	},
 	{
-		name: "Redwood OpenBIOS",
-		offset: RW_PART4_OF,
-		size: RW_PART4_SZ,
-		mask_flags: MTD_WRITEABLE	/* force read-only */
+		.name = "Redwood OpenBIOS",
+		.offset = RW_PART4_OF,
+		.size = RW_PART4_SZ,
+		.mask_flags = MTD_WRITEABLE	/* force read-only */
 	}
 };
 
-#else
+#else /* CONFIG_REDWOOD_6 */
 /* FIXME: the window is bigger - armin */
 #define WINDOW_ADDR 0xff800000
 #define WINDOW_SIZE 0x00800000
 
 #define RW_PART0_OF	0
-#define RW_PART0_SZ	0x400000	/* 4 MB data */
+#define RW_PART0_SZ	0x400000	/* 4 MiB data */
 #define RW_PART1_OF	RW_PART0_OF + RW_PART0_SZ 
 #define RW_PART1_SZ	0x10000		/* 64K VPD */
 #define RW_PART2_OF	RW_PART1_OF + RW_PART1_SZ
 #define RW_PART2_SZ	0x400000 - (0x10000 + 0x20000)
 #define RW_PART3_OF	RW_PART2_OF + RW_PART2_SZ
 #define RW_PART3_SZ	0x20000
+
 static struct mtd_partition redwood_flash_partitions[] = {
 	{
-		name: "Redwood kernel",
-		offset: RW_PART0_OF,
-		size: RW_PART0_SZ
+		.name = "Redwood kernel",
+		.offset = RW_PART0_OF,
+		.size = RW_PART0_SZ
 	},
 	{
-		name: "Redwood OpenBIOS Vital Product Data",
-		offset: RW_PART1_OF,
-		size: RW_PART1_SZ,
-		mask_flags: MTD_WRITEABLE	/* force read-only */
+		.name = "Redwood OpenBIOS Vital Product Data",
+		.offset = RW_PART1_OF,
+		.size = RW_PART1_SZ,
+		.mask_flags = MTD_WRITEABLE	/* force read-only */
 	},
 	{
-		name: "Redwood filesystem",
-		offset: RW_PART2_OF,
-		size: RW_PART2_SZ
+		.name = "Redwood filesystem",
+		.offset = RW_PART2_OF,
+		.size = RW_PART2_SZ
 	},
 	{
-		name: "Redwood OpenBIOS",
-		offset: RW_PART3_OF,
-		size: RW_PART3_SZ,
-		mask_flags: MTD_WRITEABLE	/* force read-only */
+		.name = "Redwood OpenBIOS",
+		.offset = RW_PART3_OF,
+		.size = RW_PART3_SZ,
+		.mask_flags = MTD_WRITEABLE	/* force read-only */
 	}
 };
 
-#endif
-
-__u8 redwood_flash_read8(struct map_info *map, unsigned long ofs)
-{
-	return *(__u8 *)(map->map_priv_1 + ofs);
-}
-
-__u16 redwood_flash_read16(struct map_info *map, unsigned long ofs)
-{
-	return *(__u16 *)(map->map_priv_1 + ofs);
-}
-
-__u32 redwood_flash_read32(struct map_info *map, unsigned long ofs)
-{
-	return *(volatile unsigned int *)(map->map_priv_1 + ofs);
-}
-
-void redwood_flash_copy_from(struct map_info *map, void *to,
-		unsigned long from, ssize_t len)
-{
-	memcpy(to, (void *)(map->map_priv_1 + from), len);
-}
-
-void redwood_flash_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	*(__u8 *)(map->map_priv_1 + adr) = d;
-}
-
-void redwood_flash_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	*(__u16 *)(map->map_priv_1 + adr) = d;
-}
-
-void redwood_flash_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	*(__u32 *)(map->map_priv_1 + adr) = d;
-}
-
-void redwood_flash_copy_to(struct map_info *map, unsigned long to,
-		const void *from, ssize_t len)
-{
-	memcpy((void *)(map->map_priv_1 + to), from, len);
-}
+#endif /* CONFIG_REDWOOD_6 */
 
 struct map_info redwood_flash_map = {
-	name: "IBM Redwood",
-	size: WINDOW_SIZE,
-	buswidth: 2,
-	read8: redwood_flash_read8,
-	read16: redwood_flash_read16,
-	read32: redwood_flash_read32,
-	copy_from: redwood_flash_copy_from,
-	write8: redwood_flash_write8,
-	write16: redwood_flash_write16,
-	write32: redwood_flash_write32,
-	copy_to: redwood_flash_copy_to
+	.name = "IBM Redwood",
+	.size = WINDOW_SIZE,
+	.buswidth = 2,
+	.phys = WINDOW_ADDR,
 };
 
 
@@ -180,13 +131,14 @@
 	printk(KERN_NOTICE "redwood: flash mapping: %x at %x\n",
 			WINDOW_SIZE, WINDOW_ADDR);
 
-	redwood_flash_map.map_priv_1 =
+	redwood_flash_map.virt =
 		(unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
 
-	if (!redwood_flash_map.map_priv_1) {
+	if (!redwood_flash_map.virt) {
 		printk("init_redwood_flash: failed to ioremap\n");
 		return -EIO;
 	}
+	simple_map_init(&redwood_flash_map);
 
 	redwood_mtd = do_map_probe("cfi_probe",&redwood_flash_map);
 
@@ -206,7 +158,7 @@
 		del_mtd_partitions(redwood_mtd);
 		/* moved iounmap after map_destroy - armin */
 		map_destroy(redwood_mtd);
-		iounmap((void *)redwood_flash_map.map_priv_1);
+		iounmap((void *)redwood_flash_map.virt);
 	}
 }
 

Index: rpxlite.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/rpxlite.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- rpxlite.c	2 Oct 2001 15:05:14 -0000	1.15
+++ rpxlite.c	14 May 2003 15:05:15 -0000	1.16
@@ -17,72 +17,23 @@
 
 static struct mtd_info *mymtd;
 
-__u8 rpxlite_read8(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readb(map->map_priv_1 + ofs);
-}
-
-__u16 rpxlite_read16(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readw(map->map_priv_1 + ofs);
-}
-
-__u32 rpxlite_read32(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void rpxlite_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, (void *)(map->map_priv_1 + from), len);
-}
-
-void rpxlite_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	__raw_writeb(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void rpxlite_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	__raw_writew(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void rpxlite_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	__raw_writel(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void rpxlite_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio((void *)(map->map_priv_1 + to), from, len);
-}
-
-struct map_info rpxlite_map = {
-	name: "RPX",
-	size: WINDOW_SIZE,
-	buswidth: 4,
-	read8: rpxlite_read8,
-	read16: rpxlite_read16,
-	read32: rpxlite_read32,
-	copy_from: rpxlite_copy_from,
-	write8: rpxlite_write8,
-	write16: rpxlite_write16,
-	write32: rpxlite_write32,
-	copy_to: rpxlite_copy_to
+static struct map_info rpxlite_map = {
+	.name = "RPX",
+	.size = WINDOW_SIZE,
+	.buswidth = 4,
+	.phys = WINDOW_ADDR,
 };
 
 int __init init_rpxlite(void)
 {
 	printk(KERN_NOTICE "RPX Lite or CLLF flash device: %x at %x\n", WINDOW_SIZE*4, WINDOW_ADDR);
-	rpxlite_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE * 4);
+	rpxlite_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE * 4);
 
-	if (!rpxlite_map.map_priv_1) {
+	if (!rpxlite_map.virt) {
 		printk("Failed to ioremap\n");
 		return -EIO;
 	}
+	simple_map_init(&rpxlite_map);
 	mymtd = do_map_probe("cfi_probe", &rpxlite_map);
 	if (mymtd) {
 		mymtd->module = THIS_MODULE;
@@ -90,7 +41,7 @@
 		return 0;
 	}
 
-	iounmap((void *)rpxlite_map.map_priv_1);
+	iounmap((void *)rpxlite_map.virt);
 	return -ENXIO;
 }
 
@@ -100,9 +51,9 @@
 		del_mtd_device(mymtd);
 		map_destroy(mymtd);
 	}
-	if (rpxlite_map.map_priv_1) {
-		iounmap((void *)rpxlite_map.map_priv_1);
-		rpxlite_map.map_priv_1 = 0;
+	if (rpxlite_map.virt) {
+		iounmap((void *)rpxlite_map.virt);
+		rpxlite_map.virt = 0;
 	}
 }
 

Index: sa1100-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sa1100-flash.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- sa1100-flash.c	17 Feb 2003 21:49:10 -0000	1.30
+++ sa1100-flash.c	14 May 2003 15:05:15 -0000	1.31
@@ -27,59 +27,11 @@
 
 #define WINDOW_ADDR 0xe8000000
 
-static __u8 sa1100_read8(struct map_info *map, unsigned long ofs)
-{
-	return readb(map->map_priv_1 + ofs);
-}
-
-static __u16 sa1100_read16(struct map_info *map, unsigned long ofs)
-{
-	return readw(map->map_priv_1 + ofs);
[...1119 lines suppressed...]
-		release_mem_region(sa1100_map.map_priv_2, sa1100_map.size);
+	if (sa1100_map.virt != WINDOW_ADDR) {
+		iounmap((void *)sa1100_map.virt);
+		release_mem_region(sa1100_map.phys, sa1100_map.size);
 	}
 	return ret;
 }
@@ -1011,9 +968,9 @@
 		if (parsed_parts)
 			kfree(parsed_parts);
 	}
-	if (sa1100_map.map_priv_2 != -1) {
-		iounmap((void *)sa1100_map.map_priv_1);
-		release_mem_region(sa1100_map.map_priv_2, sa1100_map.size);
+	if (sa1100_map.virt != WINDOW_ADDR) {
+		iounmap((void *)sa1100_map.virt);
+		release_mem_region(sa1100_map.phys, sa1100_map.size);
 	}
 }
 

Index: sbc_gxx.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sbc_gxx.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- sbc_gxx.c	24 Jan 2003 13:40:14 -0000	1.21
+++ sbc_gxx.c	14 May 2003 15:05:16 -0000	1.22
@@ -91,14 +91,14 @@
  * single flash device into. If the size if zero we use up to the end of the
  * device. */
 static struct mtd_partition partition_info[]={
-    { name: "SBC-GXx flash boot partition", 
-      offset: 0, 
-      size:   BOOT_PARTITION_SIZE_KiB*1024 },
-    { name: "SBC-GXx flash data partition", 
-      offset: BOOT_PARTITION_SIZE_KiB*1024, 
-      size: (DATA_PARTITION_SIZE_KiB)*1024 },
-    { name: "SBC-GXx flash application partition", 
-      offset: (BOOT_PARTITION_SIZE_KiB+DATA_PARTITION_SIZE_KiB)*1024 }
+    { .name = "SBC-GXx flash boot partition", 
+      .offset = 0, 
+      .size =   BOOT_PARTITION_SIZE_KiB*1024 },
+    { .name = "SBC-GXx flash data partition", 
+      .offset = BOOT_PARTITION_SIZE_KiB*1024, 
+      .size = (DATA_PARTITION_SIZE_KiB)*1024 },
+    { .name = "SBC-GXx flash application partition", 
+      .offset = (BOOT_PARTITION_SIZE_KiB+DATA_PARTITION_SIZE_KiB)*1024 }
 };
 
 #define NUM_PARTITIONS 3
@@ -203,19 +203,20 @@
 }
 
 static struct map_info sbc_gxx_map = {
-	name: "SBC-GXx flash",
-	size: MAX_SIZE_KiB*1024, /* this must be set to a maximum possible amount
+	.name = "SBC-GXx flash",
+	.phys = NO_XIP,
+	.size = MAX_SIZE_KiB*1024, /* this must be set to a maximum possible amount
 			 of flash so the cfi probe routines find all
 			 the chips */
-	buswidth: 1,
-	read8: sbc_gxx_read8,
-	read16: sbc_gxx_read16,
-	read32: sbc_gxx_read32,
-	copy_from: sbc_gxx_copy_from,
-	write8: sbc_gxx_write8,
-	write16: sbc_gxx_write16,
-	write32: sbc_gxx_write32,
-	copy_to: sbc_gxx_copy_to
+	.buswidth = 1,
+	.read8 = sbc_gxx_read8,
+	.read16 = sbc_gxx_read16,
+	.read32 = sbc_gxx_read32,
+	.copy_from = sbc_gxx_copy_from,
+	.write8 = sbc_gxx_write8,
+	.write16 = sbc_gxx_write16,
+	.write32 = sbc_gxx_write32,
+	.copy_to = sbc_gxx_copy_to
 };
 
 /* MTD device for all of the flash. */

Index: sc520cdp.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sc520cdp.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- sc520cdp.c	8 Mar 2002 16:34:35 -0000	1.11
+++ sc520cdp.c	14 May 2003 15:05:16 -0000	1.12
@@ -84,88 +84,25 @@
 #define WINDOW_SIZE_1	0x00800000
 #define WINDOW_SIZE_2	0x00080000
 
-static __u8 sc520cdp_read8(struct map_info *map, unsigned long ofs)
-{
-	return readb(map->map_priv_1 + ofs);
-}
-
-static __u16 sc520cdp_read16(struct map_info *map, unsigned long ofs)
-{
-	return readw(map->map_priv_1 + ofs);
-}
-
-static __u32 sc520cdp_read32(struct map_info *map, unsigned long ofs)
-{
-	return readl(map->map_priv_1 + ofs);
-}
-
-static void sc520cdp_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, (void *)(map->map_priv_1 + from), len);
-}
-
-static void sc520cdp_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	writeb(d, map->map_priv_1 + adr);
-}
-
-static void sc520cdp_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	writew(d, map->map_priv_1 + adr);
-}
-
-static void sc520cdp_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	writel(d, map->map_priv_1 + adr);
-}
-
-static void sc520cdp_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio((void *)(map->map_priv_1 + to), from, len);
-}
 
 static struct map_info sc520cdp_map[] = {
 	{
-		name: "SC520CDP Flash Bank #0",
-		size: WINDOW_SIZE_0,
-		buswidth: 4,
-		read8: sc520cdp_read8,
-		read16: sc520cdp_read16,
-		read32: sc520cdp_read32,
-		copy_from: sc520cdp_copy_from,
-		write8: sc520cdp_write8,
-		write16: sc520cdp_write16,
-		write32: sc520cdp_write32,
-		copy_to: sc520cdp_copy_to,
-		map_priv_2: WINDOW_ADDR_0
+		.name = "SC520CDP Flash Bank #0",
+		.size = WINDOW_SIZE_0,
+		.buswidth = 4,
+		.phys = WINDOW_ADDR_0
 	},
 	{
-		name: "SC520CDP Flash Bank #1",
-		size: WINDOW_SIZE_1,
-		buswidth: 4,
-		read8: sc520cdp_read8,
-		read16: sc520cdp_read16,
-		read32: sc520cdp_read32,
-		copy_from: sc520cdp_copy_from,
-		write8: sc520cdp_write8,
-		write16: sc520cdp_write16,
-		write32: sc520cdp_write32,
-		copy_to: sc520cdp_copy_to,
-		map_priv_2: WINDOW_ADDR_1
+		.name = "SC520CDP Flash Bank #1",
+		.size = WINDOW_SIZE_1,
+		.buswidth = 4,
+		.phys = WINDOW_ADDR_1
 	},
 	{
-		name: "SC520CDP DIL Flash",
-		size: WINDOW_SIZE_2,
-		buswidth: 1,
-		read8: sc520cdp_read8,
-		read16: sc520cdp_read16,
-		read32: sc520cdp_read32,
-		copy_from: sc520cdp_copy_from,
-		write8: sc520cdp_write8,
-		write16: sc520cdp_write16,
-		write32: sc520cdp_write32,
-		copy_to: sc520cdp_copy_to,
-		map_priv_2: WINDOW_ADDR_2
+		.name = "SC520CDP DIL Flash",
+		.size = WINDOW_SIZE_2,
+		.buswidth = 1,
+		.phys = WINDOW_ADDR_2
 	},
 };
 
@@ -255,9 +192,9 @@
 	/* map in SC520's MMCR area */
 	mmcr = (unsigned long *)ioremap_nocache(SC520_MMCR_BASE, SC520_MMCR_EXTENT);
 	if(!mmcr) { /* ioremap_nocache failed: skip the PAR reprogramming */
-		/* force map_priv_2 fields to BIOS defaults: */
+		/* force physical address fields to BIOS defaults: */
 		for(i = 0; i < NUM_FLASH_BANKS; i++)
-			sc520cdp_map[i].map_priv_2 = par_table[i].default_address;
+			sc520cdp_map[i].phys = par_table[i].default_address;
 		return;
 	}
 
@@ -282,7 +219,7 @@
 				sc520cdp_map[i].name);
 			printk(KERN_NOTICE "Trying default address 0x%lx\n",
 				par_table[i].default_address);
-			sc520cdp_map[i].map_priv_2 = par_table[i].default_address;
+			sc520cdp_map[i].phys = par_table[i].default_address;
 		}
 	}
 	iounmap((void *)mmcr);
@@ -300,13 +237,18 @@
 #endif
 
 	for (i = 0; i < NUM_FLASH_BANKS; i++) {
-		printk(KERN_NOTICE "SC520 CDP flash device: %lx at %lx\n", sc520cdp_map[i].size, sc520cdp_map[i].map_priv_2);
-		sc520cdp_map[i].map_priv_1 = (unsigned long)ioremap_nocache(sc520cdp_map[i].map_priv_2, sc520cdp_map[i].size);
+		printk(KERN_NOTICE "SC520 CDP flash device: 0x%lx at 0x%lx\n",
+		       sc520cdp_map[i].size, sc520cdp_map[i].phys);
 
-		if (!sc520cdp_map[i].map_priv_1) {
+		sc520cdp_map[i].virt = (unsigned long)ioremap_nocache(sc520cdp_map[i].phys, sc520cdp_map[i].size);
+
+		if (!sc520cdp_map[i].virt) {
 			printk("Failed to ioremap_nocache\n");
 			return -EIO;
 		}
+
+		simple_map_init(&sc520cdp_map[i]);
+
 		mymtd[i] = do_map_probe("cfi_probe", &sc520cdp_map[i]);
 		if(!mymtd[i])
 			mymtd[i] = do_map_probe("jedec_probe", &sc520cdp_map[i]);
@@ -318,7 +260,7 @@
 			++devices_found;
 		}
 		else {
-			iounmap((void *)sc520cdp_map[i].map_priv_1);
+			iounmap((void *)sc520cdp_map[i].virt);
 		}
 	}
 	if(devices_found >= 2) {
@@ -346,9 +288,9 @@
 	for (i = 0; i < NUM_FLASH_BANKS; i++) {
 		if (mymtd[i])
 			map_destroy(mymtd[i]);
-		if (sc520cdp_map[i].map_priv_1) {
-			iounmap((void *)sc520cdp_map[i].map_priv_1);
-			sc520cdp_map[i].map_priv_1 = 0;
+		if (sc520cdp_map[i].virt) {
+			iounmap((void *)sc520cdp_map[i].virt);
+			sc520cdp_map[i].virt = 0;
 		}
 	}
 }

Index: scb2_flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/scb2_flash.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- scb2_flash.c	24 Jan 2003 13:09:56 -0000	1.2
+++ scb2_flash.c	14 May 2003 15:05:16 -0000	1.3
@@ -14,7 +14,7 @@
  * try to request it here, but if it fails, we carry on anyway.
  *
  * This is how the chip is attached, so said the schematic:
- * * a 4 MiB (32 Mb) 16 bit chip
+ * * a 4 MiB (32 Mib) 16 bit chip
  * * a 1 MiB memory region
  * * A20 and A21 pulled up
  * * D8-D15 ignored
@@ -60,65 +60,13 @@
 #define SCB2_ADDR	0xfff00000
 #define SCB2_WINDOW	0x00100000
 
-static __u8 scb2_read8(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readb(map->map_priv_1 + ofs);
-}
-
-static __u16 scb2_read16(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readw(map->map_priv_1 + ofs);
-}
-
-static __u32 scb2_read32(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readl(map->map_priv_1 + ofs);
-}
-
-static void scb2_copy_from(struct map_info *map, void *to,
-				 unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-static void scb2_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	__raw_writeb(d, map->map_priv_1 + adr);
-	mb();
-}
-
-static void scb2_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	__raw_writew(d, map->map_priv_1 + adr);
-	mb();
-}
-
-static void scb2_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	__raw_writel(d, map->map_priv_1 + adr);
-	mb();
-}
-
-static void scb2_copy_to(struct map_info *map, unsigned long to,
-			       const void *from, ssize_t len)
-{
-	memcpy_toio(map->map_priv_1 + to, from, len);
-}
 
 static void *scb2_ioaddr;
 static struct mtd_info *scb2_mtd;
 struct map_info scb2_map = {
-	name:      "SCB2 BIOS Flash",
-	size:      0,
-	buswidth:  1,
-	read8:     scb2_read8,
-	read16:    scb2_read16,
-	read32:    scb2_read32,
-	copy_from: scb2_copy_from,
-	write8:    scb2_write8,
-	write16:   scb2_write16,
-	write32:   scb2_write32,
-	copy_to:   scb2_copy_to,
+	.name =      "SCB2 BIOS Flash",
+	.size =      0,
+	.buswidth =  1,
 };
 static int region_fail;
 
@@ -137,6 +85,8 @@
 		return -1;
 	}
 
+	/* I wasn't here. I didn't see. dwmw2. */
+
 	/* the chip is sometimes bigger than the map - what a waste */
 	mtd->size = map->size;
 
@@ -211,9 +161,12 @@
 		return -ENOMEM;
 	}
 
-	scb2_map.map_priv_1 = (unsigned long)scb2_ioaddr;
+	scb2_map.phys = SCB2_ADDR;
+	scb2_map.virt = (unsigned long)scb2_ioaddr;
 	scb2_map.size = SCB2_WINDOW;
 
+	simple_map_init(&scb2_map);
+
 	/* try to find a chip */
 	scb2_mtd = do_map_probe("cfi_probe", &scb2_map);
 
@@ -235,7 +188,7 @@
 		return -ENODEV;
 	}
 
-	printk(KERN_NOTICE MODNAME ": chip size %x at offset %x\n",
+	printk(KERN_NOTICE MODNAME ": chip size 0x%x at offset 0x%x\n",
 	       scb2_mtd->size, SCB2_WINDOW - scb2_mtd->size);
 
 	add_mtd_device(scb2_mtd);
@@ -266,19 +219,19 @@
 
 static struct pci_device_id scb2_flash_pci_ids[] __devinitdata = {
 	{
-	  vendor: PCI_VENDOR_ID_SERVERWORKS,
-	  device: PCI_DEVICE_ID_SERVERWORKS_CSB5,
-	  subvendor: PCI_ANY_ID,
-	  subdevice: PCI_ANY_ID
+	  .vendor = PCI_VENDOR_ID_SERVERWORKS,
+	  .device = PCI_DEVICE_ID_SERVERWORKS_CSB5,
+	  .subvendor = PCI_ANY_ID,
+	  .subdevice = PCI_ANY_ID
 	},
 	{ 0, }
 };
 
 static struct pci_driver scb2_flash_driver = {
-	name:     "Intel SCB2 BIOS Flash",
-	id_table: scb2_flash_pci_ids,
-	probe:    scb2_flash_probe,
-	remove:   __devexit_p(scb2_flash_remove),
+	.name =     "Intel SCB2 BIOS Flash",
+	.id_table = scb2_flash_pci_ids,
+	.probe =    scb2_flash_probe,
+	.remove =   __devexit_p(scb2_flash_remove),
 };
 
 static int __init

Index: scx200_docflash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/scx200_docflash.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- scx200_docflash.c	24 Jan 2003 13:20:40 -0000	1.1
+++ scx200_docflash.c	14 May 2003 15:05:16 -0000	1.2
@@ -75,46 +75,9 @@
 #define NUM_PARTITIONS (sizeof(partition_info)/sizeof(partition_info[0]))
 #endif
 
-static __u8 scx200_docflash_read8(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readb(map->map_priv_1 + ofs);
-}
-
-static __u16 scx200_docflash_read16(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readw(map->map_priv_1 + ofs);
-}
-
-static void scx200_docflash_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-static void scx200_docflash_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	__raw_writeb(d, map->map_priv_1 + adr);
-	mb();
-}
-
-static void scx200_docflash_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	__raw_writew(d, map->map_priv_1 + adr);
-	mb();
-}
-
-static void scx200_docflash_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio(map->map_priv_1 + to, from, len);
-}
 
 static struct map_info scx200_docflash_map = {
 	.name      = "NatSemi SCx200 DOCCS Flash",
-	.read8     = scx200_docflash_read8,
-	.read16    = scx200_docflash_read16,
-	.copy_from = scx200_docflash_copy_from,
-	.write8    = scx200_docflash_write8,
-	.write16   = scx200_docflash_write16,
-	.copy_to   = scx200_docflash_copy_to
 };
 
 int __init init_scx200_docflash(void)
@@ -213,8 +176,11 @@
 	else
 		scx200_docflash_map.buswidth = 2;
 
-	scx200_docflash_map.map_priv_1 = (unsigned long)ioremap(docmem.start, scx200_docflash_map.size);
-	if (!scx200_docflash_map.map_priv_1) {
+	simple_map_init(&scx200_docflash_map);
+
+	scx200_docflash_map.phys = docmem.start;
+	scx200_docflash_map.virt = (unsigned long)ioremap(docmem.start, scx200_docflash_map.size);
+	if (!scx200_docflash_map.virt) {
 		printk(KERN_ERR NAME ": failed to ioremap the flash\n");
 		release_resource(&docmem);
 		return -EIO;
@@ -223,7 +189,7 @@
 	mymtd = do_map_probe(flashtype, &scx200_docflash_map);
 	if (!mymtd) {
 		printk(KERN_ERR NAME ": unable to detect flash\n");
-		iounmap((void *)scx200_docflash_map.map_priv_1);
+		iounmap((void *)scx200_docflash_map.virt);
 		release_resource(&docmem);
 		return -ENXIO;
 	}
@@ -253,8 +219,8 @@
 #endif
 		map_destroy(mymtd);
 	}
-	if (scx200_docflash_map.map_priv_1) {
-		iounmap((void *)scx200_docflash_map.map_priv_1);
+	if (scx200_docflash_map.virt) {
+		iounmap((void *)scx200_docflash_map.virt);
 		release_resource(&docmem);
 	}
 }

Index: solutionengine.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/solutionengine.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- solutionengine.c	17 Feb 2003 21:49:10 -0000	1.5
+++ solutionengine.c	14 May 2003 15:05:16 -0000	1.6
@@ -18,58 +18,37 @@
 #include <linux/config.h>
 
 
-__u32 soleng_read32(struct map_info *map, unsigned long ofs)
-{
-	return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void soleng_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	__raw_writel(d, map->map_priv_1 + adr);
-	mb();
-}
-
-void soleng_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-
 static struct mtd_info *flash_mtd;
 static struct mtd_info *eprom_mtd;
 
 static struct mtd_partition *parsed_parts;
 
 struct map_info soleng_eprom_map = {
-	name: "Solution Engine EPROM",
-	size: 0x400000,
-	buswidth: 4,
-	copy_from: soleng_copy_from,
+	.name = "Solution Engine EPROM",
+	.size = 0x400000,
+	.buswidth = 4,
 };
 
 struct map_info soleng_flash_map = {
-	name: "Solution Engine FLASH",
-	size: 0x400000,
-	buswidth: 4,
-	read32: soleng_read32,
-	copy_from: soleng_copy_from,
-	write32: soleng_write32,
+	.name = "Solution Engine FLASH",
+	.size = 0x400000,
+	.buswidth = 4,
 };
 
 #ifdef CONFIG_MTD_SUPERH_RESERVE
 static struct mtd_partition superh_se_partitions[] = {
 	/* Reserved for boot code, read-only */
 	{
-		name: "flash_boot",
-		offset: 0x00000000,
-		size: CONFIG_MTD_SUPERH_RESERVE,
-		mask_flags: MTD_WRITEABLE,
+		.name = "flash_boot",
+		.offset = 0x00000000,
+		.size = CONFIG_MTD_SUPERH_RESERVE,
+		.mask_flags = MTD_WRITEABLE,
 	},
 	/* All else is writable (e.g. JFFS) */
 	{
-		name: "Flash FS",
-		offset: MTDPART_OFS_NXTBLK,
-		size: MTDPART_SIZ_FULL,
+		.name = "Flash FS",
+		.offset = MTDPART_OFS_NXTBLK,
+		.size = MTDPART_SIZ_FULL,
 	}
 };
 #endif /* CONFIG_MTD_SUPERH_RESERVE */
@@ -79,16 +58,22 @@
 	int nr_parts = 0;
 
 	/* First probe at offset 0 */
-	soleng_flash_map.map_priv_1 = P2SEGADDR(0);
-	soleng_eprom_map.map_priv_1 = P1SEGADDR(0x01000000);
-
+	soleng_flash_map.phys = 0;
+	soleng_flash_map.virt = P2SEGADDR(0);
+	soleng_eprom_map.phys = 0x01000000;
+	soleng_eprom_map.virt = P1SEGADDR(0x01000000);
+	simple_map_init(&soleng_eprom_map);
+	simple_map_init(&soleng_flash_map);
+	
 	printk(KERN_NOTICE "Probing for flash chips at 0x00000000:\n");
 	flash_mtd = do_map_probe("cfi_probe", &soleng_flash_map);
 	if (!flash_mtd) {
 		/* Not there. Try swapping */
 		printk(KERN_NOTICE "Probing for flash chips at 0x01000000:\n");
-		soleng_flash_map.map_priv_1 = P2SEGADDR(0x01000000);
-		soleng_eprom_map.map_priv_1 = P1SEGADDR(0);
+		soleng_flash_map.phys = 0x01000000;
+		soleng_flash_map.virt = P2SEGADDR(0x01000000);
+		soleng_eprom_map.phys = 0;
+		soleng_eprom_map.virt = P1SEGADDR(0);
 		flash_mtd = do_map_probe("cfi_probe", &soleng_flash_map);
 		if (!flash_mtd) {
 			/* Eep. */
@@ -97,8 +82,8 @@
 		}
 	}
 	printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n",
-	       soleng_flash_map.map_priv_1 & 0x1fffffff,
-	       soleng_eprom_map.map_priv_1 & 0x1fffffff);
+	       soleng_flash_map.phys & 0x1fffffff,
+	       soleng_eprom_map.phys & 0x1fffffff);
 	flash_mtd->module = THIS_MODULE;
 
 	eprom_mtd = do_map_probe("map_rom", &soleng_eprom_map);

Index: sun_uflash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sun_uflash.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- sun_uflash.c	2 Oct 2001 15:05:14 -0000	1.4
+++ sun_uflash.c	14 May 2003 15:05:16 -0000	1.5
@@ -48,60 +48,11 @@
 	struct list_head	list;
 };
 
-__u8 uflash_read8(struct map_info *map, unsigned long ofs)
-{
-	return(__raw_readb(map->map_priv_1 + ofs));
-}
-
-__u16 uflash_read16(struct map_info *map, unsigned long ofs)
-{
-	return(__raw_readw(map->map_priv_1 + ofs));
-}
-
-__u32 uflash_read32(struct map_info *map, unsigned long ofs)
-{
-	return(__raw_readl(map->map_priv_1 + ofs));
-}
-
-void uflash_copy_from(struct map_info *map, void *to, unsigned long from, 
-		      ssize_t len)
-{
-	memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void uflash_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	__raw_writeb(d, map->map_priv_1 + adr);
-}
-
-void uflash_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	__raw_writew(d, map->map_priv_1 + adr);
-}
-
-void uflash_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	__raw_writel(d, map->map_priv_1 + adr);
-}
-
-void uflash_copy_to(struct map_info *map, unsigned long to, const void *from,
-		    ssize_t len)
-{
-	memcpy_toio(map->map_priv_1 + to, from, len);
-}
 
 struct map_info uflash_map_templ = {
-		name:		"SUNW,???-????",
-		size:		UFLASH_WINDOW_SIZE,
-		buswidth:	UFLASH_BUSWIDTH,
-		read8:		uflash_read8,
-		read16:		uflash_read16,
-		read32:		uflash_read32,
-		copy_from:	uflash_copy_from,
-		write8:		uflash_write8,
-		write16:	uflash_write16,
-		write32:	uflash_write32,
-		copy_to:	uflash_copy_to
+		.name =		"SUNW,???-????",
+		.size =		UFLASH_WINDOW_SIZE,
+		.buswidth =	UFLASH_BUSWIDTH,
 };
 
 int uflash_devinit(struct linux_ebus_device* edev)
@@ -145,20 +96,22 @@
 	if(0 != pdev->name && 0 < strlen(pdev->name)) {
 		pdev->map.name = pdev->name;
 	}
-
-	pdev->map.map_priv_1 = 
+	pdev->phys = edev->resource[0].start;
+	pdev->virt = 
 		(unsigned long)ioremap_nocache(edev->resource[0].start, pdev->map.size);
-	if(0 == pdev->map.map_priv_1) {
+	if(0 == pdev->map.virt) {
 		printk("%s: failed to map device\n", __FUNCTION__);
 		kfree(pdev->name);
 		kfree(pdev);
 		return(-1);
 	}
 
+	simple_map_init(&pdev->map);
+
 	/* MTD registration */
 	pdev->mtd = do_map_probe("cfi_probe", &pdev->map);
 	if(0 == pdev->mtd) {
-		iounmap((void *)pdev->map.map_priv_1);
+		iounmap((void *)pdev->map.virt);
 		kfree(pdev->name);
 		kfree(pdev);
 		return(-ENXIO);
@@ -211,9 +164,9 @@
 			del_mtd_device(udev->mtd);
 			map_destroy(udev->mtd);
 		}
-		if(0 != udev->map.map_priv_1) {
-			iounmap((void*)udev->map.map_priv_1);
-			udev->map.map_priv_1 = 0;
+		if(0 != udev->map.virt) {
+			iounmap((void*)udev->map.virt);
+			udev->map.virt = 0;
 		}
 		if(0 != udev->name) {
 			kfree(udev->name);

Index: tqm8xxl.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/tqm8xxl.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- tqm8xxl.c	20 Jun 2002 13:41:20 -0000	1.4
+++ tqm8xxl.c	14 May 2003 15:05:16 -0000	1.5
@@ -51,46 +51,6 @@
 static unsigned long num_banks;
 static unsigned long start_scan_addr;
 
-__u8 tqm8xxl_read8(struct map_info *map, unsigned long ofs)
-{
-	return *((__u8 *)(map->map_priv_1 + ofs));
-}
-
-__u16 tqm8xxl_read16(struct map_info *map, unsigned long ofs)
-{
-	return *((__u16 *)(map->map_priv_1 + ofs));
-}
-
-__u32 tqm8xxl_read32(struct map_info *map, unsigned long ofs)
-{
-	return *((__u32 *)(map->map_priv_1 + ofs));
-}
-
-void tqm8xxl_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy_fromio(to, (void *)(map->map_priv_1 + from), len);
-}
-
-void tqm8xxl_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	*((__u8 *)(map->map_priv_1 + adr)) = d;
-}
-
-void tqm8xxl_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	*((__u16 *)( map->map_priv_1 + adr)) = d;
-}
-
-void tqm8xxl_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	*((__u32 *)(map->map_priv_1 + adr)) = d;
-}
-
-void tqm8xxl_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy_toio((void *)(map->map_priv_1 + to), from, len);
-}
-
 /*
  * Here are partition information for all known TQM8xxL series devices.
  * See include/linux/mtd/partitions.h for definition of the mtd_partition
@@ -107,44 +67,44 @@
 static unsigned long tqm8xxl_max_flash_size = 0x00800000;
 
 /* partition definition for first flash bank
- * also ref. to "drivers\char\flash_config.c" 
+ * (cf. "drivers/char/flash_config.c")
  */
 static struct mtd_partition tqm8xxl_partitions[] = {
 	{
-	  name: "ppcboot",
-	  offset: 0x00000000,
-	  size: 0x00020000,           /* 128KB           */
-	  mask_flags: MTD_WRITEABLE,  /* force read-only */
+	  .name = "ppcboot",
+	  .offset = 0x00000000,
+	  .size = 0x00020000,           /* 128KB           */
+	  .mask_flags = MTD_WRITEABLE,  /* force read-only */
 	},
 	{
-	  name: "kernel",             /* default kernel image */
-	  offset: 0x00020000,
-	  size: 0x000e0000,
-	  mask_flags: MTD_WRITEABLE,  /* force read-only */
+	  .name = "kernel",             /* default kernel image */
+	  .offset = 0x00020000,
+	  .size = 0x000e0000,
+	  .mask_flags = MTD_WRITEABLE,  /* force read-only */
 	},
 	{
-	  name: "user",
-	  offset: 0x00100000,
-	  size: 0x00100000,
+	  .name = "user",
+	  .offset = 0x00100000,
+	  .size = 0x00100000,
 	},
 	{
-	  name: "initrd",
-	  offset: 0x00200000,
-	  size: 0x00200000,
+	  .name = "initrd",
+	  .offset = 0x00200000,
+	  .size = 0x00200000,
 	}
 };
-/* partition definition for second flahs bank */
+/* partition definition for second flash bank */
 static struct mtd_partition tqm8xxl_fs_partitions[] = {
 	{
-	  name: "cramfs",
-	  offset: 0x00000000,
-	  size: 0x00200000,
+	  .name = "cramfs",
+	  .offset = 0x00000000,
+	  .size = 0x00200000,
 	},
 	{
-	  name: "jffs",
-	  offset: 0x00200000,
-	  size: 0x00200000,
-	  //size: MTDPART_SIZ_FULL,
+	  .name = "jffs",
+	  .offset = 0x00200000,
+	  .size = 0x00200000,
+	  .//size = MTDPART_SIZ_FULL,
 	}
 };
 #endif
@@ -160,67 +120,73 @@
 
 	flash_addr = bd->bi_flashstart;
 	flash_size = bd->bi_flashsize;
-	//request maximum flash size address spzce
+
+	//request maximum flash size address space
 	start_scan_addr = (unsigned long)ioremap(flash_addr, flash_size);
 	if (!start_scan_addr) {
-		//printk("%s:Failed to ioremap address:0x%x\n", __FUNCTION__, FLASH_ADDR);
-		printk("%s:Failed to ioremap address:0x%x\n", __FUNCTION__, flash_addr);
+		printk(KERN_WARNING "%s:Failed to ioremap address:0x%x\n", __FUNCTION__, flash_addr);
 		return -EIO;
 	}
-	for(idx = 0 ; idx < FLASH_BANK_MAX ; idx++)
-	{
+
+	for (idx = 0 ; idx < FLASH_BANK_MAX ; idx++) {
 		if(mtd_size >= flash_size)
 			break;
 		
-		printk("%s: chip probing count %d\n", __FUNCTION__, idx);
+		printk(KERN_INFO "%s: chip probing count %d\n", __FUNCTION__, idx);
 		
 		map_banks[idx] = (struct map_info *)kmalloc(sizeof(struct map_info), GFP_KERNEL);
-		if(map_banks[idx] == NULL)
-		{
-			//return -ENOMEM;
+		if(map_banks[idx] == NULL) {
 			ret = -ENOMEM;
+			/* FIXME: What if some MTD devices were probed already? */
 			goto error_mem;
 		}
+
 		memset((void *)map_banks[idx], 0, sizeof(struct map_info));
 		map_banks[idx]->name = (char *)kmalloc(16, GFP_KERNEL);
-		if(map_banks[idx]->name == NULL)
-		{
-			//return -ENOMEM;
+
+		if (!map_banks[idx]->name) {
 			ret = -ENOMEM;
+			/* FIXME: What if some MTD devices were probed already? */
 			goto error_mem;
 		}
-		memset((void *)map_banks[idx]->name, 0, 16);
-
 		sprintf(map_banks[idx]->name, "TQM8xxL%d", idx);
+
 		map_banks[idx]->size = flash_size;
 		map_banks[idx]->buswidth = 4;
-		map_banks[idx]->read8 = tqm8xxl_read8;
-		map_banks[idx]->read16 = tqm8xxl_read16;
-		map_banks[idx]->read32 = tqm8xxl_read32;
-		map_banks[idx]->copy_from = tqm8xxl_copy_from;
-		map_banks[idx]->write8 = tqm8xxl_write8;
-		map_banks[idx]->write16 = tqm8xxl_write16;
-		map_banks[idx]->write32 = tqm8xxl_write32;
-		map_banks[idx]->copy_to = tqm8xxl_copy_to;
-		map_banks[idx]->map_priv_1 = 
-		start_scan_addr + ((idx > 0) ? 
+
+		simple_map_init(map_banks[idx]);
+
+		map_banks[idx]->virt = start_scan_addr;
+		map_banks[idx]->phys = flash_addr;
+		/* FIXME: This looks utterly bogus, but I'm trying to
+		   preserve the behaviour of the original (shown here)...
+
+		map_banks[idx]->map_priv_1 =
+		start_scan_addr + ((idx > 0) ?
 		(mtd_banks[idx-1] ? mtd_banks[idx-1]->size : 0) : 0);
+		*/
+
+		if (idx && mtd_banks[idx-1]) {
+			map_banks[idx]->virt += mtd_banks[idx-1]->size;
+			map_banks[idx]->phys += mtd_banks[idx-1]->size;
+		}
+
 		//start to probe flash chips
 		mtd_banks[idx] = do_map_probe("cfi_probe", map_banks[idx]);
-		if(mtd_banks[idx])
-		{
+
+		if (mtd_banks[idx]) {
 			mtd_banks[idx]->module = THIS_MODULE;
 			mtd_size += mtd_banks[idx]->size;
 			num_banks++;
-			printk("%s: bank%d, name:%s, size:%dbytes \n", __FUNCTION__, num_banks, 
+
+			printk(KERN_INFO "%s: bank%d, name:%s, size:%dbytes \n", __FUNCTION__, num_banks, 
 			mtd_banks[idx]->name, mtd_banks[idx]->size);
 		}
 	}
 
 	/* no supported flash chips found */
-	if(!num_banks)
-	{
-		printk("TQM8xxL: No support flash chips found!\n");
+	if (!num_banks) {
+		printk(KERN_NOTICE "TQM8xxL: No support flash chips found!\n");
 		ret = -ENXIO;
 		goto error_mem;
 	}
@@ -232,11 +198,12 @@
 	part_banks[0].mtd_part = tqm8xxl_partitions;
 	part_banks[0].type = "Static image";
 	part_banks[0].nums = NB_OF(tqm8xxl_partitions);
+
 	part_banks[1].mtd_part = tqm8xxl_fs_partitions;
 	part_banks[1].type = "Static file system";
 	part_banks[1].nums = NB_OF(tqm8xxl_fs_partitions);
-	for(idx = 0; idx < num_banks ; idx++)
-	{
+
+	for(idx = 0; idx < num_banks ; idx++) {
 		if (part_banks[idx].nums == 0) {
 			printk(KERN_NOTICE "TQM flash%d: no partition info available, registering whole flash at once\n", idx);
 			add_mtd_device(mtd_banks[idx]);
@@ -254,12 +221,9 @@
 #endif
 	return 0;
 error_mem:
-	for(idx = 0 ; idx < FLASH_BANK_MAX ; idx++)
-	{
-		if(map_banks[idx] != NULL)
-		{
-			if(map_banks[idx]->name != NULL)
-			{
+	for(idx = 0 ; idx < FLASH_BANK_MAX ; idx++) {
+		if(map_banks[idx] != NULL) {
+			if(map_banks[idx]->name != NULL) {
 				kfree(map_banks[idx]->name);
 				map_banks[idx]->name = NULL;
 			}
@@ -267,18 +231,15 @@
 			map_banks[idx] = NULL;
 		}
 	}
-	//return -ENOMEM;
 error:
 	iounmap((void *)start_scan_addr);
-	//return -ENXIO;
 	return ret;
 }
 
 static void __exit cleanup_tqm_mtd(void)
 {
 	unsigned int idx = 0;
-	for(idx = 0 ; idx < num_banks ; idx++)
-	{
+	for(idx = 0 ; idx < num_banks ; idx++) {
 		/* destroy mtd_info previously allocated */
 		if (mtd_banks[idx]) {
 			del_mtd_partitions(mtd_banks[idx]);
@@ -288,6 +249,7 @@
 		kfree(map_banks[idx]->name);
 		kfree(map_banks[idx]);
 	}
+
 	if (start_scan_addr) {
 		iounmap((void *)start_scan_addr);
 		start_scan_addr = 0;

Index: tsunami_flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/tsunami_flash.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- tsunami_flash.c	10 Jan 2002 22:59:13 -0000	1.1
+++ tsunami_flash.c	14 May 2003 15:05:16 -0000	1.2
@@ -58,18 +58,12 @@
 static struct map_info tsunami_flash_map = {
 	.name = "flash chip on the Tsunami TIG bus",
 	.size = MAX_TIG_FLASH_SIZE,
+	.phys = NO_XIP;
 	.buswidth = 1,
 	.read8 = tsunami_flash_read8,
-	.read16 = 0,
-	.read32 = 0, 
 	.copy_from = tsunami_flash_copy_from,
 	.write8 = tsunami_flash_write8,
-	.write16 = 0,
-	.write32 = 0,
 	.copy_to = tsunami_flash_copy_to,
-	.set_vpp = 0,
-	.map_priv_1 = 0,
-
 };
 
 static struct mtd_info *tsunami_flash_mtd;

Index: uclinux.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/uclinux.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- uclinux.c	7 Aug 2002 00:43:45 -0000	1.2
+++ uclinux.c	14 May 2003 15:05:16 -0000	1.3
@@ -24,58 +24,11 @@
 
 /****************************************************************************/
 
-__u8 uclinux_read8(struct map_info *map, unsigned long ofs)
-{
-	return(*((__u8 *) (map->map_priv_1 + ofs)));
-}
-
-__u16 uclinux_read16(struct map_info *map, unsigned long ofs)
-{
-	return(*((__u16 *) (map->map_priv_1 + ofs)));
-}
-
-__u32 uclinux_read32(struct map_info *map, unsigned long ofs)
-{
-	return(*((__u32 *) (map->map_priv_1 + ofs)));
-}
-
-void uclinux_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
-	memcpy(to, (void *)(map->map_priv_1 + from), len);
-}
-
-void uclinux_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
-	*((__u8 *) (map->map_priv_1 + adr)) = d;
-}
-
-void uclinux_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
-	*((__u16 *) (map->map_priv_1 + adr)) = d;
-}
-
-void uclinux_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
-	*((__u32 *) (map->map_priv_1 + adr)) = d;
-}
-
-void uclinux_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
-	memcpy((void *) (map->map_priv_1 + to), from, len);
-}
 
 /****************************************************************************/
 
 struct map_info uclinux_ram_map = {
-	name:		"RAM",
-	read8:		uclinux_read8,
-	read16:		uclinux_read16,
-	read32:		uclinux_read32,
-	copy_from:	uclinux_copy_from,
-	write8:		uclinux_write8,
-	write16:	uclinux_write16,
-	write32:	uclinux_write32,
-	copy_to:	uclinux_copy_to,
+	.name = "RAM",
 };
 
 struct mtd_info *uclinux_ram_mtdinfo;
@@ -83,7 +36,7 @@
 /****************************************************************************/
 
 struct mtd_partition uclinux_romfs[] = {
-	{ name: "ROMfs", offset: 0 }
+	{ .name = "ROMfs" }
 };
 
 #define	NUM_PARTITIONS	(sizeof(uclinux_romfs) / sizeof(uclinux_romfs[0]))
@@ -94,7 +47,7 @@
 	size_t *retlen, u_char **mtdbuf)
 {
 	struct map_info *map = (struct map_info *) mtd->priv;
-	*mtdbuf = (u_char *) (map->map_priv_1 + ((int) from));
+	*mtdbuf = (u_char *) (map->virt + ((int) from));
 	*retlen = len;
 	return(0);
 }
@@ -108,25 +61,27 @@
 	extern char _ebss;
 
 	mapp = &uclinux_ram_map;
-	mapp->map_priv_2 = (unsigned long) &_ebss;
+	mapp->phys = (unsigned long) &_ebss;
 	mapp->size = PAGE_ALIGN(*((unsigned long *)((&_ebss) + 8)));
 	mapp->buswidth = 4;
 
 	printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n",
 	       	(int) mapp->map_priv_2, (int) mapp->size);
 
-	mapp->map_priv_1 = (unsigned long)
-		ioremap_nocache(mapp->map_priv_2, mapp->size);
+	mapp->virt = (unsigned long)
+		ioremap_nocache(mapp->phys, mapp->size);
 
-	if (mapp->map_priv_1 == 0) {
+	if (mapp->virt == 0) {
 		printk("uclinux[mtd]: ioremap_nocache() failed\n");
 		return(-EIO);
 	}
 
+	simple_map_init(mapp);
+
 	mtd = do_map_probe("map_ram", mapp);
 	if (!mtd) {
 		printk("uclinux[mtd]: failed to find a mapping?\n");
-		iounmap((void *) mapp->map_priv_1);
+		iounmap((void *) mapp->virt);
 		return(-ENXIO);
 	}
 		
@@ -155,8 +110,8 @@
 		uclinux_ram_mtdinfo = NULL;
 	}
 	if (uclinux_ram_map.map_priv_1) {
-		iounmap((void *) uclinux_ram_map.map_priv_1);
-		uclinux_ram_map.map_priv_1 = 0;
+		iounmap((void *) uclinux_ram_map.virt);
+		uclinux_ram_map.virt = 0;
 	}
 }
 

Index: vmax301.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/vmax301.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- vmax301.c	2 Oct 2001 15:05:14 -0000	1.24
+++ vmax301.c	14 May 2003 15:05:16 -0000	1.25
@@ -142,34 +142,36 @@
 
 static struct map_info vmax_map[2] = {
 	{
-		name: "VMAX301 Internal Flash",
-		size: 3*2*1024*1024,
-		buswidth: 1,
-		read8: vmax301_read8,
-		read16: vmax301_read16,
-		read32: vmax301_read32,
-		copy_from: vmax301_copy_from,
-		write8: vmax301_write8,
-		write16: vmax301_write16,
-		write32: vmax301_write32,
-		copy_to: vmax301_copy_to,
-		map_priv_1: WINDOW_START + WINDOW_LENGTH,
-		map_priv_2: 0xFFFFFFFF
+		.name = "VMAX301 Internal Flash",
+		.phys = NO_XIP,
+		.size = 3*2*1024*1024,
+		.buswidth = 1,
+		.read8 = vmax301_read8,
+		.read16 = vmax301_read16,
+		.read32 = vmax301_read32,
+		.copy_from = vmax301_copy_from,
+		.write8 = vmax301_write8,
+		.write16 = vmax301_write16,
+		.write32 = vmax301_write32,
+		.copy_to = vmax301_copy_to,
+		.map_priv_1 = WINDOW_START + WINDOW_LENGTH,
+		.map_priv_2 = 0xFFFFFFFF
 	},
 	{
-		name: "VMAX301 Socket",
-		size: 0,
-		buswidth: 1,
-		read8: vmax301_read8,
-		read16: vmax301_read16,
-		read32: vmax301_read32,
-		copy_from: vmax301_copy_from,
-		write8: vmax301_write8,
-		write16: vmax301_write16,
-		write32: vmax301_write32,
-		copy_to: vmax301_copy_to,
-		map_priv_1: WINDOW_START + (3*WINDOW_LENGTH),
-		map_priv_2: 0xFFFFFFFF
+		.name = "VMAX301 Socket",
+		.phys = NO_XIP,
+		.size = 0,
+		.buswidth = 1,
+		.read8 = vmax301_read8,
+		.read16 = vmax301_read16,
+		.read32 = vmax301_read32,
+		.copy_from = vmax301_copy_from,
+		.write8 = vmax301_write8,
+		.write16 = vmax301_write16,
+		.write32 = vmax301_write32,
+		.copy_to = vmax301_copy_to,
+		.map_priv_1 = WINDOW_START + (3*WINDOW_LENGTH),
+		.map_priv_2 = 0xFFFFFFFF
 	}
 };
 
@@ -206,8 +208,8 @@
 	   address of the first half, because it's used more
 	   often. 
 	*/
-	vmax_map[0].map_priv_1 = iomapadr + WINDOW_START;
-	vmax_map[1].map_priv_1 = iomapadr + (3*WINDOW_START);
+	vmax_map[0].map_priv_2 = iomapadr + WINDOW_START;
+	vmax_map[1].map_priv_2 = iomapadr + (3*WINDOW_START);
 	
 	for (i=0; i<2; i++) {
 		vmax_mtd[i] = do_map_probe("cfi_probe", &vmax_map[i]);

--- physmap64.c DELETED ---


From dwmw2 at infradead.org  Wed May 14 16:26:32 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:14 2006
Subject: mtd/fs/jffs2 Makefile,1.36,1.37 GNUmakefile,1.6,1.7
Message-ID: <E19G2pc-0002Gl-00@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv8721

Modified Files:
	Makefile GNUmakefile 
Log Message:
Move Rules.make

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/Makefile,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- Makefile	27 Nov 2002 10:45:09 -0000	1.36
+++ Makefile	14 May 2003 20:26:30 -0000	1.37
@@ -37,5 +37,3 @@
 O_TARGET := jffs2.o
 endif
 
-include $(TOPDIR)/Rules.make
-

Index: GNUmakefile
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/GNUmakefile,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- GNUmakefile	3 Sep 2002 16:38:24 -0000	1.6
+++ GNUmakefile	14 May 2003 20:26:30 -0000	1.7
@@ -44,6 +44,6 @@
 
 
 include Makefile
-
+-include $(TOPDIR)/Rules.make
 
 endif


From dwmw2 at infradead.org  Wed May 14 18:26:35 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:14 2006
Subject: mtd/drivers/mtd/nand nand.c,1.43,1.44
Message-ID: <E19G4hn-0003iZ-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv14262/drivers/mtd/nand

Modified Files:
	nand.c 
Log Message:
fix races in get_mtd_device etc, use set_module_owner everywhere

Index: nand.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- nand.c	14 Apr 2003 07:00:39 -0000	1.43
+++ nand.c	14 May 2003 22:26:32 -0000	1.44
@@ -1352,7 +1352,6 @@
 	/* Fill in remaining MTD driver data */
 	mtd->type = MTD_NANDFLASH;
 	mtd->flags = MTD_CAP_NANDFLASH | MTD_ECC;
-	mtd->module = THIS_MODULE;
 	mtd->ecctype = MTD_ECC_SW;
 	mtd->erase = nand_erase;
 	mtd->point = NULL;
@@ -1371,6 +1370,7 @@
 	mtd->unlock = NULL;
 	mtd->suspend = NULL;
 	mtd->resume = NULL;
+	set_module_owner(mtd);
 
 	/* Return happy */
 	return 0;


From dwmw2 at infradead.org  Wed May 14 18:27:00 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:14 2006
Subject: mtd/drivers/mtd mtdcore.c,1.34,1.35 mtdpart.c,1.34,1.35
Message-ID: <E19G4hi-0003iG-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv14262/drivers/mtd

Modified Files:
	mtdcore.c mtdpart.c 
Log Message:
fix races in get_mtd_device etc, use set_module_owner everywhere

Index: mtdcore.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdcore.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- mtdcore.c	24 Jan 2003 23:32:25 -0000	1.34
+++ mtdcore.c	14 May 2003 22:26:27 -0000	1.35
@@ -26,7 +26,7 @@
 
 static DECLARE_MUTEX(mtd_table_mutex);
 static struct mtd_info *mtd_table[MAX_MTD_DEVICES];
-static struct mtd_notifier *mtd_notifiers = NULL;
+static LIST_HEAD(mtd_notifiers);
 
 /**
  *	add_mtd_device - register an MTD device
@@ -44,21 +44,28 @@
 
 	down(&mtd_table_mutex);
 
-	for (i=0; i< MAX_MTD_DEVICES; i++)
-		if (!mtd_table[i])
-		{
-			struct mtd_notifier *not=mtd_notifiers;
+	for (i=0; i < MAX_MTD_DEVICES; i++)
+		if (!mtd_table[i]) {
+			struct list_head *this;
 
 			mtd_table[i] = mtd;
 			mtd->index = i;
+			mtd->usecount = 0;
+
 			DEBUG(0, "mtd: Giving out device %d to %s\n",i, mtd->name);
-			while (not)
-			{
-				(*(not->add))(mtd);
-				not = not->next;
+			/* No need to get a refcount on the module containing
+			   the notifier, since we hold the mtd_table_mutex */
+			list_for_each(this, &mtd_notifiers) {
+				struct mtd_notifier *not = list_entry(this, struct mtd_notifier, list);
+				not->add(mtd);
 			}
+			
 			up(&mtd_table_mutex);
-			MOD_INC_USE_COUNT;
+			/* We _know_ we aren't being removed, because
+			   our caller is still holding us here. So none
+			   of this try_ nonsense, and no bitching about it
+			   either. :) */
+			__module_get(THIS_MODULE);
 			return 0;
 		}
 	
@@ -78,29 +85,34 @@
 
 int del_mtd_device (struct mtd_info *mtd)
 {
-	struct mtd_notifier *not=mtd_notifiers;
-	int i;
+	int ret;
 	
 	down(&mtd_table_mutex);
 
-	for (i=0; i < MAX_MTD_DEVICES; i++)
-	{
-		if (mtd_table[i] == mtd)
-		{
-			while (not)
-			{
-				(*(not->remove))(mtd);
-				not = not->next;
-			}
-			mtd_table[i] = NULL;
-			up (&mtd_table_mutex);
-			MOD_DEC_USE_COUNT;
-			return 0;
+	if (mtd_table[mtd->index] != mtd) {
+		ret = -ENODEV;
+	} else if (mtd->usecount) {
+		printk(KERN_NOTICE "Removing MTD device #%d (%s) with use count %d\n", 
+		       mtd->index, mtd->name, mtd->usecount);
+		ret = -EBUSY;
+	} else {
+		struct list_head *this;
+
+		/* No need to get a refcount on the module containing
+		   the notifier, since we hold the mtd_table_mutex */
+		list_for_each(this, &mtd_notifiers) {
+			struct mtd_notifier *not = list_entry(this, struct mtd_notifier, list);
+			not->remove(mtd);
 		}
+
+		mtd_table[mtd->index] = NULL;
+
+		module_put(THIS_MODULE);
+		ret = 0;
 	}
 
 	up(&mtd_table_mutex);
-	return 1;
+	return ret;
 }
 
 /**
@@ -118,10 +130,9 @@
 
 	down(&mtd_table_mutex);
 
-	new->next = mtd_notifiers;
-	mtd_notifiers = new;
+	list_add(&mtd_notifiers, &new->list);
 
- 	MOD_INC_USE_COUNT;
+ 	__module_get(THIS_MODULE);
 	
 	for (i=0; i< MAX_MTD_DEVICES; i++)
 		if (mtd_table[i])
@@ -142,34 +153,24 @@
 
 int unregister_mtd_user (struct mtd_notifier *old)
 {
-	struct mtd_notifier **prev = &mtd_notifiers;
-	struct mtd_notifier *cur;
 	int i;
 
 	down(&mtd_table_mutex);
 
-	while ((cur = *prev)) {
-		if (cur == old) {
-			*prev = cur->next;
-
-			MOD_DEC_USE_COUNT;
-
-			for (i=0; i< MAX_MTD_DEVICES; i++)
-				if (mtd_table[i])
-					old->remove(mtd_table[i]);
+	module_put(THIS_MODULE);
+
+	for (i=0; i< MAX_MTD_DEVICES; i++)
+		if (mtd_table[i])
+			old->remove(mtd_table[i]);
 			
-			up(&mtd_table_mutex);
-			return 0;
-		}
-		prev = &cur->next;
-	}
+	list_del(&old->list);
 	up(&mtd_table_mutex);
-	return 1;
+	return 0;
 }
 
 
 /**
- *	__get_mtd_device - obtain a validated handle for an MTD device
+ *	___get_mtd_device - obtain a validated handle for an MTD device
  *	@mtd: last known address of the required MTD device
  *	@num: internal device number of the required MTD device
  *
@@ -181,7 +182,7 @@
  *	__get_mtd_device() doesn't - you should generally use get_mtd_device().
  */
 	
-struct mtd_info *__get_mtd_device(struct mtd_info *mtd, int num)
+struct mtd_info *___get_mtd_device(struct mtd_info *mtd, int num, int count)
 {
 	struct mtd_info *ret = NULL;
 	int i;
@@ -197,11 +198,28 @@
 		if (mtd && mtd != ret)
 			ret = NULL;
 	}
+	if (count) {
+		if (ret && !try_module_get(ret->owner))
+			ret = NULL;
 	
+		if (ret)
+			ret->usecount++;
+	}
 	up(&mtd_table_mutex);
 	return ret;
 }
 
+void put_mtd_device(struct mtd_info *mtd)
+{
+	int c;
+
+	down(&mtd_table_mutex);
+	c = --mtd->usecount;
+	up(&mtd_table_mutex);
+	BUG_ON(c < 0);
+
+	module_put(mtd->owner);
+}
 
 /* default_mtd_writev - default mtd writev method for MTD devices that
  *			dont implement their own
@@ -265,7 +283,8 @@
 
 EXPORT_SYMBOL(add_mtd_device);
 EXPORT_SYMBOL(del_mtd_device);
-EXPORT_SYMBOL(__get_mtd_device);
+EXPORT_SYMBOL(___get_mtd_device);
+EXPORT_SYMBOL(put_mtd_device);
 EXPORT_SYMBOL(register_mtd_user);
 EXPORT_SYMBOL(unregister_mtd_user);
 EXPORT_SYMBOL(default_mtd_writev);

Index: mtdpart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdpart.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- mtdpart.c	18 Feb 2003 20:53:53 -0000	1.34
+++ mtdpart.c	14 May 2003 22:26:27 -0000	1.35
@@ -348,7 +348,7 @@
 
 		slave->mtd.name = parts[i].name;
 		slave->mtd.bank_size = master->bank_size;
-		slave->mtd.module = master->module;
+		slave->mtd.owner = master->owner;
 
 		slave->mtd.read = part_read;
 		slave->mtd.write = part_write;


From dwmw2 at infradead.org  Wed May 14 18:27:02 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:14 2006
Subject: mtd/drivers/mtd/devices blkmtd-25.c,1.2,1.3 blkmtd.c,1.17,1.18
 doc2000.c,1.50,1.51 doc2001.c,1.38,1.39 lart.c,1.3,1.4
 ms02-nv.c,1.2,1.3 mtdram.c,1.29,1.30 pmc551.c,1.22,1.23slram.c,1.28,1.29
Message-ID: <E19G4hj-0003iJ-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/devices
In directory phoenix.infradead.org:/tmp/cvs-serv14262/drivers/mtd/devices

Modified Files:
	blkmtd-25.c blkmtd.c doc2000.c doc2001.c lart.c ms02-nv.c 
	mtdram.c pmc551.c slram.c 
Log Message:
fix races in get_mtd_device etc, use set_module_owner everywhere

Index: blkmtd-25.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/blkmtd-25.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- blkmtd-25.c	24 Jan 2003 13:00:24 -0000	1.2
+++ blkmtd-25.c	14 May 2003 22:26:27 -0000	1.3
@@ -731,7 +731,7 @@
 	}
 	dev->mtd_info.read = blkmtd_read;
 	dev->mtd_info.priv = dev;
-	dev->mtd_info.module = THIS_MODULE;
+	set_module_owner(&dev->mtd_info);
 
 	list_add(&dev->list, &blkmtd_device_list);
 	if (add_mtd_device(&dev->mtd_info)) {

Index: blkmtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/blkmtd.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- blkmtd.c	24 Jan 2003 13:00:24 -0000	1.17
+++ blkmtd.c	14 May 2003 22:26:27 -0000	1.18
@@ -912,7 +912,7 @@
 	dev->mtd_info.point = 0;
 	dev->mtd_info.unpoint = 0;
 	dev->mtd_info.priv = dev;
-	dev->mtd_info.module = THIS_MODULE;
+	set_module_owner(&dev->mtd_info);
 
 	list_add(&dev->list, &blkmtd_device_list);
 	if (add_mtd_device(&dev->mtd_info)) {

Index: doc2000.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/doc2000.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- doc2000.c	10 Dec 2002 15:05:42 -0000	1.50
+++ doc2000.c	14 May 2003 22:26:28 -0000	1.51
@@ -557,7 +557,7 @@
 	mtd->erasesize = 0;
 	mtd->oobblock = 512;
 	mtd->oobsize = 16;
-	mtd->module = THIS_MODULE;
+	set_module_owner(mtd);
 	mtd->erase = doc_erase;
 	mtd->point = NULL;
 	mtd->unpoint = NULL;

Index: doc2001.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/doc2001.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- doc2001.c	10 Dec 2002 15:05:42 -0000	1.38
+++ doc2001.c	14 May 2003 22:26:28 -0000	1.39
@@ -366,7 +366,7 @@
 
 	mtd->oobblock = 512;
 	mtd->oobsize = 16;
-	mtd->module = THIS_MODULE;
+	set_module_owner(mtd);
 	mtd->erase = doc_erase;
 	mtd->point = NULL;
 	mtd->unpoint = NULL;

Index: lart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/lart.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- lart.c	22 Apr 2003 20:12:47 -0000	1.3
+++ lart.c	14 May 2003 22:26:28 -0000	1.4
@@ -641,10 +641,10 @@
    mtd.erasesize = FLASH_BLOCKSIZE_MAIN;
    mtd.numeraseregions = NB_OF (erase_regions);
    mtd.eraseregions = erase_regions;
-   mtd.module = THIS_MODULE;
    mtd.erase = flash_erase;
    mtd.read = flash_read;
    mtd.write = flash_write;
+   set_module_owner(&mtd);
 
 #ifdef LART_DEBUG
    printk (KERN_DEBUG

Index: ms02-nv.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/ms02-nv.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ms02-nv.c	24 Jan 2003 14:05:17 -0000	1.2
+++ ms02-nv.c	14 May 2003 22:26:28 -0000	1.3
@@ -222,7 +222,7 @@
 	mtd->flags = MTD_CAP_RAM | MTD_XIP;
 	mtd->size = fixsize;
 	mtd->name = (char *)ms02nv_name;
-	mtd->module = THIS_MODULE;
+	set_module_owner(mtd);
 	mtd->read = ms02nv_read;
 	mtd->write = ms02nv_write;
 

Index: mtdram.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/mtdram.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- mtdram.c	21 Oct 2002 13:40:06 -0000	1.29
+++ mtdram.c	14 May 2003 22:26:28 -0000	1.30
@@ -136,7 +136,7 @@
    mtd->erasesize = MTDRAM_ERASE_SIZE;
    mtd->priv = mapped_address;
 
-   mtd->module = THIS_MODULE;
+   set_module_owner(mtd);
    mtd->erase = ram_erase;
    mtd->point = ram_point;
    mtd->unpoint = ram_unpoint;

Index: pmc551.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/pmc551.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- pmc551.c	24 Jan 2003 13:34:30 -0000	1.22
+++ pmc551.c	14 May 2003 22:26:28 -0000	1.23
@@ -787,10 +787,10 @@
                 mtd->write 	= pmc551_write;
                 mtd->point 	= pmc551_point;
                 mtd->unpoint 	= pmc551_unpoint;
-                mtd->module 	= THIS_MODULE;
                 mtd->type 	= MTD_RAM;
                 mtd->name 	= "PMC551 RAM board";
                 mtd->erasesize 	= 0x10000;
+		set_module_owner(mtd);
 
                 if (add_mtd_device(mtd)) {
                         printk(KERN_NOTICE "pmc551: Failed to register new device\n");

Index: slram.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/slram.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- slram.c	24 Jan 2003 13:35:34 -0000	1.28
+++ slram.c	14 May 2003 22:26:28 -0000	1.29
@@ -199,7 +199,7 @@
 	(*curmtd)->mtdinfo->unpoint = slram_unpoint;
 	(*curmtd)->mtdinfo->read = slram_read;
 	(*curmtd)->mtdinfo->write = slram_write;
-	(*curmtd)->mtdinfo->module = THIS_MODULE;
+	set_module_owner((*curmtd)->mtdinfo);
 	(*curmtd)->mtdinfo->type = MTD_RAM;
 	(*curmtd)->mtdinfo->erasesize = 0x0;
 


From dwmw2 at infradead.org  Wed May 14 18:27:00 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:14 2006
Subject: mtd/include/linux/mtd compatmac.h,1.48,1.49 mtd.h,1.42,1.43
Message-ID: <E19G4hi-0003iD-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv14262/include/linux/mtd

Modified Files:
	compatmac.h mtd.h 
Log Message:
fix races in get_mtd_device etc, use set_module_owner everywhere

Index: compatmac.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/compatmac.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- compatmac.h	9 May 2003 22:54:28 -0000	1.48
+++ compatmac.h	14 May 2003 22:26:26 -0000	1.49
@@ -578,4 +578,11 @@
 #define generic_file_readonly_mmap generic_file_mmap
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,60)
+#define try_module_get(m) ({ __MOD_INC_USE_COUNT(m), 1; })
+#define __module_get(m) ({ __MOD_INC_USE_COUNT(m), 1; })
+#define module_put(m) do { __MOD_DEC_USE_COUNT(m); } while(0)
+#define set_module_owner(x) do { x->owner = THIS_MODULE; } while(0)
+#endif
+
 #endif /* __LINUX_MTD_COMPATMAC_H__ */

Index: mtd.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/mtd.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- mtd.h	27 Feb 2003 16:03:58 -0000	1.42
+++ mtd.h	14 May 2003 22:26:26 -0000	1.43
@@ -171,7 +171,6 @@
 	/* This really shouldn't be here. It can go away in 2.5 */
 	u_int32_t bank_size;
 
-	struct module *module;
 	int (*erase) (struct mtd_info *mtd, struct erase_info *instr);
 
 	/* This stuff for eXecute-In-Place */
@@ -226,6 +225,9 @@
 	void (*resume) (struct mtd_info *mtd);
 
 	void *priv;
+
+	struct module *owner;
+	int usecount;
 };
 
 
@@ -234,31 +236,19 @@
 extern int add_mtd_device(struct mtd_info *mtd);
 extern int del_mtd_device (struct mtd_info *mtd);
 
-extern struct mtd_info *__get_mtd_device(struct mtd_info *mtd, int num);
+#define get_mtd_device(mtd, num) ___get_mtd_device(mtd, num, 1)
+#undef __get_mtd_device
+#define __get_mtd_device(mtd, num) ___get_mtd_device(mtd, num, 0)
+
+extern struct mtd_info *___get_mtd_device(struct mtd_info *mtd, int num, int count);
 
-static inline struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num)
-{
-	struct mtd_info *ret;
-	
-	ret = __get_mtd_device(mtd, num);
-
-	if (ret && ret->module && !try_inc_mod_count(ret->module))
-		return NULL;
-
-	return ret;
-}
-
-static inline void put_mtd_device(struct mtd_info *mtd)
-{
-       if (mtd->module)
-	       __MOD_DEC_USE_COUNT(mtd->module);
-}
+extern void put_mtd_device(struct mtd_info *mtd);
 
 
 struct mtd_notifier {
 	void (*add)(struct mtd_info *mtd);
 	void (*remove)(struct mtd_info *mtd);
-	struct mtd_notifier *next;
+	struct list_head list;
 };
 
 
@@ -271,7 +261,6 @@
 int default_mtd_readv(struct mtd_info *mtd, struct iovec *vecs,
 		      unsigned long count, loff_t from, size_t *retlen);
 
-#ifndef MTDC
 #define MTD_ERASE(mtd, args...) (*(mtd->erase))(mtd, args)
 #define MTD_POINT(mtd, a,b,c,d) (*(mtd->point))(mtd, a,b,c, (u_char **)(d))
 #define MTD_UNPOINT(mtd, arg) (*(mtd->unpoint))(mtd, (u_char *)arg)
@@ -284,7 +273,6 @@
 #define MTD_READOOB(mtd, args...) (*(mtd->read_oob))(mtd, args)
 #define MTD_WRITEOOB(mtd, args...) (*(mtd->write_oob))(mtd, args)
 #define MTD_SYNC(mtd) do { if (mtd->sync) (*(mtd->sync))(mtd);  } while (0) 
-#endif /* MTDC */
 
 /*
  * Debugging macro and defines
@@ -301,7 +289,8 @@
 			printk(KERN_INFO args);		\
 	} while(0)
 #else /* CONFIG_MTD_DEBUG */
-#define DEBUG(n, args...)
+#define DEBUG(n, args...) do { } while(0)
+
 #endif /* CONFIG_MTD_DEBUG */
 
 #endif /* __KERNEL__ */


From dwmw2 at infradead.org  Wed May 14 18:26:35 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:15 2006
Subject: mtd/drivers/mtd/maps amd76xrom.c,1.4,1.5 arctic-mtd.c,1.5,1.6
 autcpu12-nvram.c,1.2,1.3 beech-mtd.c,1.4,1.5 cdb89712.c,1.4,1.5
 ceiva.c,1.4,1.5 cfi_flagadm.c,1.8,1.9 cstm_mips_ixx.c,1.6,1.7
 dbox2-flash.c,1.6,1.7 dc21285.c,1.11,1.12 dilnetpc.c,1.9,1.10
 ebony.c,1.4,1.5 edb7312.c,1.4,1.5 elan-104nc.c,1.14,1.15
 epxa10db-flash.c,1.6,1.7 fortunet.c,1.3,1.4 h720x-flash.c,1.2,1.3
 ich2rom.c,1.4,1.5 impa7.c,1.4,1.5 integrator-flash.c,1.9,1.10
 iq80310.c,1.11,1.12 l440gx.c,1.9,1.10 lasat.c,1.2,1.3
 lubbock-flash.c,1.3,1.4 mbx860.c,1.2,1.3 netsc520.c,1.6,1.7
 nettel.c,1.2,1.3 nora.c,1.21,1.22 ocelot.c,1.8,1.9
 octagon-5066.c,1.21,1.22 pb1xxx-flash.c,1.5,1.6 pci.c,1.3,1.4
 pcmciamtd.c,1.41,1.42 physmap.c,1.23,1.24 pnc2000.c,1.11,1.12
 redwood.c,1.3,1.4 rpxlite.c,1.16,1.17 sa1100-flash.c,1.31,1.32
 sbc_gxx.c,1.22,1.23 sc520cdp.c,1.12,1.13 scb2_flash.c,1.3,1.4
 scx200_docflash.c,1.2,1.3 solutionengine.c,1.6,1.7
 sun_uflash.c,1.5,1.6 tqm8xxl.c,1.5,1.6 tsunami_flash.c,1.2,1.3
 uclinux.c,1.3,1.4 vmax301.c,1.25,1.26
Message-ID: <E19G4hn-0003iQ-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv14262/drivers/mtd/maps

Modified Files:
	amd76xrom.c arctic-mtd.c autcpu12-nvram.c beech-mtd.c 
	cdb89712.c ceiva.c cfi_flagadm.c cstm_mips_ixx.c dbox2-flash.c 
	dc21285.c dilnetpc.c ebony.c edb7312.c elan-104nc.c 
	epxa10db-flash.c fortunet.c h720x-flash.c ich2rom.c impa7.c 
	integrator-flash.c iq80310.c l440gx.c lasat.c lubbock-flash.c 
	mbx860.c netsc520.c nettel.c nora.c ocelot.c octagon-5066.c 
	pb1xxx-flash.c pci.c pcmciamtd.c physmap.c pnc2000.c redwood.c 
	rpxlite.c sa1100-flash.c sbc_gxx.c sc520cdp.c scb2_flash.c 
	scx200_docflash.c solutionengine.c sun_uflash.c tqm8xxl.c 
	tsunami_flash.c uclinux.c vmax301.c 
Log Message:
fix races in get_mtd_device etc, use set_module_owner everywhere

Index: amd76xrom.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/amd76xrom.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- amd76xrom.c	14 May 2003 15:05:14 -0000	1.4
+++ amd76xrom.c	14 May 2003 22:26:29 -0000	1.5
@@ -120,7 +120,7 @@
 	printk(KERN_NOTICE "amd76xrom chip at offset: 0x%x\n",
 		window->size - rom_size);
 		
-	info->mtd->module = THIS_MODULE;
+	set_module_owner(info->mtd);
 	add_mtd_device(info->mtd);
 	info->window_start = window->start;
 	info->window_size = window->size;

Index: arctic-mtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/arctic-mtd.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- arctic-mtd.c	14 May 2003 15:05:14 -0000	1.5
+++ arctic-mtd.c	14 May 2003 22:26:29 -0000	1.6
@@ -104,7 +104,7 @@
 	if (!arctic_mtd)
 		return -ENXIO;
 
-	arctic_mtd->module = THIS_MODULE;
+	set_module_owner(arctic_mtd);
 
 	return add_mtd_partitions(arctic_mtd, arctic_partitions, 3);
 }

Index: autcpu12-nvram.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/autcpu12-nvram.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- autcpu12-nvram.c	14 May 2003 15:05:14 -0000	1.2
+++ autcpu12-nvram.c	14 May 2003 22:26:29 -0000	1.3
@@ -86,7 +86,7 @@
 		goto out_ioremap;
 	}
 
-	sram_mtd->module = THIS_MODULE;
+	set_module_owner(sram_mtd);
 	sram_mtd->erasesize = 16;
 	
 	if (add_mtd_device(sram_mtd)) {

Index: beech-mtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/beech-mtd.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- beech-mtd.c	14 May 2003 15:05:14 -0000	1.4
+++ beech-mtd.c	14 May 2003 22:26:29 -0000	1.5
@@ -88,7 +88,7 @@
 	if (!beech_mtd)
 		return -ENXIO;
 
-	beech_mtd->module = THIS_MODULE;
+	set_module_owner(beech_mtd);
 
 	return add_mtd_partitions(beech_mtd, beech_partitions, 2);
 }

Index: cdb89712.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/cdb89712.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- cdb89712.c	14 May 2003 15:05:14 -0000	1.4
+++ cdb89712.c	14 May 2003 22:26:29 -0000	1.5
@@ -62,7 +62,7 @@
 		goto out_ioremap;
 	}
 
-	flash_mtd->module = THIS_MODULE;
+	set_module_owner(flash_mtd);
 	
 	if (add_mtd_device(flash_mtd)) {
 		printk("FLASH device addition failed\n");
@@ -127,7 +127,7 @@
 		goto out_ioremap;
 	}
 
-	sram_mtd->module = THIS_MODULE;
+	set_module_owner(sram_mtd);
 	sram_mtd->erasesize = 16;
 	
 	if (add_mtd_device(sram_mtd)) {
@@ -195,7 +195,7 @@
 		goto out_ioremap;
 	}
 
-	bootrom_mtd->module = THIS_MODULE;
+	set_module_owner(bootrom_mtd);
 	bootrom_mtd->erasesize = 0x10000;
 	
 	if (add_mtd_device(bootrom_mtd)) {

Index: ceiva.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ceiva.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ceiva.c	14 May 2003 15:05:14 -0000	1.4
+++ ceiva.c	14 May 2003 22:26:29 -0000	1.5
@@ -160,7 +160,7 @@
 			ret = -ENXIO;
 			break;
 		}
-		clps[i].mtd->module = THIS_MODULE;
+		set_module_owner(clps[i].mtd);
 		subdev[i] = clps[i].mtd;
 
 		printk(KERN_INFO "clps flash: JEDEC device at 0x%08lx, %dMiB, "

Index: cfi_flagadm.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/cfi_flagadm.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- cfi_flagadm.c	14 May 2003 15:05:14 -0000	1.8
+++ cfi_flagadm.c	14 May 2003 22:26:29 -0000	1.9
@@ -107,7 +107,7 @@
 
 	mymtd = do_map_probe("cfi_probe", &flagadm_map);
 	if (mymtd) {
-		mymtd->module = THIS_MODULE;
+		set_module_owner(mymtd);
 		add_mtd_partitions(mymtd, flagadm_parts, PARTITION_COUNT);
 		printk(KERN_NOTICE "FlagaDM flash device initialized\n");
 		return 0;

Index: cstm_mips_ixx.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/cstm_mips_ixx.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- cstm_mips_ixx.c	14 May 2003 15:05:14 -0000	1.6
+++ cstm_mips_ixx.c	14 May 2003 22:26:29 -0000	1.7
@@ -199,7 +199,7 @@
 		        printk(KERN_NOTICE "cstm_mips_ixx %d jedec: mymtd is %x\n",i,(unsigned int)mymtd);
 		}
 		if (mymtd) {
-			mymtd->module = THIS_MODULE;
+			set_module_owner(mymtd);
 
 	                cstm_mips_ixx_map[i].map_priv_2 = (unsigned long)mymtd;
 		        add_mtd_partitions(mymtd, parts, cstm_mips_ixx_board_desc[i].num_partitions);

Index: dbox2-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dbox2-flash.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- dbox2-flash.c	14 May 2003 15:05:14 -0000	1.6
+++ dbox2-flash.c	14 May 2003 22:26:29 -0000	1.7
@@ -91,7 +91,7 @@
 	}
 	    
 	if (mymtd) {
-		mymtd->module = THIS_MODULE;
+		set_module_owner(mymtd);
 
                 /* Create MTD devices for each partition. */
 	        add_mtd_partitions(mymtd, partition_info, NUM_PARTITIONS);

Index: dc21285.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dc21285.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- dc21285.c	14 May 2003 15:05:14 -0000	1.11
+++ dc21285.c	14 May 2003 22:26:29 -0000	1.12
@@ -140,7 +140,7 @@
 	if (mymtd) {
 		int nrparts = 0;
 
-		mymtd->module = THIS_MODULE;
+		set_module_owner(mymtd);
 			
 		/* partition fixup */
 

Index: dilnetpc.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dilnetpc.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- dilnetpc.c	14 May 2003 15:05:14 -0000	1.9
+++ dilnetpc.c	14 May 2003 22:26:29 -0000	1.10
@@ -433,7 +433,7 @@
 		return -ENXIO;
 	}
 		
-	mymtd->module = THIS_MODULE;
+	set_module_owner(mymtd);
 
 	/*
 	** Supply pointers to lowlvl_parts[] array to add_mtd_partitions()

Index: ebony.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ebony.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ebony.c	14 May 2003 15:05:14 -0000	1.4
+++ ebony.c	14 May 2003 22:26:29 -0000	1.5
@@ -106,7 +106,7 @@
 
 	flash = do_map_probe("map_rom", &ebony_small_map);
 	if (flash) {
-		flash->module = THIS_MODULE;
+		set_module_owner(flash);
 		add_mtd_partitions(flash, ebony_small_partitions,
 					NB_OF(ebony_small_partitions));
 	} else {
@@ -128,7 +128,7 @@
 
 	flash = do_map_probe("cfi_probe", &ebony_large_map);
 	if (flash) {
-		flash->module = THIS_MODULE;
+		set_module_owner(flash);
 		add_mtd_partitions(flash, ebony_large_partitions,
 					NB_OF(ebony_large_partitions));
 	} else {

Index: edb7312.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/edb7312.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- edb7312.c	14 May 2003 15:05:14 -0000	1.4
+++ edb7312.c	14 May 2003 22:26:29 -0000	1.5
@@ -97,7 +97,7 @@
 		mymtd = do_map_probe(*type, &edb7312nor_map);
 	}
 	if (mymtd) {
-		mymtd->module = THIS_MODULE;
+		set_module_owner(mymtd);
 
 #ifdef CONFIG_MTD_PARTITIONS
 #ifdef CONFIG_MTD_CMDLINE_PARTS

Index: elan-104nc.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/elan-104nc.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- elan-104nc.c	14 May 2003 15:05:14 -0000	1.14
+++ elan-104nc.c	14 May 2003 22:26:29 -0000	1.15
@@ -261,7 +261,7 @@
 		return -ENXIO;
 	}
 	
-	all_mtd->module=THIS_MODULE;
+	set_module_owner(all_mtd);
 
 	/* Create MTD devices for each partition. */
 	add_mtd_partitions( all_mtd, partition_info, NUM_PARTITIONS );

Index: epxa10db-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/epxa10db-flash.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- epxa10db-flash.c	14 May 2003 15:05:14 -0000	1.6
+++ epxa10db-flash.c	14 May 2003 22:26:29 -0000	1.7
@@ -73,7 +73,7 @@
 		return -ENXIO;
 	}
 
-	mymtd->module = THIS_MODULE;
+	set_module_owner(mymtd);
 
 	/* Unlock the flash device. */
 	if(mymtd->unlock){

Index: fortunet.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/fortunet.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- fortunet.c	14 May 2003 15:05:14 -0000	1.3
+++ fortunet.c	14 May 2003 22:26:30 -0000	1.4
@@ -236,7 +236,7 @@
 				map_regions[ix].mymtd = do_map_probe("cfi_probe",
 					&map_regions[ix].map_info);
 			}
-			map_regions[ix].mymtd->module = THIS_MODULE;
+			set_module_owner(map_regions[ix].mymtd);
 			add_mtd_partitions(map_regions[ix].mymtd,
 				map_regions[ix].parts,map_regions_parts[ix]);
 		}

Index: h720x-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/h720x-flash.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- h720x-flash.c	14 May 2003 15:05:14 -0000	1.2
+++ h720x-flash.c	14 May 2003 22:26:30 -0000	1.3
@@ -88,7 +88,7 @@
 	}
 	    
 	if (mymtd) {
-		mymtd->module = THIS_MODULE;
+		set_module_owner(mymtd);
 
 #ifdef CONFIG_MTD_CMDLINE_PARTS
 		nr_mtd_parts = parse_cmdline_partitions(mymtd, &mtd_parts, h720x_map.name);

Index: ich2rom.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ich2rom.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ich2rom.c	14 May 2003 15:05:14 -0000	1.4
+++ ich2rom.c	14 May 2003 22:26:30 -0000	1.5
@@ -222,7 +222,7 @@
 	info->mtd->lock = ich2rom_lock;
 	info->mtd->unlock = ich2rom_unlock;
 		
-	info->mtd->module = THIS_MODULE;
+	set_module_owner(info->mtd);
 	add_mtd_device(info->mtd);
 	return 0;
 

Index: impa7.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/impa7.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- impa7.c	14 May 2003 15:05:14 -0000	1.4
+++ impa7.c	14 May 2003 22:26:30 -0000	1.5
@@ -107,7 +107,7 @@
 
 		if (impa7_mtd[i]) 
 		{
-			impa7_mtd[i]->module = THIS_MODULE;
+			set_module_owner(impa7_mtd[i]);
 			add_mtd_device(impa7_mtd[i]);
 			devicesfound++;
 #ifdef CONFIG_MTD_PARTITIONS

Index: integrator-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/integrator-flash.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- integrator-flash.c	14 May 2003 15:05:14 -0000	1.9
+++ integrator-flash.c	14 May 2003 22:26:30 -0000	1.10
@@ -187,7 +187,7 @@
 	if (!mtd)
 		return -ENXIO;
 
-	mtd->module = THIS_MODULE;
+	set_module_owner(mtd);
 
 	ret = parse_afs_partitions(mtd, &parts, (void *)0);
 	if (ret > 0) {

Index: iq80310.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/iq80310.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- iq80310.c	14 May 2003 15:05:15 -0000	1.11
+++ iq80310.c	14 May 2003 22:26:30 -0000	1.12
@@ -79,7 +79,7 @@
 		iounmap((void *)iq80310_map.virt);
 		return -ENXIO;
 	}
-	mymtd->module = THIS_MODULE;
+	set_module_owner(mymtd);
 
 #ifdef CONFIG_MTD_REDBOOT_PARTS
 	if (parsed_nr_parts == 0) {

Index: l440gx.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/l440gx.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- l440gx.c	14 May 2003 15:05:15 -0000	1.9
+++ l440gx.c	14 May 2003 22:26:30 -0000	1.10
@@ -130,7 +130,7 @@
 		mymtd = do_map_probe("map_rom", &l440gx_map);
 	}
 	if (mymtd) {
-		mymtd->module = THIS_MODULE;
+		set_module_owner(mymtd);
 
 		add_mtd_device(mymtd);
 		return 0;

Index: lasat.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/lasat.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- lasat.c	14 May 2003 15:05:15 -0000	1.2
+++ lasat.c	14 May 2003 22:26:30 -0000	1.3
@@ -58,7 +58,7 @@
 	if (mymtd) {
 		u32 size, offset = 0;
 
-		mymtd->module = THIS_MODULE;
+		set_module_owner(mymtd);
 
 		for (i=0; i < LASAT_MTD_LAST; i++) {
 			size = lasat_flash_partition_size(i);

Index: lubbock-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/lubbock-flash.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- lubbock-flash.c	14 May 2003 15:05:15 -0000	1.3
+++ lubbock-flash.c	14 May 2003 22:26:30 -0000	1.4
@@ -95,7 +95,7 @@
 				ret = -EIO;
 			continue;
 		}
-		mymtds[i]->module = THIS_MODULE;
+		set_module_owner(mymtds[i]);
 
 #ifdef CONFIG_MTD_REDBOOT_PARTS
 		int ret = parse_redboot_partitions(mymtds[i], &parsed_parts[i], 0);

Index: mbx860.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/mbx860.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- mbx860.c	14 May 2003 15:05:15 -0000	1.2
+++ mbx860.c	14 May 2003 22:26:30 -0000	1.3
@@ -69,7 +69,7 @@
 
 	mymtd = do_map_probe("jedec_probe", &mbx_map);
 	if (mymtd) {
-		mymtd->module = THIS_MODULE;
+		set_module_owner(mymtd);
 		add_mtd_device(mymtd);
                 add_mtd_partitions(mymtd, partition_info, NUM_PARTITIONS);
 		return 0;

Index: netsc520.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/netsc520.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- netsc520.c	14 May 2003 15:05:15 -0000	1.6
+++ netsc520.c	14 May 2003 22:26:30 -0000	1.7
@@ -114,7 +114,7 @@
 		return -ENXIO;
 	}
 		
-	mymtd->module = THIS_MODULE;
+	set_module_owner(mymtd);
 	add_mtd_partitions( mymtd, partition_info, NUM_PARTITIONS );
 	return 0;
 }

Index: nettel.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/nettel.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- nettel.c	14 May 2003 15:05:15 -0000	1.2
+++ nettel.c	14 May 2003 22:26:30 -0000	1.3
@@ -285,7 +285,7 @@
 		printk(KERN_NOTICE "SNAPGEAR: AMD flash device size = %dK\n",
 			amd_mtd->size>>10);
 
-		amd_mtd->module = THIS_MODULE;
+		set_module_owner(amd_mtd);
 
 		/* The high BIOS partition is only present for 2MB units */
 		num_amd_partitions = NUM_AMD_PARTITIONS;
@@ -416,7 +416,7 @@
 	printk(KERN_NOTICE "SNAPGEAR: Intel flash device size = %dK\n",
 		(intel_mtd->size >> 10));
 
-	intel_mtd->module = THIS_MODULE;
+	set_module_owner(intel_mtd);
 
 #ifndef CONFIG_BLK_DEV_INITRD
 	ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, 1);

Index: nora.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/nora.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- nora.c	2 Oct 2001 15:05:14 -0000	1.21
+++ nora.c	14 May 2003 22:26:30 -0000	1.22
@@ -173,7 +173,7 @@
 
 	mymtd = do_map_probe("cfi_probe", &nora_map);
 	if (mymtd) {
-		mymtd->module = THIS_MODULE;
+		set_module_owner(mymtd);
 		
 		add_mtd_device(&nora_mtds[2]);
 		add_mtd_device(&nora_mtds[0]);

Index: ocelot.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ocelot.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ocelot.c	14 May 2003 15:05:15 -0000	1.8
+++ ocelot.c	14 May 2003 22:26:30 -0000	1.9
@@ -92,7 +92,7 @@
 		printk("NVRAM probe failed\n");
 		goto fail_1;
 	}
-	nvram_mtd->module = THIS_MODULE;
+	set_module_owner(nvram_mtd);
 	nvram_mtd->erasesize = 16;
 	/* Override the write() method */
 	nvram_mtd->write = ocelot_ram_write;
@@ -126,7 +126,7 @@
 
 	add_mtd_device(nvram_mtd);
 
-	flash_mtd->module = THIS_MODULE;
+	set_module_owner(flash_mtd);
 	nr_parts = parse_redboot_partitions(flash_mtd, &parsed_parts, (void *)0);
 
 	if (nr_parts)

Index: octagon-5066.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/octagon-5066.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- octagon-5066.c	14 May 2003 15:05:15 -0000	1.21
+++ octagon-5066.c	14 May 2003 22:26:30 -0000	1.22
@@ -264,7 +264,7 @@
 		if (!oct5066_mtd[i])
 			oct5066_mtd[i] = do_map_probe("map_rom", &oct5066_map[i]);
 		if (oct5066_mtd[i]) {
-			oct5066_mtd[i]->module = THIS_MODULE;
+			set_module_owner(oct5066_mtd[i]);
 			add_mtd_device(oct5066_mtd[i]);
 		}
 	}

Index: pb1xxx-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pb1xxx-flash.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- pb1xxx-flash.c	14 May 2003 15:05:15 -0000	1.5
+++ pb1xxx-flash.c	14 May 2003 22:26:30 -0000	1.6
@@ -169,7 +169,7 @@
 		iounmap(pb1xxx_map.virt);
 		return -ENXIO;
 	}
-	mymtd->module = THIS_MODULE;
+	set_module_owner(mymtd);
 
 	add_mtd_partitions(mymtd, parts, nb_parts);
 	return 0;

Index: pci.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pci.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- pci.c	14 May 2003 15:05:15 -0000	1.3
+++ pci.c	14 May 2003 22:26:30 -0000	1.4
@@ -321,7 +321,7 @@
 	if (!mtd)
 		goto release;
 
-	mtd->module = THIS_MODULE;
+	set_module_owner(mtd);
 	add_mtd_device(mtd);
 
 	pci_set_drvdata(dev, mtd);

Index: pcmciamtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pcmciamtd.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- pcmciamtd.c	14 May 2003 15:05:15 -0000	1.41
+++ pcmciamtd.c	14 May 2003 22:26:30 -0000	1.42
@@ -645,7 +645,7 @@
 	}
 
 	dev->mtd_info = mtd;
-	mtd->module = THIS_MODULE;
+	set_module_owner(mtd);
 
 	if(new_name) {
 		int size = 0;

Index: physmap.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/physmap.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- physmap.c	14 May 2003 15:05:15 -0000	1.23
+++ physmap.c	14 May 2003 22:26:31 -0000	1.24
@@ -87,7 +87,7 @@
 		mymtd = do_map_probe(*type, &physmap_map);
 	}
 	if (mymtd) {
-		mymtd->module = THIS_MODULE;
+		set_module_owner(mymtd);
 
 		add_mtd_device(mymtd);
 #ifdef CONFIG_MTD_PARTITIONS

Index: pnc2000.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pnc2000.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- pnc2000.c	14 May 2003 15:05:15 -0000	1.11
+++ pnc2000.c	14 May 2003 22:26:31 -0000	1.12
@@ -69,7 +69,7 @@
 
 	mymtd = do_map_probe("cfi_probe", &pnc_map);
 	if (mymtd) {
-		mymtd->module = THIS_MODULE;
+		set_module_owner(mymtd);
 		return add_mtd_partitions(mymtd, pnc_partitions, 3);
 	}
 

Index: redwood.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/redwood.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- redwood.c	14 May 2003 15:05:15 -0000	1.3
+++ redwood.c	14 May 2003 22:26:31 -0000	1.4
@@ -143,7 +143,7 @@
 	redwood_mtd = do_map_probe("cfi_probe",&redwood_flash_map);
 
 	if (redwood_mtd) {
-		redwood_mtd->module = THIS_MODULE;
+		set_module_owner(redwood_mtd);
 		return add_mtd_partitions(redwood_mtd,
 				redwood_flash_partitions,
 				NUM_REDWOOD_FLASH_PARTITIONS);

Index: rpxlite.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/rpxlite.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- rpxlite.c	14 May 2003 15:05:15 -0000	1.16
+++ rpxlite.c	14 May 2003 22:26:31 -0000	1.17
@@ -36,7 +36,7 @@
 	simple_map_init(&rpxlite_map);
 	mymtd = do_map_probe("cfi_probe", &rpxlite_map);
 	if (mymtd) {
-		mymtd->module = THIS_MODULE;
+		set_module_owner(mymtd);
 		add_mtd_device(mymtd);
 		return 0;
 	}

Index: sa1100-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sa1100-flash.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- sa1100-flash.c	14 May 2003 15:05:15 -0000	1.31
+++ sa1100-flash.c	14 May 2003 22:26:31 -0000	1.32
@@ -913,7 +913,7 @@
 	ret = -ENXIO;
 	if (!mymtd)
 		goto out_err;
-	mymtd->module = THIS_MODULE;
+	set_module_owner(mymtd);
 
 	/*
 	 * Dynamic partition selection stuff (might override the static ones)

Index: sbc_gxx.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sbc_gxx.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- sbc_gxx.c	14 May 2003 15:05:16 -0000	1.22
+++ sbc_gxx.c	14 May 2003 22:26:31 -0000	1.23
@@ -262,7 +262,7 @@
 		return -ENXIO;
 	}
 	
-	all_mtd->module=THIS_MODULE;
+	set_module_owner(all_mtd);
 
 	/* Create MTD devices for each partition. */
 	add_mtd_partitions(all_mtd, partition_info, NUM_PARTITIONS );

Index: sc520cdp.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sc520cdp.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- sc520cdp.c	14 May 2003 15:05:16 -0000	1.12
+++ sc520cdp.c	14 May 2003 22:26:31 -0000	1.13
@@ -256,7 +256,7 @@
 			mymtd[i] = do_map_probe("map_rom", &sc520cdp_map[i]);
 
 		if (mymtd[i]) {
-			mymtd[i]->module = THIS_MODULE;
+			set_module_owner(mymtd[i]);
 			++devices_found;
 		}
 		else {

Index: scb2_flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/scb2_flash.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- scb2_flash.c	14 May 2003 15:05:16 -0000	1.3
+++ scb2_flash.c	14 May 2003 22:26:31 -0000	1.4
@@ -178,7 +178,7 @@
 		return -ENODEV;
 	}
 
-	scb2_mtd->module = THIS_MODULE;
+	set_module_owner(scb2_mtd);
 	if (scb2_fixup_mtd(scb2_mtd) < 0) {
 		del_mtd_device(scb2_mtd);
 		map_destroy(scb2_mtd);

Index: scx200_docflash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/scx200_docflash.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- scx200_docflash.c	14 May 2003 15:05:16 -0000	1.2
+++ scx200_docflash.c	14 May 2003 22:26:31 -0000	1.3
@@ -197,7 +197,7 @@
 	if (size < mymtd->size)
 		printk(KERN_WARNING NAME ": warning, flash mapping is smaller than flash size\n");
 
-	mymtd->module = THIS_MODULE;
+	set_module_owner(mymtd);
 
 #if PARTITION
 	partition_info[3].offset = mymtd->size-partition_info[3].size;

Index: solutionengine.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/solutionengine.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- solutionengine.c	14 May 2003 15:05:16 -0000	1.6
+++ solutionengine.c	14 May 2003 22:26:31 -0000	1.7
@@ -84,11 +84,11 @@
 	printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n",
 	       soleng_flash_map.phys & 0x1fffffff,
 	       soleng_eprom_map.phys & 0x1fffffff);
-	flash_mtd->module = THIS_MODULE;
+	set_module_owner(flash_mtd);
 
 	eprom_mtd = do_map_probe("map_rom", &soleng_eprom_map);
 	if (eprom_mtd) {
-		eprom_mtd->module = THIS_MODULE;
+		set_module_owner(eprom_mtd);
 		add_mtd_device(eprom_mtd);
 	}
 

Index: sun_uflash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sun_uflash.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- sun_uflash.c	14 May 2003 15:05:16 -0000	1.5
+++ sun_uflash.c	14 May 2003 22:26:31 -0000	1.6
@@ -119,7 +119,7 @@
 
 	list_add(&pdev->list, &device_list);
 
-	pdev->mtd->module = THIS_MODULE;
+	set_module_owner(pdev->mtd);
 
 	add_mtd_device(pdev->mtd);
 	return(0);

Index: tqm8xxl.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/tqm8xxl.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- tqm8xxl.c	14 May 2003 15:05:16 -0000	1.5
+++ tqm8xxl.c	14 May 2003 22:26:31 -0000	1.6
@@ -175,7 +175,7 @@
 		mtd_banks[idx] = do_map_probe("cfi_probe", map_banks[idx]);
 
 		if (mtd_banks[idx]) {
-			mtd_banks[idx]->module = THIS_MODULE;
+			set_module_owner(mtd_banks[idx]);
 			mtd_size += mtd_banks[idx]->size;
 			num_banks++;
 

Index: tsunami_flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/tsunami_flash.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- tsunami_flash.c	14 May 2003 15:05:16 -0000	1.2
+++ tsunami_flash.c	14 May 2003 22:26:31 -0000	1.3
@@ -93,7 +93,7 @@
 		tsunami_flash_mtd = do_map_probe(*type, &tsunami_flash_map);
 	}
 	if (tsunami_flash_mtd) {
-		tsunami_flash_mtd->module = THIS_MODULE;
+		set_module_owner(tsunami_flash_mtd);
 		add_mtd_device(tsunami_flash_mtd);
 		return 0;
 	}

Index: uclinux.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/uclinux.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- uclinux.c	14 May 2003 15:05:16 -0000	1.3
+++ uclinux.c	14 May 2003 22:26:31 -0000	1.4
@@ -85,7 +85,7 @@
 		return(-ENXIO);
 	}
 		
-	mtd->module = THIS_MODULE;
+	set_module_owner(mtd);
 	mtd->point = uclinux_point;
 	mtd->priv = mapp;
 

Index: vmax301.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/vmax301.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- vmax301.c	14 May 2003 15:05:16 -0000	1.25
+++ vmax301.c	14 May 2003 22:26:31 -0000	1.26
@@ -220,7 +220,7 @@
 		if (!vmax_mtd[i])
 			vmax_mtd[i] = do_map_probe("map_rom", &vmax_map[i]);
 		if (vmax_mtd[i]) {
-			vmax_mtd[i]->module = THIS_MODULE;
+			set_module_owner(vmax_mtd[i]);
 			add_mtd_device(vmax_mtd[i]);
 		}
 	}


From dwmw2 at infradead.org  Thu May 15 12:52:39 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:15 2006
Subject: mtd/drivers/mtd mtdblock-24.c,1.3,1.4
Message-ID: <E19GLyB-0007r0-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv30170

Modified Files:
	mtdblock-24.c 
Log Message:
Fix notifier struct.


Index: mtdblock-24.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdblock-24.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- mtdblock-24.c	9 May 2003 22:53:49 -0000	1.3
+++ mtdblock-24.c	15 May 2003 16:52:35 -0000	1.4
@@ -27,9 +27,8 @@
 static void mtd_notify_add(struct mtd_info* mtd);
 static void mtd_notify_remove(struct mtd_info* mtd);
 static struct mtd_notifier notifier = {
-        mtd_notify_add,
-        mtd_notify_remove,
-        NULL
+        .add = mtd_notify_add,
+        .remove = mtd_notify_remove,
 };
 static devfs_handle_t devfs_dir_handle = NULL;
 static devfs_handle_t devfs_rw_handle[MAX_MTD_DEVICES];


From dwmw2 at infradead.org  Thu May 15 13:00:10 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:15 2006
Subject: mtd/drivers/mtd mtdcore.c,1.35,1.36
Message-ID: <E19GM5S-0007tO-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv30319

Modified Files:
	mtdcore.c 
Log Message:
Fix list_add arguments


Index: mtdcore.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdcore.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- mtdcore.c	14 May 2003 22:26:27 -0000	1.35
+++ mtdcore.c	15 May 2003 17:00:07 -0000	1.36
@@ -130,7 +130,7 @@
 
 	down(&mtd_table_mutex);
 
-	list_add(&mtd_notifiers, &new->list);
+	list_add(&new->list, &mtd_notifiers);
 
  	__module_get(THIS_MODULE);
 	


From dwmw2 at infradead.org  Thu May 15 13:10:10 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:15 2006
Subject: mtd/include/linux/mtd compatmac.h,1.49,1.50
Message-ID: <E19GMF8-0007yw-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv30662

Modified Files:
	compatmac.h 
Log Message:
extra 2.5 stuff

Index: compatmac.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/compatmac.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- compatmac.h	14 May 2003 22:26:26 -0000	1.49
+++ compatmac.h	15 May 2003 17:10:07 -0000	1.50
@@ -578,6 +578,28 @@
 #define generic_file_readonly_mmap generic_file_mmap
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61)
+static inline void __daemonize25(const char *fmt, ...)
+{
+	va_list args;
+
+	va_start(args, fmt);
+	vsnprintf(current->comm, sizeof(current->comm), fmt, args);
+	va_end(args);
+
+	daemonize();
+}
+#undef daemonize
+#define daemonize __daemonize25
+
+static inline int __dequeue_signal25(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
+{
+	return dequeue_signal(mask, info);
+}
+#undef dequeue_signal
+#define dequeue_signal __dequeue_signal25
+#endif
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,60)
 #define try_module_get(m) ({ __MOD_INC_USE_COUNT(m), 1; })
 #define __module_get(m) ({ __MOD_INC_USE_COUNT(m), 1; })


From dwmw2 at infradead.org  Thu May 15 19:14:16 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:15 2006
Subject: mtd/drivers/mtd/devices docprobe.c,1.33,1.34
Message-ID: <E19GRvU-0003lp-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/devices
In directory phoenix.infradead.org:/tmp/cvs-serv14491

Modified Files:
	docprobe.c 
Log Message:
Free mtd device on error


Index: docprobe.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/docprobe.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- docprobe.c	24 Jan 2003 14:02:47 -0000	1.33
+++ docprobe.c	15 May 2003 23:14:13 -0000	1.34
@@ -248,6 +248,7 @@
 			return;
 		}
 		printk(KERN_NOTICE "Cannot find driver for DiskOnChip %s at 0x%lX\n", name, physadr);
+		kfree(mtd);
 	}
 	iounmap((void *)docptr);
 }


From dwmw2 at infradead.org  Fri May 16 06:06:56 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:15 2006
Subject: mtd/include/linux/mtd compatmac.h,1.50,1.51
Message-ID: <E19Gc76-0002PH-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv9232

Modified Files:
	compatmac.h 
Log Message:
Fix daemonize


Index: compatmac.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/compatmac.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- compatmac.h	15 May 2003 17:10:07 -0000	1.50
+++ compatmac.h	16 May 2003 10:06:53 -0000	1.51
@@ -579,18 +579,15 @@
 #endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61)
-static inline void __daemonize25(const char *fmt, ...)
+static inline void __daemonize_modvers(void)
 {
-	va_list args;
-
-	va_start(args, fmt);
-	vsnprintf(current->comm, sizeof(current->comm), fmt, args);
-	va_end(args);
-
 	daemonize();
 }
 #undef daemonize
-#define daemonize __daemonize25
+#define daemonize(fmt, ...) do {						\
+	snprintf(current->comm, sizeof(current->comm), fmt ,##__VA_ARGS__);	\
+	__daemonize_modvers();							\
+	} while(0)
 
 static inline int __dequeue_signal25(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
 {


From dwmw2 at infradead.org  Fri May 16 12:00:36 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:15 2006
Subject: mtd/drivers/mtd mtdblock-24.c,1.4,1.5 mtdblock-25.c,1.1,1.2
 mtdblock-core.c,1.2,1.3
Message-ID: <E19GhdM-0006RI-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv24750

Modified Files:
	mtdblock-24.c mtdblock-25.c mtdblock-core.c 
Log Message:
Move module_init(), fix daemonize() for 2.5 compat.


Index: mtdblock-24.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdblock-24.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- mtdblock-24.c	15 May 2003 16:52:35 -0000	1.4
+++ mtdblock-24.c	16 May 2003 16:00:33 -0000	1.5
@@ -257,12 +257,11 @@
 
 	/* we might get involved when memory gets low, so use PF_MEMALLOC */
 	tsk->flags |= PF_MEMALLOC;
-	strcpy(tsk->comm, "mtdblockd");
 	spin_lock_irq(&tsk->sigmask_lock);
 	sigfillset(&tsk->blocked);
 	recalc_sigpending();
 	spin_unlock_irq(&tsk->sigmask_lock);
-	daemonize();
+	daemonize("mtdblockd");
 
 	while (!leaving) {
 		add_wait_queue(&thr_wq, &wait);
@@ -388,7 +387,6 @@
 int __init init_mtdblock(void)
 {
 	int i;
-
 	spin_lock_init(&mtdblks_lock);
 
 #ifdef CONFIG_DEVFS_FS
@@ -442,3 +440,5 @@
 	blk_size[MAJOR_NR] = NULL;
 }
 
+module_init(init_mtdblock);
+module_exit(cleanup_mtdblock);

Index: mtdblock-25.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdblock-25.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mtdblock-25.c	27 Nov 2002 10:32:27 -0000	1.1
+++ mtdblock-25.c	16 May 2003 16:00:33 -0000	1.2
@@ -393,3 +393,6 @@
 	blk_cleanup_queue(&mtd_queue);
 }
 
+module_init(init_mtdblock);
+module_exit(cleanup_mtdblock);
+

Index: mtdblock-core.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdblock-core.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- mtdblock-core.c	24 Jan 2003 15:39:41 -0000	1.2
+++ mtdblock-core.c	16 May 2003 16:00:33 -0000	1.3
@@ -226,9 +226,6 @@
 	return 0;
 }
 
-module_init(init_mtdblock);
-module_exit(cleanup_mtdblock);
-
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Nicolas Pitre <nico@cam.org> et al.");
 MODULE_DESCRIPTION("Caching read/erase/writeback block device emulation access to MTD devices");


From dwmw2 at infradead.org  Fri May 16 12:03:00 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:15 2006
Subject: mtd/drivers/mtd/devices GNUmakefile,1.4,1.5
Message-ID: <E19Ghfg-0006S8-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/devices
In directory phoenix.infradead.org:/tmp/cvs-serv24802/drivers/mtd/devices

Modified Files:
	GNUmakefile 
Log Message:
PMC551 only if PCI

Index: GNUmakefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/GNUmakefile,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- GNUmakefile	23 Jun 2001 19:34:05 -0000	1.4
+++ GNUmakefile	16 May 2003 16:02:57 -0000	1.5
@@ -9,7 +9,7 @@
 CONFIG_MTD_DOC2001 := m
 CONFIG_MTD_DOCPROBE := m
 CONFIG_MTD_SLRAM := m
-CONFIG_MTD_PMC551 := m
+CONFIG_MTD_PMC551 := $(CONFIG_PCI)
 CONFIG_MTD_MTDRAM := m
 
 CFLAGS_mtdram.o := -DCONFIG_MTDRAM_TOTAL_SIZE=4096 -DCONFIG_MTDRAM_ERASE_SIZE=128


From dwmw2 at infradead.org  Fri May 16 12:06:11 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:15 2006
Subject: mtd/drivers/mtd cmdlinepart.c,1.6,1.7
Message-ID: <E19Ghil-0006TD-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv24869/drivers/mtd

Modified Files:
	cmdlinepart.c 
Log Message:
get mtd_id from master device name

Index: cmdlinepart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/cmdlinepart.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- cmdlinepart.c	16 Nov 2002 01:37:39 -0000	1.6
+++ cmdlinepart.c	16 May 2003 16:06:09 -0000	1.7
@@ -293,11 +293,12 @@
  */
 int parse_cmdline_partitions(struct mtd_info *master, 
                              struct mtd_partition **pparts,
-                             const char *mtd_id)
+                             unsigned long origin)
 {
 	unsigned long offset;
 	int i;
 	struct cmdline_mtd_partition *part;
+	char *mtd_id = master->name;
 
 	if(!cmdline)
 		return -EINVAL;


From dwmw2 at infradead.org  Fri May 16 12:06:47 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:15 2006
Subject: mtd/drivers/mtd mtdpart.c,1.35,1.36
Message-ID: <E19GhjL-0006Tn-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv24902/drivers/mtd

Modified Files:
	mtdpart.c 
Log Message:
New partition probing stuff

Index: mtdpart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdpart.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- mtdpart.c	14 May 2003 22:26:27 -0000	1.35
+++ mtdpart.c	16 May 2003 16:06:44 -0000	1.36
@@ -479,6 +479,75 @@
 EXPORT_SYMBOL(add_mtd_partitions);
 EXPORT_SYMBOL(del_mtd_partitions);
 
+static spinlock_t part_parser_lock = SPIN_LOCK_UNLOCKED;
+static LIST_HEAD(part_parsers);
+
+struct mtd_part_parser *get_partition_parser(const char *name)
+{
+	struct list_head *this;
+	void *ret = NULL;
+	spin_lock(&part_parser_lock);
+
+	list_for_each(this, &part_parsers) {
+		struct mtd_part_parser *p = list_entry(this, struct mtd_part_parser, list);
+
+		if (!strcmp(p->name, name) && try_module_get(p->owner)) {
+			ret = p;
+			break;
+		}
+	}
+	spin_unlock(&part_parser_lock);
+
+	return ret;
+}
+
+int register_mtd_parser(struct mtd_part_parser *p)
+{
+	spin_lock(&part_parser_lock);
+	list_add(&p->list, &part_parsers);
+	spin_unlock(&part_parser_lock);
+
+	return 0;
+}
+
+int deregister_mtd_parser(struct mtd_part_parser *p)
+{
+	spin_lock(&part_parser_lock);
+	list_del(&p->list);
+	spin_unlock(&part_parser_lock);
+	return 0;
+}
+
+int parse_mtd_partitions(struct mtd_info *master, const char **types, 
+			 struct mtd_partition **pparts, unsigned long origin)
+{
+	struct mtd_part_parser *parser;
+	int ret = 0;
+		
+	for ( ; ret <= 0 && *types; types++) {
+		parser = get_partition_parser(*types);
+#ifdef CONFIG_KMOD
+		if (!parser && !request_module(*types))
+				parser = get_partition_parser(*types);
+#endif
+		if (!parser) {
+			printk(KERN_NOTICE "%s partition parsing not available\n",
+			       *types);
+			continue;
+		}
+		ret = (*parser->parse_fn)(master, pparts, origin);
+		if (ret > 0) {
+			printk(KERN_NOTICE "%d %s partitions found on MTD device %s\n", 
+			       ret, parser->name, master->name);
+		}
+		put_partition_parser(parser);
+	}
+	return ret;
+}
+
+EXPORT_SYMBOL_GPL(parse_mtd_partitions);
+EXPORT_SYMBOL_GPL(register_mtd_parser);
+EXPORT_SYMBOL_GPL(deregister_mtd_parser);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Nicolas Pitre <nico@cam.org>");


From dwmw2 at infradead.org  Fri May 16 12:06:47 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:15 2006
Subject: mtd/include/linux/mtd partitions.h,1.11,1.12
Message-ID: <E19GhjL-0006Tp-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv24902/include/linux/mtd

Modified Files:
	partitions.h 
Log Message:
New partition probing stuff

Index: partitions.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/partitions.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- partitions.h	18 Feb 2003 20:53:55 -0000	1.11
+++ partitions.h	16 May 2003 16:06:44 -0000	1.12
@@ -68,5 +68,24 @@
                                     struct mtd_partition **pparts,
                                     const char *mtd_id);
 
+
+struct mtd_part_parser {
+	struct list_head list;
+	struct module *owner;
+	const char *name;
+	int (*parse_fn)(struct mtd_info *, struct mtd_partition **, unsigned long);
+};
+
+extern struct mtd_part_parser *get_partition_parser(const char *name);
+extern int register_mtd_parser(struct mtd_part_parser *parser);
+extern int deregister_mtd_parser(struct mtd_part_parser *parser);
+extern int parse_mtd_partitions(struct mtd_info *master, const char **types, 
+				struct mtd_partition **pparts, unsigned long origin);
+
+static inline void put_partition_parser(struct mtd_part_parser *p)
+{
+	module_put(p->owner);
+}
+
 #endif
 


From dwmw2 at infradead.org  Fri May 16 12:07:08 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:15 2006
Subject: mtd/drivers/mtd redboot.c,1.7,1.8
Message-ID: <E19Ghjg-0006U4-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv24922/drivers/mtd

Modified Files:
	redboot.c 
Log Message:
Update to new partition probe registration

Index: redboot.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/redboot.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- redboot.c	17 Feb 2003 21:49:09 -0000	1.7
+++ redboot.c	16 May 2003 16:07:06 -0000	1.8
@@ -163,6 +163,25 @@
 
 EXPORT_SYMBOL(parse_redboot_partitions);
 
+static struct mtd_part_parser redboot_parser = {
+	.owner = THIS_MODULE,
+	.parse_fn = parse_redboot_partitions,
+	.name = "RedBoot",
+};
+
+static int __init redboot_parser_init(void)
+{
+	return register_mtd_parser(&redboot_parser);
+}
+
+static void __exit redboot_parser_exit(void)
+{
+	deregister_mtd_parser(&redboot_parser);
+}
+
+module_init(redboot_parser_init);
+module_exit(redboot_parser_exit);
+
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Red Hat, Inc. - David Woodhouse <dwmw2@cambridge.redhat.com>");
 MODULE_DESCRIPTION("Parsing code for RedBoot Flash Image System (FIS) tables");


From dwmw2 at infradead.org  Fri May 16 12:07:25 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:15 2006
Subject: mtd/drivers/mtd/maps lubbock-flash.c,1.4,1.5
Message-ID: <E19Ghjx-0006UE-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv24932/drivers/mtd/maps

Modified Files:
	lubbock-flash.c 
Log Message:
Update to new partition probe registration

Index: lubbock-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/lubbock-flash.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- lubbock-flash.c	14 May 2003 22:26:30 -0000	1.4
+++ lubbock-flash.c	16 May 2003 16:07:22 -0000	1.5
@@ -56,7 +56,8 @@
 static struct mtd_info *mymtds[2];
 static struct mtd_partition *parsed_parts[2];
 static int nr_parsed_parts[2];
-static char *part_type[2];
+
+static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
 
 static int __init init_lubbock(void)
 {
@@ -97,14 +98,11 @@
 		}
 		set_module_owner(mymtds[i]);
 
-#ifdef CONFIG_MTD_REDBOOT_PARTS
-		int ret = parse_redboot_partitions(mymtds[i], &parsed_parts[i], 0);
+		int ret = parse_mtd_partitions(mymtds[i], probes,
+					       &parsed_parts[i], 0);
 
-		if (ret > 0) {
-			part_type[i] = "RedBoot";
+		if (ret > 0)
 			nr_parsed_parts[i] = ret;
-		}
-#endif
 	}
 
 	if (!mymtds[0] && !mymtds[1])
@@ -114,8 +112,6 @@
 		if (!mymtds[i]) {
 			printk(KERN_WARNING "%s is absent. Skipping\n", lubbock_maps[i].name);
 		} else if (nr_parsed_parts[i]) {
-			printk("Using %s partitions on %s\n", part_type[i], 
-			       lubbock_maps[i].name);
 			add_mtd_partitions(mymtds[i], parsed_parts[i], nr_parsed_parts[i]);
 		} else if (!i) {
 			printk("Using static partitions on %s\n", lubbock_maps[i].name);


From dwmw2 at infradead.org  Fri May 16 12:11:10 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:16 2006
Subject: mtd/drivers/mtd afs.c,1.9,1.10 cmdlinepart.c,1.7,1.8
Message-ID: <E19Ghna-0006Va-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv25016

Modified Files:
	afs.c cmdlinepart.c 
Log Message:
Update to new partition probe registration

Index: afs.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/afs.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- afs.c	17 Feb 2003 21:49:09 -0000	1.9
+++ afs.c	16 May 2003 16:11:07 -0000	1.10
@@ -127,7 +127,7 @@
 
 int parse_afs_partitions(struct mtd_info *mtd, 
                          struct mtd_partition **pparts,
-                         void *origin)
+                         unsigned long origin)
 {
 	struct mtd_partition *parts;
 	u_int mask, off, idx, sz;
@@ -230,6 +230,27 @@
 }
 
 EXPORT_SYMBOL(parse_afs_partitions);
+
+
+static struct mtd_part_parser afs_parser = {
+	.owner = THIS_MODULE,
+	.parse_fn = parse_afs_partitions,
+	.name = "afs",
+};
+
+static int __init afs_parser_init(void)
+{
+	return register_mtd_parser(&afs_parser);
+}
+
+static void __exit afs_parser_exit(void)
+{
+	deregister_mtd_parser(&afs_parser);
+}
+
+module_init(afs_parser_init);
+module_exit(afs_parser_exit);
+
 
 MODULE_AUTHOR("ARM Ltd");
 MODULE_DESCRIPTION("ARM Firmware Suite partition parser");

Index: cmdlinepart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/cmdlinepart.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- cmdlinepart.c	16 May 2003 16:06:09 -0000	1.7
+++ cmdlinepart.c	16 May 2003 16:11:07 -0000	1.8
@@ -352,6 +352,27 @@
 
 EXPORT_SYMBOL(parse_cmdline_partitions);
 
+
+static struct mtd_part_parser cmdline_parser = {
+	.owner = THIS_MODULE,
+	.parse_fn = parse_cmdline_partitions,
+	.name = "cmdlinepart",
+};
+
+static int __init cmdline_parser_init(void)
+{
+	return register_mtd_parser(&cmdline_parser);
+}
+
+static void __exit cmdline_parser_exit(void)
+{
+	deregister_mtd_parser(&cmdline_parser);
+}
+
+module_init(cmdline_parser_init);
+module_exit(cmdline_parser_exit);
+
+
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Marius Groeger <mag@sysgo.de>");
 MODULE_DESCRIPTION("Command line configuration of MTD partitions");


From dwmw2 at infradead.org  Fri May 16 12:33:38 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:16 2006
Subject: mtd/include/linux/mtd partitions.h,1.12,1.13
Message-ID: <E19Gi9K-0006cH-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv25431/include/linux/mtd

Modified Files:
	partitions.h 
Log Message:
Remove prototypes for old ways of calling partition parsers

Index: partitions.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/partitions.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- partitions.h	16 May 2003 16:06:44 -0000	1.12
+++ partitions.h	16 May 2003 16:33:35 -0000	1.13
@@ -56,18 +56,6 @@
 /*
  * Functions dealing with the various ways of partitioning the space
  */
-extern int parse_redboot_partitions(struct mtd_info *master, 
-                                    struct mtd_partition **pparts,
-                                    void *fis_origin);
-
-extern int parse_afs_partitions(struct mtd_info *, 
-                                struct mtd_partition **,
-                                void *origin);
-
-extern int parse_cmdline_partitions(struct mtd_info *master, 
-                                    struct mtd_partition **pparts,
-                                    const char *mtd_id);
-
 
 struct mtd_part_parser {
 	struct list_head list;


From dwmw2 at infradead.org  Fri May 16 13:07:20 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:16 2006
Subject: mtd/drivers/mtd/maps ceiva.c,1.5,1.6 dc21285.c,1.12,1.13
 edb7312.c,1.5,1.6 epxa10db-flash.c,1.7,1.8 h720x-flash.c,1.3,1.4
 impa7.c,1.5,1.6 integrator-flash.c,1.10,1.11 iq80310.c,1.12,1.13
 ocelot.c,1.9,1.10 physmap.c,1.24,1.25 sa1100-flash.c,1.32,1.33
 solutionengine.c,1.7,1.8
Message-ID: <E19Gifv-0007Di-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv27751

Modified Files:
	ceiva.c dc21285.c edb7312.c epxa10db-flash.c h720x-flash.c 
	impa7.c integrator-flash.c iq80310.c ocelot.c physmap.c 
	sa1100-flash.c solutionengine.c 
Log Message:
Use new partition probe calls

Index: ceiva.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ceiva.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ceiva.c	14 May 2003 22:26:29 -0000	1.5
+++ ceiva.c	16 May 2003 17:07:15 -0000	1.6
@@ -271,6 +271,7 @@
 }
 
 static struct mtd_partition *parsed_parts;
+static const char *probes[] = { "cmdlinepart", "RedBoot", NULL };
 
 static void __init clps_locate_partitions(struct mtd_info *mtd)
 {
@@ -280,20 +281,11 @@
 		/*
 		 * Partition selection stuff.
 		 */
-#ifdef CONFIG_MTD_CMDLINE_PARTS
-		nr_parts = parse_cmdline_partitions(mtd, &parsed_parts, "clps");
+		nr_parts = parse_mtd_partitions(mtd, probes, &parsed_parts, 0);
 		if (nr_parts > 0) {
 			part_type = "command line";
 			break;
 		}
-#endif
-#ifdef CONFIG_MTD_REDBOOT_PARTS
-		nr_parts = parse_redboot_partitions(mtd, &parsed_parts, (void *)0);
-		if (nr_parts > 0) {
-			part_type = "RedBoot";
-			break;
-		}
-#endif
 #ifdef CONFIG_MTD_CEIVA_STATICMAP
 		nr_parts = clps_static_partitions(&parsed_parts);
 		if (nr_parts > 0) {

Index: dc21285.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dc21285.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- dc21285.c	14 May 2003 22:26:29 -0000	1.12
+++ dc21285.c	16 May 2003 17:07:15 -0000	1.13
@@ -108,9 +108,26 @@
 
 /* Partition stuff */
 static struct mtd_partition *dc21285_parts;
-		      
+#ifdef CONFIG_MTD_PARTITIONS
+static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
+#endif
+  
 int __init init_dc21285(void)
 {
+
+	/* 
+	 * Flash timing is determined with bits 19-16 of the
+	 * CSR_SA110_CNTL.  The value is the number of wait cycles, or
+	 * 0 for 16 cycles (the default).  Cycles are 20 ns.
+	 * Here we use 7 for 140 ns flash chips.
+	 */
+	/* access time */
+	*CSR_SA110_CNTL = ((*CSR_SA110_CNTL & ~0x000f0000) | (7 << 16));
+	/* burst time */
+	*CSR_SA110_CNTL = ((*CSR_SA110_CNTL & ~0x00f00000) | (7 << 20));
+	/* tristate time */
+	*CSR_SA110_CNTL = ((*CSR_SA110_CNTL & ~0x0f000000) | (7 << 24));
+
 	/* Determine buswidth */
 	switch (*CSR_SA110_CNTL & (3<<14)) {
 		case SA110_CNTL_ROMWIDTH_8: 
@@ -144,29 +161,14 @@
 			
 		/* partition fixup */
 
-#ifdef CONFIG_MTD_REDBOOT_PARTS
-		nrparts = parse_redboot_partitions(mymtd, &dc21285_parts, (void *)0);
-#endif
+#ifdef CONFIG_MTD_PARTITIONS
+		nrparts = parse_mtd_partitions(mymtd, probes, &dc21285_parts, (void *)0);
 		if (nrparts > 0) {
 			add_mtd_partitions(mymtd, dc21285_parts, nrparts);
-		} else if (nrparts == 0) {
-			printk(KERN_NOTICE "RedBoot partition table failed\n");
-			add_mtd_device(mymtd);
+			return 0;
 		}
-
-		/* 
-		 * Flash timing is determined with bits 19-16 of the
-		 * CSR_SA110_CNTL.  The value is the number of wait cycles, or
-		 * 0 for 16 cycles (the default).  Cycles are 20 ns.
-		 * Here we use 7 for 140 ns flash chips.
-		 */
-		/* access time */
-		*CSR_SA110_CNTL = ((*CSR_SA110_CNTL & ~0x000f0000) | (7 << 16));
-		/* burst time */
-		*CSR_SA110_CNTL = ((*CSR_SA110_CNTL & ~0x00f00000) | (7 << 20));
-		/* tristate time */
-		*CSR_SA110_CNTL = ((*CSR_SA110_CNTL & ~0x0f000000) | (7 << 24));
-
+#endif
+		add_mtd_device(mymtd);
 		return 0;
 	}
 
@@ -176,17 +178,16 @@
 
 static void __exit cleanup_dc21285(void)
 {
-	if (mymtd) {
-		del_mtd_device(mymtd);
-		map_destroy(mymtd);
-		mymtd = NULL;
-	}
-	if (dc21285_map.map_priv_1) {
-		iounmap((void *)dc21285_map.map_priv_1);
-		dc21285_map.map_priv_1 = 0;
-	}
-	if(dc21285_parts)
+#ifdef CONFIG_MTD_PARTITIONS
+	if (dc21285_parts) {
+		del_mtd_partitions(mymtd);
 		kfree(dc21285_parts);
+	} else
+#endif
+		del_mtd_device(mymtd);
+
+	map_destroy(mymtd);
+	iounmap((void *)dc21285_map.map_priv_1);
 }
 
 module_init(init_dc21285);

Index: edb7312.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/edb7312.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- edb7312.c	14 May 2003 22:26:29 -0000	1.5
+++ edb7312.c	16 May 2003 17:07:15 -0000	1.6
@@ -67,6 +67,7 @@
 };
 
 #define NB_OF(x) (sizeof (x) / sizeof (x[0]))
+static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
 
 #endif
 
@@ -100,11 +101,10 @@
 		set_module_owner(mymtd);
 
 #ifdef CONFIG_MTD_PARTITIONS
-#ifdef CONFIG_MTD_CMDLINE_PARTS
-		mtd_parts_nb = parse_cmdline_partitions(mymtd, &mtd_parts, MTDID);
+		mtd_parts_nb = parse_mtd_partitions(mymtd, probes, &mtd_parts, MTDID);
 		if (mtd_parts_nb > 0)
-		  part_type = "command line";
-#endif
+		  part_type = "detected";
+
 		if (mtd_parts_nb == 0)
 		{
 			mtd_parts = static_partitions;

Index: epxa10db-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/epxa10db-flash.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- epxa10db-flash.c	14 May 2003 22:26:29 -0000	1.7
+++ epxa10db-flash.c	16 May 2003 17:07:15 -0000	1.8
@@ -53,6 +53,7 @@
 	.phys =		FLASH_START,
 };
 
+static const char *probes[] = { "RedBoot", "afs", NULL };
 
 static int __init epxa_mtd_init(void)
 {
@@ -85,23 +86,14 @@
 		}
 	}
 
-#ifdef CONFIG_MTD_REDBOOT_PARTS
-	nr_parts = parse_redboot_partitions(mymtd, &parts, (void *)0);
+#ifdef CONFIG_MTD_PARTITIONS
+	nr_parts = parse_mtd_partitions(mymtd, probes, &parts, 0);
 
 	if (nr_parts > 0) {
 		add_mtd_partitions(mymtd, parts, nr_parts);
 		return 0;
 	}
 #endif
-#ifdef CONFIG_MTD_AFS_PARTS
-	nr_parts = parse_afs_partitions(mymtd, &parts, (void *)0);
-
-	if (nr_parts > 0) {
-		add_mtd_partitions(mymtd, parts, nr_parts);
-		return 0;
-	}
-#endif
-
 	/* No recognised partitioning schemes found - use defaults */
 	nr_parts = epxa_default_partitions(mymtd, &parts);
 	if (nr_parts > 0) {

Index: h720x-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/h720x-flash.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- h720x-flash.c	14 May 2003 22:26:30 -0000	1.3
+++ h720x-flash.c	16 May 2003 17:07:16 -0000	1.4
@@ -59,6 +59,7 @@
 
 static int                   nr_mtd_parts;
 static struct mtd_partition *mtd_parts;
+static const char *probes[] = { "cmdlinepart", NULL };
 
 /*
  * Initialize FLASH support
@@ -90,8 +91,8 @@
 	if (mymtd) {
 		set_module_owner(mymtd);
 
-#ifdef CONFIG_MTD_CMDLINE_PARTS
-		nr_mtd_parts = parse_cmdline_partitions(mymtd, &mtd_parts, h720x_map.name);
+#ifdef CONFIG_MTD_PARTITIONS
+		nr_mtd_parts = parse_mtd_partitions(mymtd, probes, &mtd_parts, 0);
 		if (nr_mtd_parts > 0)
 			part_type = "command line";
 #endif

Index: impa7.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/impa7.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- impa7.c	14 May 2003 22:26:30 -0000	1.5
+++ impa7.c	16 May 2003 17:07:16 -0000	1.6
@@ -71,6 +71,7 @@
 
 static int                   mtd_parts_nb = 0;
 static struct mtd_partition *mtd_parts    = 0;
+static const char *probes[] = { "cmdlinepart", NULL };
 
 int __init init_impa7(void)
 {
@@ -111,11 +112,10 @@
 			add_mtd_device(impa7_mtd[i]);
 			devicesfound++;
 #ifdef CONFIG_MTD_PARTITIONS
-#ifdef CONFIG_MTD_CMDLINE_PARTS
-			sprintf(mtdid, MTDID, i);
-			mtd_parts_nb = parse_cmdline_partitions(impa7_mtd[i], 
-								&mtd_parts, 
-								mtdid);
+			mtd_parts_nb = parse_mtd_partitions(impa7_mtd[i], 
+							    probes,
+							    &mtd_parts, 
+							    0);
 			if (mtd_parts_nb > 0)
 			  part_type = "command line";
 #endif

Index: integrator-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/integrator-flash.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- integrator-flash.c	14 May 2003 22:26:30 -0000	1.10
+++ integrator-flash.c	16 May 2003 17:07:16 -0000	1.11
@@ -161,6 +161,7 @@
 
 static struct mtd_info *mtd;
 static struct mtd_partition *parts;
+static const char *probes[] = { "RedBoot", "afs", NULL };
 
 static int __init armflash_cfi_init(void *base, u_int size)
 {
@@ -189,7 +190,7 @@
 
 	set_module_owner(mtd);
 
-	ret = parse_afs_partitions(mtd, &parts, (void *)0);
+	ret = parse_mtd_partitions(mtd, probes, &parts, (void *)0);
 	if (ret > 0) {
 		ret = add_mtd_partitions(mtd, parts, ret);
 		if (ret)

Index: iq80310.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/iq80310.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- iq80310.c	14 May 2003 22:26:30 -0000	1.12
+++ iq80310.c	16 May 2003 17:07:16 -0000	1.13
@@ -59,13 +59,14 @@
 
 static struct mtd_info *mymtd;
 static struct mtd_partition *parsed_parts;
+static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
 
 static int __init init_iq80310(void)
 {
 	struct mtd_partition *parts;
 	int nb_parts = 0;
 	int parsed_nr_parts = 0;
-	char *part_type = "static";
+	int ret;
 
 	iq80310_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
 	if (!iq80310_map.virt) {
@@ -81,16 +82,10 @@
 	}
 	set_module_owner(mymtd);
 
-#ifdef CONFIG_MTD_REDBOOT_PARTS
-	if (parsed_nr_parts == 0) {
-		int ret = parse_redboot_partitions(mymtd, &parsed_parts, (void *)0);
-
-		if (ret > 0) {
-			part_type = "RedBoot";
-			parsed_nr_parts = ret;
-		}
-	}
-#endif
+	ret = parse_mtd_partitions(mymtd, probes, &parsed_parts, 0);
+
+	if (ret > 0)
+		parsed_nr_parts = ret;
 
 	if (parsed_nr_parts > 0) {
 		parts = parsed_parts;
@@ -99,7 +94,6 @@
 		parts = iq80310_partitions;
 		nb_parts = NB_OF(iq80310_partitions);
 	}
-	printk(KERN_NOTICE "Using %s partition definition\n", part_type);
 	add_mtd_partitions(mymtd, parts, nb_parts);
 	return 0;
 }

Index: ocelot.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ocelot.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ocelot.c	14 May 2003 22:26:30 -0000	1.9
+++ ocelot.c	16 May 2003 17:07:16 -0000	1.10
@@ -59,6 +59,8 @@
 	.phys = NVRAM_WINDOW_ADDR,
 };
 
+static const char *probes[] = { "RedBoot", NULL };
+
 static int __init init_ocelot_maps(void)
 {
 	void *pld;
@@ -127,9 +129,9 @@
 	add_mtd_device(nvram_mtd);
 
 	set_module_owner(flash_mtd);
-	nr_parts = parse_redboot_partitions(flash_mtd, &parsed_parts, (void *)0);
+	nr_parts = parse_mtd_partitions(flash_mtd, probes, &parsed_parts, 0);
 
-	if (nr_parts)
+	if (nr_parts > 0)
 		add_mtd_partitions(flash_mtd, parsed_parts, nr_parts);
 	else
 		add_mtd_device(flash_mtd);

Index: physmap.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/physmap.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- physmap.c	14 May 2003 22:26:31 -0000	1.24
+++ physmap.c	16 May 2003 17:07:16 -0000	1.25
@@ -11,10 +11,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/config.h>
-
-#ifdef CONFIG_MTD_PARTITIONS
 #include <linux/mtd/partitions.h>
-#endif
 
 #define WINDOW_ADDR CONFIG_MTD_PHYSMAP_START
 #define WINDOW_SIZE CONFIG_MTD_PHYSMAP_LEN
@@ -31,40 +28,38 @@
 };
 
 #ifdef CONFIG_MTD_PARTITIONS
-#ifdef CONFIG_MTD_CMDLINE_PARTS
-static struct mtd_partition *mtd_parts = 0;
-static int                   mtd_parts_nb = 0;
-#else
+static struct mtd_partition *mtd_parts;
+static int                   mtd_parts_nb;
+
 static struct mtd_partition physmap_partitions[] = {
-/* Put your own partition definitions here */
 #if 0
+/* Put your own partition definitions here */
 	{
 		.name =		"bootROM",
 		.size =		0x80000,
-		.offset =		0,
+		.offset =	0,
 		.mask_flags =	MTD_WRITEABLE,  /* force read-only */
 	}, {
 		.name =		"zImage",
 		.size =		0x100000,
-		.offset =		MTDPART_OFS_APPEND,
+		.offset =	MTDPART_OFS_APPEND,
 		.mask_flags =	MTD_WRITEABLE,  /* force read-only */
 	}, {
 		.name =		"ramdisk.gz",
 		.size =		0x300000,
-		.offset =		MTDPART_OFS_APPEND,
+		.offset =	MTDPART_OFS_APPEND,
 		.mask_flags =	MTD_WRITEABLE,  /* force read-only */
 	}, {
 		.name =		"User FS",
 		.size =		MTDPART_SIZ_FULL,
-		.offset =		MTDPART_OFS_APPEND,
+		.offset =	MTDPART_OFS_APPEND,
 	}
 #endif
 };
 
 #define NUM_PARTITIONS	(sizeof(physmap_partitions)/sizeof(struct mtd_partition))
 
-#endif
-#endif
+#endif /* CONFIG_MTD_PARTITIONS */
 
 int __init init_physmap(void)
 {
@@ -89,27 +84,27 @@
 	if (mymtd) {
 		set_module_owner(mymtd);
 
-		add_mtd_device(mymtd);
 #ifdef CONFIG_MTD_PARTITIONS
-#ifdef CONFIG_MTD_CMDLINE_PARTS
-		mtd_parts_nb = parse_cmdline_partitions(mymtd, &mtd_parts, 
-							"phys");
+		mtd_parts_nb = parse_mtd_partitions(mymtd, probes, 
+						    &mtd_parts, 0);
+
 		if (mtd_parts_nb > 0)
 		{
-			printk(KERN_NOTICE 
-			       "Using command line partition definition\n");
 			add_mtd_partitions (mymtd, mtd_parts, mtd_parts_nb);
+			return 0;
 		}
-#else
+
 		if (NUM_PARTITIONS != 0) 
 		{
 			printk(KERN_NOTICE 
 			       "Using physmap partition definition\n");
 			add_mtd_partitions (mymtd, physmap_partitions, NUM_PARTITIONS);
+			return 0;
 		}
 
 #endif
-#endif
+		add_mtd_device(mymtd);
+
 		return 0;
 	}
 
@@ -119,14 +114,22 @@
 
 static void __exit cleanup_physmap(void)
 {
-	if (mymtd) {
+#ifdef CONFIG_MTD_PARTITIONS
+	if (mtd_parts_nb) {
+		del_mtd_partitions(mymtd);
+		kfree(mtd_parts);
+	} else if (NUM_PARTITIONS) {
+		del_mtd_partions(mymtd);
+	} else {
 		del_mtd_device(mymtd);
-		map_destroy(mymtd);
-	}
-	if (physmap_map.virt) {
-		iounmap((void *)physmap_map.virt);
-		physmap_map.virt = 0;
 	}
+#else
+	del_mtd_device(mymtd);
+#endif
+	map_destroy(mymtd);
+
+	iounmap((void *)physmap_map.virt);
+	physmap_map.virt = 0;
 }
 
 module_init(init_physmap);

Index: sa1100-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sa1100-flash.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- sa1100-flash.c	14 May 2003 22:26:31 -0000	1.32
+++ sa1100-flash.c	16 May 2003 17:07:16 -0000	1.33
@@ -717,17 +717,15 @@
 };
 #endif
 
-extern int parse_bootldr_partitions(struct mtd_info *master, struct mtd_partition **pparts);
-
 static struct mtd_partition *parsed_parts;
 static struct mtd_info *mymtd;
+static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
 
 int __init sa1100_mtd_init(void)
 {
 	struct mtd_partition *parts;
 	int nb_parts = 0, ret;
 	int parsed_nr_parts = 0;
-	const char *part_type;
 	unsigned long base = -1UL;
 
 	/* Default flash buswidth */
@@ -736,7 +734,6 @@
 	/*
 	 * Static partition definition selection
 	 */
-	part_type = "static";
 
 #ifdef CONFIG_SA1100_ADSBITSY
 	if (machine_is_adsbitsy()) {
@@ -918,25 +915,10 @@
 	/*
 	 * Dynamic partition selection stuff (might override the static ones)
 	 */
-#ifdef CONFIG_MTD_REDBOOT_PARTS
-	if (parsed_nr_parts == 0) {
-		int ret = parse_redboot_partitions(mymtd, &parsed_parts, (void *)0);
-
-		if (ret > 0) {
-			part_type = "RedBoot";
-			parsed_nr_parts = ret;
-		}
-	}
-#endif
-#ifdef CONFIG_MTD_CMDLINE_PARTS
-	if (parsed_nr_parts == 0) {
-		int ret = parse_cmdline_partitions(mymtd, &parsed_parts, "sa1100");
-		if (ret > 0) {
-			part_type = "Command Line";
-			parsed_nr_parts = ret;
-		}
-	}
-#endif
+	int ret = parse_mtd_partitions(mymtd, probes, &parsed_parts, 0);
+
+	if (ret > 0)
+		parsed_nr_parts = ret;
 
 	if (parsed_nr_parts > 0) {
 		parts = parsed_parts;
@@ -947,7 +929,6 @@
 		printk(KERN_NOTICE "SA1100 flash: no partition info available, registering whole flash at once\n");
 		add_mtd_device(mymtd);
 	} else {
-		printk(KERN_NOTICE "Using %s partition definition\n", part_type);
 		add_mtd_partitions(mymtd, parts, nb_parts);
 	}
 	return 0;

Index: solutionengine.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/solutionengine.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- solutionengine.c	14 May 2003 22:26:31 -0000	1.7
+++ solutionengine.c	16 May 2003 17:07:16 -0000	1.8
@@ -35,6 +35,8 @@
 	.buswidth = 4,
 };
 
+static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
+
 #ifdef CONFIG_MTD_SUPERH_RESERVE
 static struct mtd_partition superh_se_partitions[] = {
 	/* Reserved for boot code, read-only */
@@ -92,15 +94,10 @@
 		add_mtd_device(eprom_mtd);
 	}
 
-#ifdef CONFIG_MTD_REDBOOT_PARTS
-	nr_parts = parse_redboot_partitions(flash_mtd, &parsed_parts, (void *)0);
-	if (nr_parts > 0)
-		printk(KERN_NOTICE "Found RedBoot partition table.\n");
-	else if (nr_parts < 0)
-		printk(KERN_NOTICE "Error looking for RedBoot partitions.\n");
-#endif /* CONFIG_MTD_REDBOOT_PARTS */
+	nr_parts = parse_mtd_partitions(flash_mtd, probes, &parsed_parts, 0);
+
 #if CONFIG_MTD_SUPERH_RESERVE
-	if (nr_parts == 0) {
+	if (nr_parts <= 0) {
 		printk(KERN_NOTICE "Using configured partition at 0x%08x.\n",
 		       CONFIG_MTD_SUPERH_RESERVE);
 		parsed_parts = superh_se_partitions;


From dwmw2 at infradead.org  Fri May 16 13:08:27 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:16 2006
Subject: mtd/drivers/mtd afs.c,1.10,1.11 cmdlinepart.c,1.8,1.9
	redboot.c,1.8,1.9
Message-ID: <E19Gih1-0007EK-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv27785

Modified Files:
	afs.c cmdlinepart.c redboot.c 
Log Message:
unexport old parse routines

Index: afs.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/afs.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- afs.c	16 May 2003 16:11:07 -0000	1.10
+++ afs.c	16 May 2003 17:08:24 -0000	1.11
@@ -125,7 +125,7 @@
 	return ret;
 }
 
-int parse_afs_partitions(struct mtd_info *mtd, 
+static int parse_afs_partitions(struct mtd_info *mtd, 
                          struct mtd_partition **pparts,
                          unsigned long origin)
 {
@@ -228,9 +228,6 @@
 	*pparts = parts;
 	return idx ? idx : ret;
 }
-
-EXPORT_SYMBOL(parse_afs_partitions);
-
 
 static struct mtd_part_parser afs_parser = {
 	.owner = THIS_MODULE,

Index: cmdlinepart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/cmdlinepart.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- cmdlinepart.c	16 May 2003 16:11:07 -0000	1.8
+++ cmdlinepart.c	16 May 2003 17:08:24 -0000	1.9
@@ -291,7 +291,7 @@
  * information. It returns partitions for the requested mtd device, or
  * the first one in the chain if a NULL mtd_id is passed in.
  */
-int parse_cmdline_partitions(struct mtd_info *master, 
+static int parse_cmdline_partitions(struct mtd_info *master, 
                              struct mtd_partition **pparts,
                              unsigned long origin)
 {
@@ -349,9 +349,6 @@
 }
 
 __setup("mtdparts=", mtdpart_setup);
-
-EXPORT_SYMBOL(parse_cmdline_partitions);
-
 
 static struct mtd_part_parser cmdline_parser = {
 	.owner = THIS_MODULE,

Index: redboot.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/redboot.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- redboot.c	16 May 2003 16:07:06 -0000	1.8
+++ redboot.c	16 May 2003 17:08:24 -0000	1.9
@@ -34,9 +34,9 @@
 	return 1;
 }
 
-int parse_redboot_partitions(struct mtd_info *master, 
+static int parse_redboot_partitions(struct mtd_info *master, 
                              struct mtd_partition **pparts,
-                             void *fis_origin)
+                             unsigned long fis_origin)
 {
 	int nrparts = 0;
 	struct fis_image_desc *buf;
@@ -93,7 +93,7 @@
 		}
 		new_fl->img = &buf[i];
                 if (fis_origin) {
-                        buf[i].flash_base -= (unsigned long)fis_origin;
+                        buf[i].flash_base -= fis_origin;
                 } else {
                         buf[i].flash_base &= master->size-1;
                 }
@@ -160,8 +160,6 @@
 	kfree(buf);
 	return ret;
 }
-
-EXPORT_SYMBOL(parse_redboot_partitions);
 
 static struct mtd_part_parser redboot_parser = {
 	.owner = THIS_MODULE,


From dwmw2 at infradead.org  Fri May 16 13:25:34 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:16 2006
Subject: mtd/drivers/mtd/maps lubbock-flash.c,1.5,1.6
Message-ID: <E19Gixa-0007LU-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv28217

Modified Files:
	lubbock-flash.c 
Log Message:
del_mtd_partitions even when we used the static ones


Index: lubbock-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/lubbock-flash.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- lubbock-flash.c	16 May 2003 16:07:22 -0000	1.5
+++ lubbock-flash.c	16 May 2003 17:25:31 -0000	1.6
@@ -131,7 +131,7 @@
 		if (!mymtds[i])
 			continue;
 
-		if (nr_parsed_parts[i])
+		if (nr_parsed_parts[i] || !i)
 			del_mtd_partitions(mymtds[i]);
 		else
 			del_mtd_device(mymtds[i]);			


From dwmw2 at infradead.org  Fri May 16 14:45:28 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:16 2006
Subject: mtd/fs/jffs2 os-linux.h,1.25,1.26
Message-ID: <E19GkCu-000893-00@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv31306

Modified Files:
	os-linux.h 
Log Message:
sig structs changed again

Index: os-linux.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/os-linux.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- os-linux.h	23 Jan 2003 11:05:07 -0000	1.25
+++ os-linux.h	16 May 2003 18:45:25 -0000	1.26
@@ -71,7 +71,7 @@
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,40)
 #define current_sig_lock current->sigmask_lock
 #else
-#define current_sig_lock current->sig->siglock
+#define current_sig_lock current->sighand->siglock
 #endif
 
 #define sleep_on_spinunlock(wq, s)				\


From dwmw2 at infradead.org  Fri May 16 14:53:45 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:16 2006
Subject: mtd/include/linux/mtd map.h,1.30,1.31
Message-ID: <E19GkKv-0000C2-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv723

Modified Files:
	map.h 
Log Message:
Fix map_is_linear macro


Index: map.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/map.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- map.h	14 May 2003 15:05:17 -0000	1.30
+++ map.h	16 May 2003 18:53:42 -0000	1.31
@@ -182,8 +182,8 @@
 }
 
 #define simple_map_init(map) do { } while (0)
-#define map_is_linear(struct map_info *map) (1)
+#define map_is_linear(map) (1)
 
-#endif /* !CONFIG_COMPLEX_MAPPINGS */
+#endif /* !CONFIG_MTD_COMPLEX_MAPPINGS */
 
 #endif /* __LINUX_MTD_MAP_H__ */


From dwmw2 at infradead.org  Fri May 16 14:55:46 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:16 2006
Subject: mtd/include/linux/mtd cfi.h,1.33,1.34
Message-ID: <E19GkMs-0000DA-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv793

Modified Files:
	cfi.h 
Log Message:
Fix map_read/write calls


Index: cfi.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/cfi.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- cfi.h	14 May 2003 15:05:17 -0000	1.33
+++ cfi.h	16 May 2003 18:55:44 -0000	1.34
@@ -387,13 +387,13 @@
 static inline cfi_word cfi_read(struct map_info *map, __u32 addr)
 {
 	if (cfi_buswidth_is_1()) {
-		return map->read8(map, addr);
+		return map_read8(map, addr);
 	} else if (cfi_buswidth_is_2()) {
-		return map->read16(map, addr);
+		return map_read16(map, addr);
 	} else if (cfi_buswidth_is_4()) {
-		return map->read32(map, addr);
+		return map_read32(map, addr);
 	} else if (cfi_buswidth_is_8()) {
-		return map->read64(map, addr);
+		return map_read64(map, addr);
 	} else {
 		return 0;
 	}
@@ -406,13 +406,13 @@
 static inline void cfi_write(struct map_info *map, cfi_word val, __u32 addr)
 {
 	if (cfi_buswidth_is_1()) {
-		map->write8(map, val, addr);
+		map_write8(map, val, addr);
 	} else if (cfi_buswidth_is_2()) {
-		map->write16(map, val, addr);
+		map_write16(map, val, addr);
 	} else if (cfi_buswidth_is_4()) {
-		map->write32(map, val, addr);
+		map_write32(map, val, addr);
 	} else if (cfi_buswidth_is_8()) {
-		map->write64(map, val, addr);
+		map_write64(map, val, addr);
 	}
 }
 
@@ -443,13 +443,13 @@
 static inline __u8 cfi_read_query(struct map_info *map, __u32 addr)
 {
 	if (cfi_buswidth_is_1()) {
-		return map->read8(map, addr);
+		return map_read8(map, addr);
 	} else if (cfi_buswidth_is_2()) {
-		return cfi16_to_cpu(map->read16(map, addr));
+		return cfi16_to_cpu(map_read16(map, addr));
 	} else if (cfi_buswidth_is_4()) {
-		return cfi32_to_cpu(map->read32(map, addr));
+		return cfi32_to_cpu(map_read32(map, addr));
 	} else if (cfi_buswidth_is_8()) {
-		return cfi64_to_cpu(map->read64(map, addr));
+		return cfi64_to_cpu(map_read64(map, addr));
 	} else {
 		return 0;
 	}


From dwmw2 at infradead.org  Fri May 16 20:00:15 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:16 2006
Subject: mtd/drivers/mtd/maps Makefile,1.41,1.42
Message-ID: <E19Gp7X-0003EQ-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv12420

Modified Files:
	Makefile 
Log Message:
fix map_funcs rule

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Makefile,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- Makefile	14 May 2003 15:05:14 -0000	1.41
+++ Makefile	17 May 2003 00:00:12 -0000	1.42
@@ -12,7 +12,7 @@
 export-objs := map_funcs.o
 
 ifeq ($(CONFIG_MTD_COMPLEX_MAPPINGS),y)
-obj-m				+= map_funcs.o
+obj-$(CONFIG_MTD)		+= map_funcs.o
 endif
 
 # Chip mappings


From dwmw2 at infradead.org  Fri May 16 20:00:53 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:16 2006
Subject: mtd/drivers/mtd/maps Config.in,1.48,1.49
Message-ID: <E19Gp89-0003EZ-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv12429

Modified Files:
	Config.in 
Log Message:
missing config option for complex mappings

Index: Config.in
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Config.in,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- Config.in	14 May 2003 15:05:14 -0000	1.48
+++ Config.in	17 May 2003 00:00:51 -0000	1.49
@@ -6,6 +6,8 @@
 
 comment 'Mapping drivers for chip access'
 
+bool '  Support for non-linear mappings of flash chips' CONFIG_MTD_COMPLEX_MAPPINGS
+
 dep_tristate '  CFI Flash device in physical memory map' CONFIG_MTD_PHYSMAP $CONFIG_MTD_GEN_PROBE
 if [ "$CONFIG_MTD_PHYSMAP" = "y" -o "$CONFIG_MTD_PHYSMAP" = "m" ]; then
    hex '    Physical start address of flash mapping' CONFIG_MTD_PHYSMAP_START 0x8000000


From dwmw2 at infradead.org  Fri May 16 20:22:38 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:17 2006
Subject: mtd/include/linux/mtd compatmac.h,1.51,1.52
Message-ID: <E19GpTC-0003Gs-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv12572

Modified Files:
	compatmac.h 
Log Message:
fix __module_get for built-in case

Index: compatmac.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/compatmac.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- compatmac.h	16 May 2003 10:06:53 -0000	1.51
+++ compatmac.h	17 May 2003 00:22:35 -0000	1.52
@@ -599,7 +599,7 @@
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,60)
 #define try_module_get(m) ({ __MOD_INC_USE_COUNT(m), 1; })
-#define __module_get(m) ({ __MOD_INC_USE_COUNT(m), 1; })
+#define __module_get(m) ({ ({if (m) __MOD_INC_USE_COUNT((struct module *)(m));}),1; })
 #define module_put(m) do { __MOD_DEC_USE_COUNT(m); } while(0)
 #define set_module_owner(x) do { x->owner = THIS_MODULE; } while(0)
 #endif


From dwmw2 at infradead.org  Fri May 16 20:24:27 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:17 2006
Subject: mtd/include/linux/mtd compatmac.h,1.52,1.53
Message-ID: <E19GpUx-0003HC-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv12592

Modified Files:
	compatmac.h 
Log Message:
fix try__module_get and module_put for built-in case

Index: compatmac.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/compatmac.h,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- compatmac.h	17 May 2003 00:22:35 -0000	1.52
+++ compatmac.h	17 May 2003 00:24:24 -0000	1.53
@@ -598,9 +598,9 @@
 #endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,60)
-#define try_module_get(m) ({ __MOD_INC_USE_COUNT(m), 1; })
+#define try_module_get(m) ({ ({if (m) __MOD_INC_USE_COUNT((struct module *)(m));}),1; })
 #define __module_get(m) ({ ({if (m) __MOD_INC_USE_COUNT((struct module *)(m));}),1; })
-#define module_put(m) do { __MOD_DEC_USE_COUNT(m); } while(0)
+#define module_put(m) do { if (m) __MOD_DEC_USE_COUNT((struct module *)(m)); } while(0)
 #define set_module_owner(x) do { x->owner = THIS_MODULE; } while(0)
 #endif
 


From dwmw2 at infradead.org  Fri May 16 20:25:49 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:17 2006
Subject: mtd/drivers/mtd mtdpart.c,1.36,1.37
Message-ID: <E19GpWH-0003I9-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv12634

Modified Files:
	mtdpart.c 
Log Message:
Include kmod.h for request_module


Index: mtdpart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdpart.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- mtdpart.c	16 May 2003 16:06:44 -0000	1.36
+++ mtdpart.c	17 May 2003 00:25:47 -0000	1.37
@@ -16,7 +16,7 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/list.h>
-
+#include <linux/kmod.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 


From dwmw2 at infradead.org  Fri May 16 20:26:42 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:17 2006
Subject: mtd/drivers/mtd mtdpart.c,1.37,1.38
Message-ID: <E19GpX8-0003IO-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv12666

Modified Files:
	mtdpart.c 
Log Message:
and config.h

Index: mtdpart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdpart.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- mtdpart.c	17 May 2003 00:25:47 -0000	1.37
+++ mtdpart.c	17 May 2003 00:26:39 -0000	1.38
@@ -16,6 +16,7 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/list.h>
+#include <linux/config.h>
 #include <linux/kmod.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>


From dwmw2 at infradead.org  Fri May 16 20:32:44 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:17 2006
Subject: mtd/drivers/mtd Makefile,1.68,1.69
Message-ID: <E19Gpcy-0003JN-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv12727

Modified Files:
	Makefile 
Log Message:
fix link order for partition parsers

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/Makefile,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- Makefile	27 Nov 2002 10:35:08 -0000	1.68
+++ Makefile	17 May 2003 00:32:41 -0000	1.69
@@ -17,25 +17,6 @@
 
 BELOW25		:= $(shell echo $(PATCHLEVEL) | sed s/[1234]/y/)
 
-ifeq ($(BELOW25),y)
-obj-y           += chips/chipslink.o maps/mapslink.o \
-			devices/devlink.o nand/nandlink.o
-obj-m           :=
-obj-n           :=
-obj-            :=
-
-O_TARGET	:= mtdlink.o
-
-list-multi	:= nftl.o mtdblock.o
-
-mod-subdirs	:= 
-subdir-y	:= chips maps devices nand
-subdir-m	:= $(subdir-y)
-mtdblock-objs	+= mtdblock-24.o
-else
-obj-y           += chips/ maps/ devices/ nand/
-mtdblock-objs	+= mtdblock-25.o
-endif
 
 #                       *** BIG UGLY NOTE ***
 #
@@ -68,6 +49,25 @@
 obj-$(CONFIG_FTL)		+= ftl.o
 obj-$(CONFIG_NFTL)		+= nftl.o
 
+ifeq ($(BELOW25),y)
+obj-y           += chips/chipslink.o maps/mapslink.o \
+			devices/devlink.o nand/nandlink.o
+obj-m           :=
+obj-n           :=
+obj-            :=
+
+O_TARGET	:= mtdlink.o
+
+list-multi	:= nftl.o mtdblock.o
+
+mod-subdirs	:= 
+subdir-y	:= chips maps devices nand
+subdir-m	:= $(subdir-y)
+mtdblock-objs	+= mtdblock-24.o
+else
+obj-y           += chips/ maps/ devices/ nand/
+mtdblock-objs	+= mtdblock-25.o
+endif
 
 include $(TOPDIR)/Rules.make
 


From dwmw2 at infradead.org  Fri May 16 21:08:53 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:17 2006
Subject: mtd/fs/jffs2 background.c,1.36,1.37
Message-ID: <E19GqBx-0003nT-00@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv14593

Modified Files:
	background.c 
Log Message:
more 2.5 chasing

Index: background.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/background.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- background.c	19 Feb 2003 17:50:26 -0000	1.36
+++ background.c	17 May 2003 01:08:50 -0000	1.37
@@ -81,13 +81,11 @@
 {
 	struct jffs2_sb_info *c = _c;
 
-	daemonize();
+	daemonize("jffs2_gcd_mtd%d", c->mtd->index);
 
 	c->gc_task = current;
 	up(&c->gc_thread_start);
 
-	sprintf(current->comm, "jffs2_gcd_mtd%d", c->mtd->index);
-
 	set_user_nice(current, 10);
 
 	for (;;) {
@@ -115,7 +113,7 @@
 			unsigned long signr;
 
 			spin_lock_irq(&current_sig_lock);
-			signr = dequeue_signal(&current->blocked, &info);
+			signr = dequeue_signal(current, &current->blocked, &info);
 			spin_unlock_irq(&current_sig_lock);
 
 			switch(signr) {


From dwmw2 at infradead.org  Fri May 16 23:34:31 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:17 2006
Subject: mtd/include/linux/mtd compatmac.h,1.53,1.54
Message-ID: <E19GsSt-0004uq-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv18894

Modified Files:
	compatmac.h 
Log Message:
fix cond_resched

Index: compatmac.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/compatmac.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- compatmac.h	17 May 2003 00:24:24 -0000	1.53
+++ compatmac.h	17 May 2003 03:34:28 -0000	1.54
@@ -499,7 +499,7 @@
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,3)
 #define need_resched() (current->need_resched)
-#define cond_resched() do { if need_resched() schedule(); } while(0)
+#define cond_resched() do { int oldstate; if need_resched() { oldstate = current->state ; set_current_state(TASK_RUNNING); schedule(); set_current_state(oldstate); } } while(0)
 #endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)


From dwmw2 at infradead.org  Sun May 18 06:50:28 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:17 2006
Subject: mtd/drivers/mtd Makefile,1.69,1.70
Message-ID: <E19HLkK-00069d-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv23638

Modified Files:
	Makefile 
Log Message:
Don't clear obj-m

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/Makefile,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- Makefile	17 May 2003 00:32:41 -0000	1.69
+++ Makefile	18 May 2003 10:50:25 -0000	1.70
@@ -35,7 +35,7 @@
 # dwmw2 21/11/0
 
 # Core functionality.
-obj-$(CONFIG_MTD)		+= mtdcore.o
+obj-$(CONFIG_MTD)		+= mtdcore.o mtd_blkdevs.o new_mtdblock.o
 obj-$(CONFIG_MTD_CONCAT)	+= mtdconcat.o
 obj-$(CONFIG_MTD_PARTITIONS)	+= mtdpart.o
 obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o
@@ -52,9 +52,6 @@
 ifeq ($(BELOW25),y)
 obj-y           += chips/chipslink.o maps/mapslink.o \
 			devices/devlink.o nand/nandlink.o
-obj-m           :=
-obj-n           :=
-obj-            :=
 
 O_TARGET	:= mtdlink.o
 


From dwmw2 at infradead.org  Sun May 18 09:10:24 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:17 2006
Subject: mtd/include/linux/mtd blktrans.h,NONE,1.1
Message-ID: <E19HNvk-0007Gn-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv27925/include/linux/mtd

Added Files:
	blktrans.h 
Log Message:
First pass at abstracting out all the blkdev crap for the translation layers

***** Error reading new file: [Errno 2] No such file or directory: 'blktrans.h'

From dwmw2 at infradead.org  Sun May 18 09:10:25 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:17 2006
Subject: mtd/drivers/mtd mtd_blkdevs.c,NONE,1.1
Message-ID: <E19HNvl-0007Gr-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv27925/drivers/mtd

Added Files:
	mtd_blkdevs.c 
Log Message:
First pass at abstracting out all the blkdev crap for the translation layers

***** Error reading new file: [Errno 2] No such file or directory: 'mtd_blkdevs.c'

From dwmw2 at infradead.org  Sun May 18 10:29:20 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:17 2006
Subject: mtd/drivers/mtd mtd_blkdevs.c,1.1,1.2
Message-ID: <E19HPA8-0007qj-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv30154

Modified Files:
	mtd_blkdevs.c 
Log Message:
ioctl support, blkrrpart


Index: mtd_blkdevs.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mtd_blkdevs.c	18 May 2003 13:10:22 -0000	1.1
+++ mtd_blkdevs.c	18 May 2003 14:29:17 -0000	1.2
@@ -16,6 +16,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/blkdev.h>
 #include <linux/blk.h>
+#include <linux/blkpg.h>
 #include <asm/semaphore.h>
 #include <linux/mtd/compatmac.h>
 
@@ -45,6 +46,21 @@
 	}
 	return NULL;
 }
+
+static inline struct mtd_blktrans_ops *get_tr(int major)
+{
+	struct list_head *this;
+	struct mtd_blktrans_ops *t;
+
+	list_for_each(this, &blktrans_majors) {
+		t = list_entry(this, struct mtd_blktrans_ops, list);
+
+		if (t->major == major)
+			return t;
+	}
+	return NULL;
+}
+
 static int do_blktrans_request(struct mtd_blktrans_ops *tr,
 			       struct mtd_blktrans_dev *dev,
 			       struct request *req)
@@ -141,22 +157,16 @@
 
 int blktrans_open(struct inode *i, struct file *f)
 {
+	struct mtd_blktrans_ops *tr = NULL;
+	struct mtd_blktrans_dev *dev = NULL;
 	int major_nr = MAJOR(i->i_rdev);
 	int minor_nr = MINOR(i->i_rdev);
 	int devnum;
-	struct list_head *this;
-	struct mtd_blktrans_ops *tr = NULL;
-	struct mtd_blktrans_dev *dev = NULL;
 	int ret = -ENODEV;
 
 	down(&mtd_table_mutex);
 
-	list_for_each(this, &blktrans_majors) {
-		struct mtd_blktrans_ops *t = list_entry(this, struct mtd_blktrans_ops, list);
-		if (t->major == major_nr)
-			tr = t;
-		break;
-	}
+	tr = get_tr(major_nr);
 
 	if (!tr)
 		goto out;
@@ -217,11 +227,109 @@
 	return ret;
 }
 
+static int mtd_blktrans_rrpart(kdev_t rdev, struct mtd_blktrans_ops *tr,
+			       struct mtd_blktrans_dev *dev)
+{
+	struct gendisk *gd = &(tr->blkcore_priv->gd);
+	int i;
+	int minor = MINOR(rdev);
+
+	if (minor & ((1<<tr->part_bits)-1)) {
+		/* BLKRRPART on a partition. Go away. */
+		return -ENOTTY;
+	}
+
+	if (!capable(CAP_SYS_ADMIN))
+	    return -EACCES;
+
+	/* We are required to prevent simultaneous open() ourselves.
+	   The core doesn't do that for us. Did I ever mention how
+	   much the Linux block layer sucks? Sledgehammer approach... */
+	down(&mtd_table_mutex);
+
+	if (dev->usecount > 1) {
+		up(&mtd_table_mutex);
+		return -EBUSY;
+	}
+
+	for (i=0; i < (1<<tr->part_bits); i++) {
+		invalidate_device(MKDEV(tr->major, minor+i), 1);
+		gd->part[minor + i].start_sect = 0;
+		gd->part[minor + i].nr_sects = 0;
+	}
+
+	grok_partitions(gd, minor, 1 << tr->part_bits, 
+			tr->blkcore_priv->sizes[minor]);
+
+	up(&mtd_table_mutex);
+	return 0;
+}
+
+static int blktrans_ioctl(struct inode *inode, struct file *file, 
+			      unsigned int cmd, unsigned long arg)
+{
+	struct mtd_blktrans_dev *dev;
+	struct mtd_blktrans_ops *tr;
+
+	switch(cmd) {
+	case BLKGETSIZE:
+        case BLKGETSIZE64:
+        case BLKBSZSET:
+        case BLKBSZGET:
+        case BLKROSET:
+        case BLKROGET:
+        case BLKRASET:
+        case BLKRAGET:
+        case BLKPG:
+        case BLKELVGET:
+        case BLKELVSET:
+		return blk_ioctl(inode->i_rdev, cmd, arg);
+	}
+
+	if (file) {
+		dev = file->private_data;
+		tr = dev->tr;
+	} else {
+		/* Urgh. ioctl_by_bdev() calls us without a file pointer. */
+		int devnum;
+
+		down(&mtd_table_mutex);
+
+		tr = get_tr(MAJOR(inode->i_rdev));
+		if (!tr) {
+			up(&mtd_table_mutex);
+			return -ENODEV;
+		}
+
+		devnum = MINOR(inode->i_rdev) >> tr->part_bits;
+		dev = tr_get_dev(tr, devnum);
+
+		up(&mtd_table_mutex);
+
+		if (!dev)
+			return -ENODEV;
+	}		
+	switch(cmd) {
+	case BLKRRPART:
+		return mtd_blktrans_rrpart(inode->i_rdev, tr, dev);
+		
+        case BLKFLSBUF:
+		blk_ioctl(inode->i_rdev, cmd, arg);
+		if (!tr->ioctl)
+			return 0;
+
+	default:
+		if (!tr->ioctl)
+			return -ENOTTY;
+		return tr->ioctl(dev, inode, file, cmd, arg);
+	}
+}
+
 struct block_device_operations mtd_blktrans_ops = {
 	.owner		= THIS_MODULE,
 	.open		= blktrans_open,
 	.release	= blktrans_release,
-	//	.ioctl		= blktrans_ioctl,
+	.ioctl		= blktrans_ioctl,
 };
 
 
@@ -299,8 +407,10 @@
 	tr->blkcore_priv->sizes[old->devnum << tr->part_bits] = 0;
 
 	for (i = (old->devnum << tr->part_bits); 
-	     i < ((old->devnum+1) << tr->part_bits); i++)
+	     i < ((old->devnum+1) << tr->part_bits); i++) {
 		tr->blkcore_priv->part_table[i].nr_sects = 0;
+		tr->blkcore_priv->part_table[i].start_sect = 0;
+	}
 		
 	return 0;
 }


From dwmw2 at infradead.org  Sun May 18 10:40:57 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:17 2006
Subject: mtd/drivers/mtd mtd_blkdevs.c,1.2,1.3
Message-ID: <E19HPLN-0007tN-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv30318

Modified Files:
	mtd_blkdevs.c 
Log Message:
notifiers


Index: mtd_blkdevs.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- mtd_blkdevs.c	18 May 2003 14:29:17 -0000	1.2
+++ mtd_blkdevs.c	18 May 2003 14:40:54 -0000	1.3
@@ -332,7 +332,6 @@
 	.ioctl		= blktrans_ioctl,
 };
 
-
 int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
 {
 	struct mtd_blktrans_ops *tr = new->tr;
@@ -414,11 +413,50 @@
 		
 	return 0;
 }
-       
+
+void blktrans_notify_add(struct mtd_info *mtd)
+{
+	struct list_head *this, *this2, *next;
+
+	list_for_each(this, &blktrans_majors) {
+		struct mtd_blktrans_ops *tr = list_entry(this, struct mtd_blktrans_ops, list);
+
+		list_for_each_safe(this2, next, &tr->devs) {
+			struct mtd_blktrans_dev *dev = list_entry(this, struct mtd_blktrans_dev, list);
+
+			if (dev->mtd == mtd)
+				tr->remove_dev(dev);
+		}
+	}
+}
+
+void blktrans_notify_remove(struct mtd_info *mtd)
+{
+	struct list_head *this;
+
+	list_for_each(this, &blktrans_majors) {
+		struct mtd_blktrans_ops *tr = list_entry(this, struct mtd_blktrans_ops, list);
+
+		tr->add_mtd(tr, mtd);
+	}
+
+}
+
+static struct mtd_notifier blktrans_notifier = {
+	.add = blktrans_notify_add,
+	.remove = blktrans_notify_remove,
+};
+      
 int register_mtd_blktrans(struct mtd_blktrans_ops *tr)
 {
 	int ret, i;
 
+	/* Register the notifier if/when the first device type is 
+	   registered, to prevent the link/init ordering from fucking
+	   us over. */
+	if (!blktrans_notifier.list.next)
+		register_mtd_user(&blktrans_notifier);
+
 	tr->blkcore_priv = kmalloc(sizeof(*tr->blkcore_priv), GFP_KERNEL);
 	if (!tr->blkcore_priv)
 		return -ENOMEM;
@@ -494,6 +532,16 @@
 		BUG();
 	return 0;
 }
+
+static void __exit mtd_blktrans_exit(void)
+{
+	/* No race here -- if someone's currently in register_mtd_blktrans
+	   we're screwed anyway. */
+	if (blktrans_notifier.list.next)
+		unregister_mtd_user(&blktrans_notifier);
+}
+
+module_exit(mtd_blktrans_exit);
 
 MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
 MODULE_LICENSE("GPL");


From dwmw2 at infradead.org  Sun May 18 13:30:13 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:17 2006
Subject: mtd/drivers/mtd mtd_blkdevs.c,1.3,1.4
Message-ID: <E19HRzB-00013c-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv4045

Modified Files:
	mtd_blkdevs.c 
Log Message:
Wheee. Actually bloody works, at least without partitions.


Index: mtd_blkdevs.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- mtd_blkdevs.c	18 May 2003 14:40:54 -0000	1.3
+++ mtd_blkdevs.c	18 May 2003 17:30:09 -0000	1.4
@@ -125,12 +125,13 @@
 		   at the head of the queue */
 		spin_unlock_irq(&io_request_lock);
 
-		/* Hmmm. Where can we store the dev, on which
-		   we already have a refcount anyway? This locking
-		   sucks */
-		down(&mtd_table_mutex);
+		/* FIXME: Where can we store the dev, on which
+		   we already have a refcount anyway? This deadlocks
+		   with grok_partitions called from the registration
+		   callbacks. */
+//		down(&mtd_table_mutex);
 		dev = tr_get_dev(tr, devnum);
-		up(&mtd_table_mutex);
+//		up(&mtd_table_mutex);
 
 		if (!dev) {
 			/* We'd BUG() but it's rude to do so when we know
@@ -147,11 +148,10 @@
 	relock:
 		spin_lock_irq(&io_request_lock);
 
-		if (end_that_request_first(req, res, tr->name))
-			return;
-
-		blkdev_dequeue_request(req);
-		end_that_request_last(req);
+		if (!end_that_request_first(req, res, tr->name)) {
+			blkdev_dequeue_request(req);
+			end_that_request_last(req);
+		}
 	}
 }
 
@@ -188,8 +188,7 @@
 	dev->usecount++;
 	tr->usecount++;
 
-	f->private_data = dev;
-
+	ret = 0;
 	if (tr->open && (ret = tr->open(dev, i, f))) {
 		tr->usecount--;
 		dev->usecount--;
@@ -205,12 +204,27 @@
 
 int blktrans_release(struct inode *i, struct file *f)
 {
-	struct mtd_blktrans_dev *dev = f->private_data;
-	struct mtd_blktrans_ops *tr = dev->tr;
+	struct mtd_blktrans_dev *dev;
+	struct mtd_blktrans_ops *tr;
 	int ret = 0;
+	int devnum;
 
 	down(&mtd_table_mutex);
 
+	tr = get_tr(MAJOR(i->i_rdev));
+	if (!tr) {
+		up(&mtd_table_mutex);
+		return -ENODEV;
+	}
+
+	devnum = MINOR(i->i_rdev) >> tr->part_bits;
+	dev = tr_get_dev(tr, devnum);
+
+	if (!dev) {
+		up(&mtd_table_mutex);
+		return -ENODEV;
+	}
+
 	if (tr->release)
 		ret = tr->release(dev, i, f);
 
@@ -234,7 +248,7 @@
 	int i;
 	int minor = MINOR(rdev);
 
-	if (minor & ((1<<tr->part_bits)-1)) {
+	if (minor & ((1<<tr->part_bits)-1) || !tr->part_bits) {
 		/* BLKRRPART on a partition. Go away. */
 		return -ENOTTY;
 	}
@@ -260,8 +274,8 @@
 
 	grok_partitions(gd, minor, 1 << tr->part_bits, 
 			tr->blkcore_priv->sizes[minor]);
-
 	up(&mtd_table_mutex);
+
 	return 0;
 }
 
@@ -270,6 +284,7 @@
 {
 	struct mtd_blktrans_dev *dev;
 	struct mtd_blktrans_ops *tr;
+	int devnum;
 
 	switch(cmd) {
 	case BLKGETSIZE:
@@ -286,29 +301,22 @@
 		return blk_ioctl(inode->i_rdev, cmd, arg);
 	}
 
-	if (file) {
-		dev = file->private_data;
-		tr = dev->tr;
-	} else {
-		/* Urgh. ioctl_by_bdev() calls us without a file pointer. */
-		int devnum;
-
-		down(&mtd_table_mutex);
-
-		tr = get_tr(MAJOR(inode->i_rdev));
-		if (!tr) {
-			up(&mtd_table_mutex);
-			return -ENODEV;
-		}
-
-		devnum = MINOR(inode->i_rdev) >> tr->part_bits;
-		dev = tr_get_dev(tr, devnum);
+	down(&mtd_table_mutex);
 
+	tr = get_tr(MAJOR(inode->i_rdev));
+	if (!tr) {
 		up(&mtd_table_mutex);
+		return -ENODEV;
+	}
+
+	devnum = MINOR(inode->i_rdev) >> tr->part_bits;
+	dev = tr_get_dev(tr, devnum);
+
+	up(&mtd_table_mutex);
+
+	if (!dev)
+		return -ENODEV;
 
-		if (!dev)
-			return -ENODEV;
-	}		
 	switch(cmd) {
 	case BLKRRPART:
 		return mtd_blktrans_rrpart(inode->i_rdev, tr, dev);
@@ -383,8 +391,10 @@
 	tr->blkcore_priv->gd.nr_real++;
 	tr->blkcore_priv->part_table[new->devnum << tr->part_bits].nr_sects = new->size;
 
-	grok_partitions(&tr->blkcore_priv->gd, new->devnum,
-			1 << tr->part_bits, new->size);
+	if (tr->part_bits) {
+		grok_partitions(&tr->blkcore_priv->gd, new->devnum,
+				1 << tr->part_bits, new->size);
+	}
 	return 0;
 }
 
@@ -414,7 +424,7 @@
 	return 0;
 }
 
-void blktrans_notify_add(struct mtd_info *mtd)
+void blktrans_notify_remove(struct mtd_info *mtd)
 {
 	struct list_head *this, *this2, *next;
 
@@ -430,7 +440,7 @@
 	}
 }
 
-void blktrans_notify_remove(struct mtd_info *mtd)
+void blktrans_notify_add(struct mtd_info *mtd)
 {
 	struct list_head *this;
 
@@ -505,7 +515,6 @@
 int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr)
 {
 	struct list_head *this, *next;
-
 	down(&mtd_table_mutex);
 	if (tr->usecount) {
 		up(&mtd_table_mutex);


From dwmw2 at infradead.org  Sun May 18 13:42:15 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:18 2006
Subject: mtd/drivers/mtd mtd_blkdevs.c,1.4,1.5
Message-ID: <E19HSAp-0001X8-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv5875

Modified Files:
	mtd_blkdevs.c 
Log Message:
Don't allow open of absent partitions


Index: mtd_blkdevs.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- mtd_blkdevs.c	18 May 2003 17:30:09 -0000	1.4
+++ mtd_blkdevs.c	18 May 2003 17:42:12 -0000	1.5
@@ -178,6 +178,11 @@
 	if (!dev)
 		goto out;
 
+	if (!tr->blkcore_priv->part_table[minor_nr].nr_sects) {
+		ret = -ENODEV;
+		goto out;
+	}
+
 	if (!try_module_get(dev->mtd->owner))
 		goto out;
 
@@ -380,12 +385,6 @@
 	init_MUTEX(&new->sem);
 	list_add_tail(&new->list, &tr->devs);
  added:
-	printk("New blktrans device for %s added as device #%d\n",
-	       tr->name, new->devnum);
-	list_for_each(this, &tr->devs) {
-		struct mtd_blktrans_dev *d = list_entry(this, struct mtd_blktrans_dev, list);
-		printk("Dev # %d at %p\n", d->devnum, d);
-	}
 	new->usecount = 0;
 	tr->blkcore_priv->sizes[new->devnum << tr->part_bits] = new->size;
 	tr->blkcore_priv->gd.nr_real++;


From dwmw2 at infradead.org  Sun May 18 14:21:47 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:18 2006
Subject: mtd/drivers/mtd mtd_blkdevs.c,1.5,1.6
Message-ID: <E19HSn5-0001bO-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv6139

Modified Files:
	mtd_blkdevs.c 
Log Message:
fix devs list locking _without_ deadlocking in grok_partitions()


Index: mtd_blkdevs.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- mtd_blkdevs.c	18 May 2003 17:42:12 -0000	1.5
+++ mtd_blkdevs.c	18 May 2003 18:21:44 -0000	1.6
@@ -17,6 +17,7 @@
 #include <linux/blkdev.h>
 #include <linux/blk.h>
 #include <linux/blkpg.h>
+#include <linux/spinlock.h>
 #include <asm/semaphore.h>
 #include <linux/mtd/compatmac.h>
 
@@ -30,6 +31,7 @@
 	int sizes[256];
 	struct hd_struct part_table[256];
 	struct gendisk gd;
+	spinlock_t devs_lock; /* See comment in _request function */
 };
 
 static inline struct mtd_blktrans_dev *tr_get_dev(struct mtd_blktrans_ops *tr,
@@ -126,12 +128,14 @@
 		spin_unlock_irq(&io_request_lock);
 
 		/* FIXME: Where can we store the dev, on which
-		   we already have a refcount anyway? This deadlocks
-		   with grok_partitions called from the registration
+		   we already have a refcount anyway? We need to
+		   lock against concurrent addition/removal of devices,
+		   but if we use the mtd_table_mutex we deadlock when
+		   grok_partitions is called from the registration
 		   callbacks. */
-//		down(&mtd_table_mutex);
+		spin_lock(&tr->blkcore_priv->devs_lock);
 		dev = tr_get_dev(tr, devnum);
-//		up(&mtd_table_mutex);
+		spin_unlock(&tr->blkcore_priv->devs_lock);
 
 		if (!dev) {
 			/* We'd BUG() but it's rude to do so when we know
@@ -355,7 +359,9 @@
 		up(&mtd_table_mutex);
 		BUG();
 	}
-	
+
+	spin_lock(&tr->blkcore_priv->devs_lock);
+
 	list_for_each(this, &tr->devs) {
 		struct mtd_blktrans_dev *d = list_entry(this, struct mtd_blktrans_dev, list);
 		if (new->devnum == -1) {
@@ -368,6 +374,7 @@
 			}
 		} else if (d->devnum == new->devnum) {
 			/* Required number taken */
+			spin_unlock(&tr->blkcore_priv->devs_lock);
 			return -EBUSY;
 		} else if (d->devnum > new->devnum) {
 			/* Required number was free */
@@ -379,12 +386,15 @@
 	if (new->devnum == -1)
 		new->devnum = last_devnum+1;
 
-	if ((new->devnum << tr->part_bits) > 256)
+	if ((new->devnum << tr->part_bits) > 256) {
+		spin_unlock(&tr->blkcore_priv->devs_lock);
 		return -EBUSY;
+	}
 
 	init_MUTEX(&new->sem);
 	list_add_tail(&new->list, &tr->devs);
  added:
+	spin_unlock(&tr->blkcore_priv->devs_lock);
 	new->usecount = 0;
 	tr->blkcore_priv->sizes[new->devnum << tr->part_bits] = new->size;
 	tr->blkcore_priv->gd.nr_real++;
@@ -410,7 +420,9 @@
 	if (old->usecount)
 		return -EBUSY;
 
+	spin_lock(&tr->blkcore_priv->devs_lock);
 	list_del(&old->list);
+	spin_unlock(&tr->blkcore_priv->devs_lock);
 	tr->blkcore_priv->gd.nr_real--;
 	tr->blkcore_priv->sizes[old->devnum << tr->part_bits] = 0;
 
@@ -496,6 +508,8 @@
 	tr->blkcore_priv->gd.max_p = (1<<tr->part_bits) - 1;
 	tr->blkcore_priv->gd.part = tr->blkcore_priv->part_table;
 	tr->blkcore_priv->gd.sizes = tr->blkcore_priv->sizes;
+
+	spin_lock_init(&tr->blkcore_priv->devs_lock);
 
 	add_gendisk(&tr->blkcore_priv->gd);
 


From dwmw2 at infradead.org  Sun May 18 15:09:05 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:18 2006
Subject: mtd/drivers/mtd mtd_blkdevs.c,1.6,1.7
Message-ID: <E19HTWr-0002AC-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv8296

Modified Files:
	mtd_blkdevs.c 
Log Message:
fix blocksize

Index: mtd_blkdevs.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- mtd_blkdevs.c	18 May 2003 18:21:44 -0000	1.6
+++ mtd_blkdevs.c	18 May 2003 19:09:02 -0000	1.7
@@ -3,7 +3,7 @@
  *
  * (C) 2003 David Woodhouse <dwmw2@infradead.org>
  *
- * Interface to Linux block layer for MTD 'translation layers'.
+ * Interface to Linux 2.4 block layer for MTD 'translation layers'.
  *
  */
 
@@ -19,9 +19,9 @@
 #include <linux/blkpg.h>
 #include <linux/spinlock.h>
 #include <asm/semaphore.h>
-#include <linux/mtd/compatmac.h>
 
 static LIST_HEAD(blktrans_majors);
+
 extern struct semaphore mtd_table_mutex;
 extern struct mtd_info *mtd_table[];
 
@@ -168,6 +168,9 @@
 	int devnum;
 	int ret = -ENODEV;
 
+	if (is_read_only(i->i_rdev) && (f->f_mode & FMODE_WRITE))
+		return -EROFS;
+
 	down(&mtd_table_mutex);
 
 	tr = get_tr(major_nr);
@@ -354,6 +357,7 @@
 	struct mtd_blktrans_ops *tr = new->tr;
 	struct list_head *this;
 	int last_devnum = -1;
+	int i;
 
 	if (!down_trylock(&mtd_table_mutex)) {
 		up(&mtd_table_mutex);
@@ -396,9 +400,23 @@
  added:
 	spin_unlock(&tr->blkcore_priv->devs_lock);
 	new->usecount = 0;
+
+	if (!tr->writesect)
+		new->readonly = 1;
+
+	for (i = new->devnum << tr->part_bits;
+	     i < (new->devnum+1) << tr->part_bits; 
+	     i++) {
+		set_device_ro(MKDEV(tr->major, i), new->readonly);
+		tr->blkcore_priv->blksizes[i] = new->blksize;
+		tr->blkcore_priv->sizes[i] = 0;
+		tr->blkcore_priv->part_table[i].nr_sects = 0;
+		tr->blkcore_priv->part_table[i].start_sect = 0;
+	}
+
 	tr->blkcore_priv->sizes[new->devnum << tr->part_bits] = new->size;
-	tr->blkcore_priv->gd.nr_real++;
 	tr->blkcore_priv->part_table[new->devnum << tr->part_bits].nr_sects = new->size;
+	tr->blkcore_priv->gd.nr_real++;
 
 	if (tr->part_bits) {
 		grok_partitions(&tr->blkcore_priv->gd, new->devnum,
@@ -423,14 +441,14 @@
 	spin_lock(&tr->blkcore_priv->devs_lock);
 	list_del(&old->list);
 	spin_unlock(&tr->blkcore_priv->devs_lock);
-	tr->blkcore_priv->gd.nr_real--;
-	tr->blkcore_priv->sizes[old->devnum << tr->part_bits] = 0;
 
 	for (i = (old->devnum << tr->part_bits); 
 	     i < ((old->devnum+1) << tr->part_bits); i++) {
+		tr->blkcore_priv->sizes[i] = 0;
 		tr->blkcore_priv->part_table[i].nr_sects = 0;
 		tr->blkcore_priv->part_table[i].start_sect = 0;
 	}
+	tr->blkcore_priv->gd.nr_real--;
 		
 	return 0;
 }
@@ -567,4 +585,4 @@
 
 MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Interface to block layer for MTD 'translation layers'");
+MODULE_DESCRIPTION("Common interface to block layer for MTD 'translation layers'");


From dwmw2 at infradead.org  Sun May 18 15:10:14 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:18 2006
Subject: mtd/drivers/mtd mtd_blkdevs-24.c,NONE,1.1
Message-ID: <E19HTXy-0002D4-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv8475

Added Files:
	mtd_blkdevs-24.c 
Log Message:
Rename

***** Error reading new file: [Errno 2] No such file or directory: 'mtd_blkdevs-24.c'

From dwmw2 at infradead.org  Sun May 18 15:11:23 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:18 2006
Subject: mtd/drivers/mtd Makefile,1.70,1.71
Message-ID: <E19HTZ5-0002DK-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv8508

Modified Files:
	Makefile 
Log Message:
makefile changes for mtd_blkdevs core

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/Makefile,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- Makefile	18 May 2003 10:50:25 -0000	1.70
+++ Makefile	18 May 2003 19:11:20 -0000	1.71
@@ -35,7 +35,7 @@
 # dwmw2 21/11/0
 
 # Core functionality.
-obj-$(CONFIG_MTD)		+= mtdcore.o mtd_blkdevs.o new_mtdblock.o
+obj-$(CONFIG_MTD)		+= mtdcore.o
 obj-$(CONFIG_MTD_CONCAT)	+= mtdconcat.o
 obj-$(CONFIG_MTD_PARTITIONS)	+= mtdpart.o
 obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o
@@ -44,10 +44,10 @@
 
 # 'Users' - code which presents functionality to userspace.
 obj-$(CONFIG_MTD_CHAR)		+= mtdchar.o
-obj-$(CONFIG_MTD_BLOCK)		+= mtdblock.o
-obj-$(CONFIG_MTD_BLOCK_RO)	+= mtdblock_ro.o
-obj-$(CONFIG_FTL)		+= ftl.o
-obj-$(CONFIG_NFTL)		+= nftl.o
+obj-$(CONFIG_MTD_BLOCK)		+= mtdblock.o $(mtd_blkdevs)
+obj-$(CONFIG_MTD_BLOCK_RO)	+= mtdblock_ro.o $(mtd_blkdevs)
+obj-$(CONFIG_FTL)		+= ftl.o $(mtd_blkdevs)
+obj-$(CONFIG_NFTL)		+= nftl.o $(mtd_blkdevs)
 
 ifeq ($(BELOW25),y)
 obj-y           += chips/chipslink.o maps/mapslink.o \
@@ -60,10 +60,10 @@
 mod-subdirs	:= 
 subdir-y	:= chips maps devices nand
 subdir-m	:= $(subdir-y)
-mtdblock-objs	+= mtdblock-24.o
+mtd_blkdevs	+= mtd_blkdevs-24.o
 else
 obj-y           += chips/ maps/ devices/ nand/
-mtdblock-objs	+= mtdblock-25.o
+mtd_blkdevs	+= mtd_blkdevs.o
 endif
 
 include $(TOPDIR)/Rules.make
@@ -73,6 +73,4 @@
 nftl.o: $(nftl-objs)
 	$(LD) -r -o $@ $(nftl-objs)
 
-mtdblock.o: $(mtdblock-objs)
-	$(LD) -r -o $@ $(mtdblock-objs)
 endif


From dwmw2 at infradead.org  Sun May 18 15:15:33 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:18 2006
Subject: mtd/drivers/mtd mtdblock_ro.c,1.15,1.16
Message-ID: <E19HTd7-0002FC-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv8624

Modified Files:
	mtdblock_ro.c 
Log Message:
Simple mtdblock_ro driver to use new blk core

Index: mtdblock_ro.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdblock_ro.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- mtdblock_ro.c	24 Jan 2003 13:15:19 -0000	1.15
+++ mtdblock_ro.c	18 May 2003 19:15:30 -0000	1.16
@@ -1,308 +1,86 @@
 /*
  * $Id$
  *
- * Read-only version of the mtdblock device, without the 
- * read/erase/modify/writeback stuff
+ * (C) 2003 David Woodhouse <dwmw2@infradead.org>
+ *
+ * Simple read-only (writable only for RAM) mtdblock driver
  */
 
-#ifdef MTDBLOCK_DEBUG
-#define DEBUGLVL debug
-#endif							       
-
-
-#include <linux/module.h>
-#include <linux/types.h>
-
+#include <linux/slab.h>
 #include <linux/mtd/mtd.h>
-#include <linux/mtd/compatmac.h>
-
-#define MAJOR_NR MTD_BLOCK_MAJOR
-#define DEVICE_NAME "mtdblock"
-#define DEVICE_REQUEST mtdblock_request
-#define DEVICE_NR(device) (device)
-#define DEVICE_ON(device)
-#define DEVICE_OFF(device)
-#define DEVICE_NO_RANDOM
-#include <linux/blk.h>
-
-#if LINUX_VERSION_CODE < 0x20300
-#define RQFUNC_ARG void
-#define blkdev_dequeue_request(req) do {CURRENT = req->next;} while (0)
-#else
-#define RQFUNC_ARG request_queue_t *q
-#endif
-
-#ifdef MTDBLOCK_DEBUG
-static int debug = MTDBLOCK_DEBUG;
-MODULE_PARM(debug, "i");
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,14)
-#define BLK_INC_USE_COUNT MOD_INC_USE_COUNT
-#define BLK_DEC_USE_COUNT MOD_DEC_USE_COUNT
-#else
-#define BLK_INC_USE_COUNT do {} while(0)
-#define BLK_DEC_USE_COUNT do {} while(0)
-#endif
+#include <linux/mtd/blktrans.h>
 
-/* this lock is used just in kernels >= 2.5.x */
-static spinlock_t mtdblock_ro_lock;
-
-static int mtd_sizes[MAX_MTD_DEVICES];
-
-static int mtdblock_open(struct inode *inode, struct file *file)
+static int mtdblock_readsect(struct mtd_blktrans_dev *dev,
+			      unsigned long block, char *buf)
 {
-	struct mtd_info *mtd = NULL;
-
-	int dev;
-
-	DEBUG(1,"mtdblock_open\n");
-	
-	if (inode == 0)
-		return -EINVAL;
-	
-	dev = minor(inode->i_rdev);
-	
-	mtd = get_mtd_device(NULL, dev);
-	if (!mtd)
-		return -EINVAL;
-	if (MTD_ABSENT == mtd->type) {
-		put_mtd_device(mtd);
-		return -EINVAL;
-	}
-
-	BLK_INC_USE_COUNT;
-
-	mtd_sizes[dev] = mtd->size>>9;
-
-	DEBUG(1, "ok\n");
+	size_t retlen;
 
+	if (dev->mtd->read(dev->mtd, (block * 512), 512, &retlen, buf))
+		return 1;
 	return 0;
 }
 
-static release_t mtdblock_release(struct inode *inode, struct file *file)
+static int mtdblock_writesect(struct mtd_blktrans_dev *dev,
+			      unsigned long block, char *buf)
 {
-	int dev;
-	struct mtd_info *mtd;
-
-   	DEBUG(1, "mtdblock_release\n");
+	size_t retlen;
 
-	if (inode == NULL)
-		release_return(-ENODEV);
-   
-	dev = minor(inode->i_rdev);
-	mtd = __get_mtd_device(NULL, dev);
-
-	if (!mtd) {
-		printk(KERN_WARNING "MTD device is absent on mtd_release!\n");
-		BLK_DEC_USE_COUNT;
-		release_return(-ENODEV);
-	}
-	
-	if (mtd->sync)
-		mtd->sync(mtd);
+	if (dev->mtd->write(dev->mtd, (block * 512), 512, &retlen, buf))
+		return 1;
+	return 0;
+}
 
-	put_mtd_device(mtd);
+static void mtdblock_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
+{
+	struct mtd_blktrans_dev *dev = kmalloc(sizeof(*dev), GFP_KERNEL);
 
-	DEBUG(1, "ok\n");
+	if (!dev)
+		return;
 
-	BLK_DEC_USE_COUNT;
-	release_return(0);
-}  
+	memset(dev, 0, sizeof(*dev));
 
+	dev->mtd = mtd;
+	dev->devnum = mtd->index;
+	dev->blksize = 512;
+	dev->size = mtd->size >> 9;
+	dev->tr = tr;
+	if ((mtd->flags & (MTD_CLEAR_BITS|MTD_SET_BITS|MTD_WRITEABLE)) !=
+	    (MTD_CLEAR_BITS|MTD_SET_BITS|MTD_WRITEABLE))
+		dev->readonly = 1;
 
-static void mtdblock_request(RQFUNC_ARG)
-{
-   struct request *current_request;
-   unsigned int res = 0;
-   struct mtd_info *mtd;
-
-   while (1)
-   {
-      /* Grab the Request and unlink it from the request list, INIT_REQUEST
-       	 will execute a return if we are done. */
-      INIT_REQUEST;
-      current_request = CURRENT;
-   
-      if (minor(current_request->rq_dev) >= MAX_MTD_DEVICES)
-      {
-	 printk("mtd: Unsupported device!\n");
-	 end_request(0);
-	 continue;
-      }
-      
-      // Grab our MTD structure
-
-      mtd = __get_mtd_device(NULL,minor(current_request->rq_dev));
-      if (!mtd) {
-	      printk("MTD device %d doesn't appear to exist any more\n", 
-		      kdev_t_to_nr(CURRENT_DEV));
-	      end_request(0);
-      }
-
-      if (current_request->sector << 9 > mtd->size ||
-	  (current_request->sector + current_request->current_nr_sectors) << 9 > mtd->size)
-      {
-	 printk("mtd: Attempt to read past end of device!\n");
-	 printk("size: %x, sector: %lx, nr_sectors %lx\n", mtd->size, 
-		 current_request->sector, current_request->current_nr_sectors);
-	 end_request(0);
-	 continue;
-      }
-      
-      /* Remove the request we are handling from the request list so nobody messes
-         with it */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
-      /* Now drop the lock that the ll_rw_blk functions grabbed for us
-         and process the request. This is necessary due to the extreme time
-         we spend processing it. */
-      spin_unlock_irq(QUEUE_LOCK(QUEUE));
-#endif
-
-      // Handle the request
-      switch (rq_data_dir(current_request))
-      {
-         size_t retlen;
-
-	 case READ:
-	 if (MTD_READ(mtd,current_request->sector<<9, 
-		      current_request->current_nr_sectors << 9, 
-		      &retlen, current_request->buffer) == 0)
-	    res = 1;
-	 else
-	    res = 0;
-	 break;
-	 
-	 case WRITE:
-
-	 /* printk("mtdblock_request WRITE sector=%d(%d)\n",current_request->sector,
-		current_request->current_nr_sectors);
-	 */
-
-	 // Read only device
-	 if ((mtd->flags & MTD_CAP_RAM) == 0)
-	 {
-	    res = 0;
-	    break;
-	 }
-
-	 // Do the write
-	 if (MTD_WRITE(mtd,current_request->sector<<9, 
-		       current_request->current_nr_sectors << 9, 
-		       &retlen, current_request->buffer) == 0)
-	    res = 1;
-	 else
-	    res = 0;
-	 break;
-	 
-	 // Shouldn't happen
-	 default:
-	 printk("mtd: unknown request\n");
-	 break;
-      }
-
-      // Grab the lock and re-thread the item onto the linked list
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
-      spin_lock_irq(QUEUE_LOCK(QUEUE));
-#endif
-	end_request(res);
-   }
+	add_mtd_blktrans_dev(dev);
 }
 
-
-
-static int mtdblock_ioctl(struct inode * inode, struct file * file,
-		      unsigned int cmd, unsigned long arg)
+static void mtdblock_remove_dev(struct mtd_blktrans_dev *dev)
 {
-	struct mtd_info *mtd;
-
-	mtd = __get_mtd_device(NULL, minor(inode->i_rdev));
-
-	if (!mtd) return -EINVAL;
-
-	switch (cmd) {
-	case BLKGETSIZE:   /* Return device size */
-		return put_user((mtd->size >> 9), (unsigned long *) arg);
-
-#ifdef BLKGETSIZE64
-	case BLKGETSIZE64:
-		return put_user((u64)mtd->size, (u64 *)arg);
-#endif
-
-	case BLKFLSBUF:
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
-		if(!capable(CAP_SYS_ADMIN))  return -EACCES;
-#endif
-		fsync_dev(inode->i_rdev);
-		invalidate_buffers(inode->i_rdev);
-		if (mtd->sync)
-			mtd->sync(mtd);
-		return 0;
-
-	default:
-		return -ENOTTY;
-	}
+	del_mtd_blktrans_dev(dev);
+	kfree(dev);
 }
 
-#if LINUX_VERSION_CODE < 0x20326
-static struct file_operations mtd_fops =
-{
-	open: mtdblock_open,
-	ioctl: mtdblock_ioctl,
-	release: mtdblock_release,
-	read: block_read,
-	write: block_write
-};
-#else
-static struct block_device_operations mtd_fops = 
-{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,14)
-	owner: THIS_MODULE,
-#endif
-	open: mtdblock_open,
-	release: mtdblock_release,
-	ioctl: mtdblock_ioctl
+struct mtd_blktrans_ops mtdblock_tr = {
+	.name		= "mtdblock",
+	.major		= 31,
+	.part_bits	= 2,
+	.readsect	= mtdblock_readsect,
+	.writesect	= mtdblock_writesect,
+	.add_mtd	= mtdblock_add_mtd,
+	.remove_dev	= mtdblock_remove_dev,
+	.owner		= THIS_MODULE,
 };
-#endif
 
-int __init init_mtdblock(void)
+static int __init mtdblock_init(void)
 {
-	int i;
-
-	/* this lock is used just in kernels >= 2.5.x */
-	spin_lock_init(&mtdblock_ro_lock);
-	
-	if (register_blkdev(MAJOR_NR,DEVICE_NAME,&mtd_fops)) {
-		printk(KERN_NOTICE "Can't allocate major number %d for Memory Technology Devices.\n",
-		       MTD_BLOCK_MAJOR);
-		return -EAGAIN;
-	}
-	
-	/* We fill it in at open() time. */
-	for (i=0; i< MAX_MTD_DEVICES; i++) {
-		mtd_sizes[i] = 0;
-	}
-	
-	/* Allow the block size to default to BLOCK_SIZE. */
-	blksize_size[MAJOR_NR] = NULL;
-	blk_size[MAJOR_NR] = mtd_sizes;
-	
-	BLK_INIT_QUEUE(BLK_DEFAULT_QUEUE(MAJOR_NR), &mtdblock_request, &mtdblock_ro_lock);
-	return 0;
+	return register_mtd_blktrans(&mtdblock_tr);
 }
 
-static void __exit cleanup_mtdblock(void)
+static void __exit mtdblock_exit(void)
 {
-	unregister_blkdev(MAJOR_NR,DEVICE_NAME);
-	blk_size[MAJOR_NR] = NULL;
-	blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
+	deregister_mtd_blktrans(&mtdblock_tr);
 }
 
-module_init(init_mtdblock);
-module_exit(cleanup_mtdblock);
-
+module_init(mtdblock_init);
+module_exit(mtdblock_exit);
 
 MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Erwin Authried <eauth@softsys.co.at> et al.");
+MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
 MODULE_DESCRIPTION("Simple read-only block device emulation access to MTD devices");
-


From dwmw2 at infradead.org  Sun May 18 15:27:30 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:18 2006
Subject: mtd/drivers/mtd mtdblock_ro.c,1.16,1.17
Message-ID: <E19HTog-0002Gz-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv8717

Modified Files:
	mtdblock_ro.c 
Log Message:
No partitions on mtdblock


Index: mtdblock_ro.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdblock_ro.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- mtdblock_ro.c	18 May 2003 19:15:30 -0000	1.16
+++ mtdblock_ro.c	18 May 2003 19:27:27 -0000	1.17
@@ -60,7 +60,7 @@
 struct mtd_blktrans_ops mtdblock_tr = {
 	.name		= "mtdblock",
 	.major		= 31,
-	.part_bits	= 2,
+	.part_bits	= 0,
 	.readsect	= mtdblock_readsect,
 	.writesect	= mtdblock_writesect,
 	.add_mtd	= mtdblock_add_mtd,


From dwmw2 at infradead.org  Sun May 18 15:59:31 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:18 2006
Subject: mtd/drivers/mtd mtdblock.c,1.57,1.58
Message-ID: <E19HUJf-0002o2-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv10767

Modified Files:
	mtdblock.c 
Log Message:
convert mtdblock to new blktrans interface


Index: mtdblock.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdblock.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- mtdblock.c	13 Sep 2002 14:43:57 -0000	1.57
+++ mtdblock.c	18 May 2003 19:59:28 -0000	1.58
@@ -3,7 +3,8 @@
  *
  * $Id$
  *
- * 02-nov-2000	Nicolas Pitre		Added read-modify-write with cache
+ * (C) 2000-2003 Nicolas Pitre <nico@cam.org>
+ * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org>
  */
 
 #include <linux/config.h>
@@ -12,32 +13,10 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/mtd/mtd.h>
-#include <linux/mtd/compatmac.h>
-
-#define MAJOR_NR MTD_BLOCK_MAJOR
-#define DEVICE_NAME "mtdblock"
-#define DEVICE_REQUEST mtdblock_request
-#define DEVICE_NR(device) (device)
-#define DEVICE_ON(device)
-#define DEVICE_OFF(device)
-#define DEVICE_NO_RANDOM
-#include <linux/blk.h>
-
-#ifdef CONFIG_DEVFS_FS
-#include <linux/devfs_fs_kernel.h>
-static void mtd_notify_add(struct mtd_info* mtd);
-static void mtd_notify_remove(struct mtd_info* mtd);
-static struct mtd_notifier notifier = {
-        mtd_notify_add,
-        mtd_notify_remove,
-        NULL
-};
-static devfs_handle_t devfs_dir_handle = NULL;
-static devfs_handle_t devfs_rw_handle[MAX_MTD_DEVICES];
-#endif
+#include <linux/mtd/blktrans.h>
 
 static struct mtdblk_dev {
-	struct mtd_info *mtd; /* Locked */
+	struct mtd_info *mtd;
 	int count;
 	struct semaphore cache_sem;
 	unsigned char *cache_data;
@@ -46,14 +25,6 @@
 	enum { STATE_EMPTY, STATE_CLEAN, STATE_DIRTY } cache_state;
 } *mtdblks[MAX_MTD_DEVICES];
 
-static spinlock_t mtdblks_lock;
-/* this lock is used just in kernels >= 2.5.x */ 
-static spinlock_t mtdblock_lock;
-
-static int mtd_sizes[MAX_MTD_DEVICES];
-static int mtd_blksizes[MAX_MTD_DEVICES];
-
-
 /*
  * Cache stuff...
  * 
@@ -137,7 +108,7 @@
 		return ret;
 
 	/*
-	 * Here we could argably set the cache state to STATE_CLEAN.
+	 * Here we could argubly set the cache state to STATE_CLEAN.
 	 * However this could lead to inconsistency since we will not 
 	 * be notified if this content is altered on the flash by other 
 	 * means.  Let's declare it empty and leave buffering tasks to
@@ -263,59 +234,39 @@
 	return 0;
 }
 
+static int mtdblock_readsect(struct mtd_blktrans_dev *dev,
+			      unsigned long block, char *buf)
+{
+	struct mtdblk_dev *mtdblk = mtdblks[dev->devnum];
+	return do_cached_read(mtdblk, block<<9, 512, buf);
+}
 
+static int mtdblock_writesect(struct mtd_blktrans_dev *dev,
+			      unsigned long block, char *buf)
+{
+	struct mtdblk_dev *mtdblk = mtdblks[dev->devnum];
+	return do_cached_write(mtdblk, block<<9, 512, buf);
+}
 
-static int mtdblock_open(struct inode *inode, struct file *file)
+static int mtdblock_open(struct mtd_blktrans_dev *mbd, 
+			 struct inode *inode, struct file *file)
 {
 	struct mtdblk_dev *mtdblk;
-	struct mtd_info *mtd;
-	int dev;
+	struct mtd_info *mtd = mbd->mtd;
+	int dev = mbd->devnum;
 
 	DEBUG(MTD_DEBUG_LEVEL1,"mtdblock_open\n");
 	
-	if (!inode)
-		return -EINVAL;
-	
-	dev = minor(inode->i_rdev);
-	if (dev >= MAX_MTD_DEVICES)
-		return -EINVAL;
-
-	BLK_INC_USE_COUNT;
-
-	mtd = get_mtd_device(NULL, dev);
-	if (!mtd) {
-		BLK_DEC_USE_COUNT;
-		return -ENODEV;
-	}
-	if (MTD_ABSENT == mtd->type) {
-		put_mtd_device(mtd);
-		BLK_DEC_USE_COUNT;
-		return -ENODEV;
-	}
-	
-	spin_lock(&mtdblks_lock);
-
-	/* If it's already open, no need to piss about. */
 	if (mtdblks[dev]) {
 		mtdblks[dev]->count++;
-		spin_unlock(&mtdblks_lock);
-		put_mtd_device(mtd);
 		return 0;
 	}
 	
-	/* OK, it's not open. Try to find it */
-
-	/* First we have to drop the lock, because we have to
-	   to things which might sleep.
-	*/
-	spin_unlock(&mtdblks_lock);
-
+	/* OK, it's not open. Create cache info for it */
 	mtdblk = kmalloc(sizeof(struct mtdblk_dev), GFP_KERNEL);
-	if (!mtdblk) {
-		put_mtd_device(mtd);
-		BLK_DEC_USE_COUNT;
+	if (!mtdblks)
 		return -ENOMEM;
-	}
+
 	memset(mtdblk, 0, sizeof(*mtdblk));
 	mtdblk->count = 1;
 	mtdblk->mtd = mtd;
@@ -327,50 +278,25 @@
 		mtdblk->cache_size = mtdblk->mtd->erasesize;
 		mtdblk->cache_data = vmalloc(mtdblk->mtd->erasesize);
 		if (!mtdblk->cache_data) {
-			put_mtd_device(mtdblk->mtd);
 			kfree(mtdblk);
-			BLK_DEC_USE_COUNT;
 			return -ENOMEM;
 		}
 	}
 
-	/* OK, we've created a new one. Add it to the list. */
-
-	spin_lock(&mtdblks_lock);
-
-	if (mtdblks[dev]) {
-		/* Another CPU made one at the same time as us. */
-		mtdblks[dev]->count++;
-		spin_unlock(&mtdblks_lock);
-		put_mtd_device(mtdblk->mtd);
-		vfree(mtdblk->cache_data);
-		kfree(mtdblk);
-		return 0;
-	}
-
 	mtdblks[dev] = mtdblk;
-	mtd_sizes[dev] = mtdblk->mtd->size/1024;
-	if (mtdblk->mtd->erasesize)
-		mtd_blksizes[dev] = mtdblk->mtd->erasesize;
-	if (mtd_blksizes[dev] > PAGE_SIZE)
-		mtd_blksizes[dev] = PAGE_SIZE;
-	set_device_ro (inode->i_rdev, !(mtdblk->mtd->flags & MTD_WRITEABLE));
-	
-	spin_unlock(&mtdblks_lock);
 	
 	DEBUG(MTD_DEBUG_LEVEL1, "ok\n");
 
 	return 0;
 }
 
-static release_t mtdblock_release(struct inode *inode, struct file *file)
+static release_t mtdblock_release(struct mtd_blktrans_dev *mbd,
+				  struct inode *inode, struct file *file)
 {
 	int dev;
 	struct mtdblk_dev *mtdblk;
-   	DEBUG(MTD_DEBUG_LEVEL1, "mtdblock_release\n");
 
-	if (inode == NULL)
-		release_return(-ENODEV);
+   	DEBUG(MTD_DEBUG_LEVEL1, "mtdblock_release\n");
 
 	dev = minor(inode->i_rdev);
 	mtdblk = mtdblks[dev];
@@ -379,172 +305,30 @@
 	write_cached_data(mtdblk);
 	up(&mtdblk->cache_sem);
 
-	spin_lock(&mtdblks_lock);
 	if (!--mtdblk->count) {
 		/* It was the last usage. Free the device */
 		mtdblks[dev] = NULL;
-		spin_unlock(&mtdblks_lock);
 		if (mtdblk->mtd->sync)
 			mtdblk->mtd->sync(mtdblk->mtd);
-		put_mtd_device(mtdblk->mtd);
 		vfree(mtdblk->cache_data);
 		kfree(mtdblk);
-	} else {
-		spin_unlock(&mtdblks_lock);
 	}
-
 	DEBUG(MTD_DEBUG_LEVEL1, "ok\n");
 
-	BLK_DEC_USE_COUNT;
-	release_return(0);
-}  
-
-
-/* 
- * This is a special request_fn because it is executed in a process context 
- * to be able to sleep independently of the caller.  The
- * io_request_lock (for <2.5) or queue_lock (for >=2.5) is held upon entry 
- * and exit. The head of our request queue is considered active so there is
- * no need to dequeue requests before we are done.
- */
-static void handle_mtdblock_request(void)
-{
-	struct request *req;
-	struct mtdblk_dev *mtdblk;
-	unsigned int res;
-
-	for (;;) {
-		INIT_REQUEST;
-		req = CURRENT;
-		spin_unlock_irq(QUEUE_LOCK(QUEUE)); 
-		mtdblk = mtdblks[minor(req->rq_dev)];
-		res = 0;
-
-		if (minor(req->rq_dev) >= MAX_MTD_DEVICES)
-			panic("handle_mtdblock_request(): minor out of bounds");
-
-		if (!IS_REQ_CMD(req))
-			goto end_req;
-
-		if ((req->sector + req->current_nr_sectors) > (mtdblk->mtd->size >> 9))
-			goto end_req;
-
-		// Handle the request
-		switch (rq_data_dir(req))
-		{
-			int err;
-
-			case READ:
-			down(&mtdblk->cache_sem);
-			err = do_cached_read (mtdblk, req->sector << 9, 
-					req->current_nr_sectors << 9,
-					req->buffer);
-			up(&mtdblk->cache_sem);
-			if (!err)
-				res = 1;
-			break;
-
-			case WRITE:
-			// Read only device
-			if ( !(mtdblk->mtd->flags & MTD_WRITEABLE) ) 
-				break;
-
-			// Do the write
-			down(&mtdblk->cache_sem);
-			err = do_cached_write (mtdblk, req->sector << 9,
-					req->current_nr_sectors << 9, 
-					req->buffer);
-			up(&mtdblk->cache_sem);
-			if (!err)
-				res = 1;
-			break;
-		}
-
-end_req:
-		spin_lock_irq(QUEUE_LOCK(QUEUE)); 
-		end_request(res);
-	}
-}
-
-static volatile int leaving = 0;
-static DECLARE_MUTEX_LOCKED(thread_sem);
-static DECLARE_WAIT_QUEUE_HEAD(thr_wq);
-
-int mtdblock_thread(void *dummy)
-{
-	struct task_struct *tsk = current;
-	DECLARE_WAITQUEUE(wait, tsk);
-
-	/* we might get involved when memory gets low, so use PF_MEMALLOC */
-	tsk->flags |= PF_MEMALLOC;
-	strcpy(tsk->comm, "mtdblockd");
-	spin_lock_irq(&tsk->sigmask_lock);
-	sigfillset(&tsk->blocked);
-	recalc_sigpending();
-	spin_unlock_irq(&tsk->sigmask_lock);
-	daemonize();
-
-	while (!leaving) {
-		add_wait_queue(&thr_wq, &wait);
-		set_current_state(TASK_INTERRUPTIBLE);
-		spin_lock_irq(QUEUE_LOCK(QUEUE)); 
-		if (QUEUE_EMPTY || QUEUE_PLUGGED) {
-	                spin_unlock_irq(QUEUE_LOCK(QUEUE)); 
-			schedule();
-			remove_wait_queue(&thr_wq, &wait); 
-		} else {
-			remove_wait_queue(&thr_wq, &wait); 
-			set_current_state(TASK_RUNNING);
-			handle_mtdblock_request();
-		        spin_unlock_irq(QUEUE_LOCK(QUEUE)); 
-		}
-	}
-
-	up(&thread_sem);
 	return 0;
-}
-
-#if LINUX_VERSION_CODE < 0x20300
-#define RQFUNC_ARG void
-#else
-#define RQFUNC_ARG request_queue_t *q
-#endif
-
-static void mtdblock_request(RQFUNC_ARG)
-{
-	/* Don't do anything, except wake the thread if necessary */
-	wake_up(&thr_wq);
-}
+}  
 
 
-static int mtdblock_ioctl(struct inode * inode, struct file * file,
-		      unsigned int cmd, unsigned long arg)
+static int mtdblock_ioctl(struct mtd_blktrans_dev *dev, 
+			  struct inode * inode, struct file * file,
+			  unsigned int cmd, unsigned long arg)
 {
 	struct mtdblk_dev *mtdblk;
 
 	mtdblk = mtdblks[minor(inode->i_rdev)];
 
-#ifdef PARANOIA
-	if (!mtdblk)
-		BUG();
-#endif
-
 	switch (cmd) {
-	case BLKGETSIZE:   /* Return device size */
-		return put_user((mtdblk->mtd->size >> 9), (unsigned long *) arg);
-
-#ifdef BLKGETSIZE64
-	case BLKGETSIZE64:
-		return put_user((u64)mtdblk->mtd->size, (u64 *)arg);
-#endif
-		
 	case BLKFLSBUF:
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
-		if(!capable(CAP_SYS_ADMIN))
-			return -EACCES;
-#endif
-		fsync_dev(inode->i_rdev);
-		invalidate_buffers(inode->i_rdev);
 		down(&mtdblk->cache_sem);
 		write_cached_data(mtdblk);
 		up(&mtdblk->cache_sem);
@@ -553,115 +337,59 @@
 		return 0;
 
 	default:
-		return -EINVAL;
+		return -ENOTTY;
 	}
 }
 
-#if LINUX_VERSION_CODE < 0x20326
-static struct file_operations mtd_fops =
-{
-	open: mtdblock_open,
-	ioctl: mtdblock_ioctl,
-	release: mtdblock_release,
-	read: block_read,
-	write: block_write
-};
-#else
-static struct block_device_operations mtd_fops = 
+static void mtdblock_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
 {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,14)
-	owner: THIS_MODULE,
-#endif
-	open: mtdblock_open,
-	release: mtdblock_release,
-	ioctl: mtdblock_ioctl
-};
-#endif
+	struct mtd_blktrans_dev *dev = kmalloc(sizeof(*dev), GFP_KERNEL);
 
-#ifdef CONFIG_DEVFS_FS
-/* Notification that a new device has been added. Create the devfs entry for
- * it. */
+	if (!dev)
+		return;
 
-static void mtd_notify_add(struct mtd_info* mtd)
-{
-        char name[8];
+	memset(dev, 0, sizeof(*dev));
 
-        if (!mtd || mtd->type == MTD_ABSENT)
-                return;
+	dev->mtd = mtd;
+	dev->devnum = mtd->index;
+	dev->blksize = 512;
+	dev->size = mtd->size >> 9;
+	dev->tr = tr;
 
-        sprintf(name, "%d", mtd->index);
-        devfs_rw_handle[mtd->index] = devfs_register(devfs_dir_handle, name,
-                        DEVFS_FL_DEFAULT, MTD_BLOCK_MAJOR, mtd->index,
-                        S_IFBLK | S_IRUGO | S_IWUGO,
-                        &mtd_fops, NULL);
+	if (!(mtd->flags & MTD_WRITEABLE))
+		dev->readonly = 1;
+
+	add_mtd_blktrans_dev(dev);
 }
 
-static void mtd_notify_remove(struct mtd_info* mtd)
+static void mtdblock_remove_dev(struct mtd_blktrans_dev *dev)
 {
-        if (!mtd || mtd->type == MTD_ABSENT)
-                return;
-
-        devfs_unregister(devfs_rw_handle[mtd->index]);
+	del_mtd_blktrans_dev(dev);
+	kfree(dev);
 }
-#endif
+
+struct mtd_blktrans_ops mtdblock_tr = {
+	.name		= "mtdblock",
+	.major		= 31,
+	.part_bits	= 0,
+	.open		= mtdblock_open,
+	.ioctl		= mtdblock_ioctl,
+	.release	= mtdblock_release,
+	.readsect	= mtdblock_readsect,
+	.writesect	= mtdblock_writesect,
+	.add_mtd	= mtdblock_add_mtd,
+	.remove_dev	= mtdblock_remove_dev,
+	.owner		= THIS_MODULE,
+};
 
 int __init init_mtdblock(void)
 {
-	int i;
-
-	spin_lock_init(&mtdblks_lock);
-	/* this lock is used just in kernels >= 2.5.x */
-	spin_lock_init(&mtdblock_lock);
-
-#ifdef CONFIG_DEVFS_FS
-	if (devfs_register_blkdev(MTD_BLOCK_MAJOR, DEVICE_NAME, &mtd_fops))
-	{
-		printk(KERN_NOTICE "Can't allocate major number %d for Memory Technology Devices.\n",
-			MTD_BLOCK_MAJOR);
-		return -EAGAIN;
-	}
-
-	devfs_dir_handle = devfs_mk_dir(NULL, DEVICE_NAME, NULL);
-	register_mtd_user(&notifier);
-#else
-	if (register_blkdev(MAJOR_NR,DEVICE_NAME,&mtd_fops)) {
-		printk(KERN_NOTICE "Can't allocate major number %d for Memory Technology Devices.\n",
-		       MTD_BLOCK_MAJOR);
-		return -EAGAIN;
-	}
-#endif
-	
-	/* We fill it in at open() time. */
-	for (i=0; i< MAX_MTD_DEVICES; i++) {
-		mtd_sizes[i] = 0;
-		mtd_blksizes[i] = BLOCK_SIZE;
-	}
-	init_waitqueue_head(&thr_wq);
-	/* Allow the block size to default to BLOCK_SIZE. */
-	blksize_size[MAJOR_NR] = mtd_blksizes;
-	blk_size[MAJOR_NR] = mtd_sizes;
-
-	BLK_INIT_QUEUE(BLK_DEFAULT_QUEUE(MAJOR_NR), &mtdblock_request, &mtdblock_lock);
-		    
-	kernel_thread (mtdblock_thread, NULL, CLONE_FS|CLONE_FILES|CLONE_SIGHAND);
-	return 0;
+	return register_mtd_blktrans(&mtdblock_tr);
 }
 
 static void __exit cleanup_mtdblock(void)
 {
-	leaving = 1;
-	wake_up(&thr_wq);
-	down(&thread_sem);
-#ifdef CONFIG_DEVFS_FS
-	unregister_mtd_user(&notifier);
-	devfs_unregister(devfs_dir_handle);
-	devfs_unregister_blkdev(MTD_BLOCK_MAJOR, DEVICE_NAME);
-#else
-	unregister_blkdev(MAJOR_NR,DEVICE_NAME);
-#endif
-	blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
-	blksize_size[MAJOR_NR] = NULL;
-	blk_size[MAJOR_NR] = NULL;
+	deregister_mtd_blktrans(&mtdblock_tr);
 }
 
 module_init(init_mtdblock);


From dwmw2 at infradead.org  Sun May 18 16:58:00 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:19 2006
Subject: mtd/drivers/mtd ftl.c,1.46,1.47
Message-ID: <E19HVEG-0003Lw-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv12869

Modified Files:
	ftl.c 
Log Message:
Convert to mtd_blktrans


Index: ftl.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/ftl.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- ftl.c	2 Mar 2003 18:45:07 -0000	1.46
+++ ftl.c	18 May 2003 20:57:57 -0000	1.47
@@ -55,8 +55,8 @@
     contact M-Systems (http://www.m-sys.com) directly.
       
 ======================================================================*/
+#include <linux/mtd/blktrans.h>
 #include <linux/module.h>
-#include <linux/mtd/compatmac.h>
 #include <linux/mtd/mtd.h>
 /*#define PSYCHO_DEBUG */
 
@@ -70,41 +70,10 @@
 #include <linux/fs.h>
 #include <linux/ioctl.h>
 #include <linux/hdreg.h>
-
-#if (LINUX_VERSION_CODE >= 0x20100)
 #include <linux/vmalloc.h>
-#endif
-#if (LINUX_VERSION_CODE >= 0x20303)
 #include <linux/blkpg.h>
-#endif
 
 #include <linux/mtd/ftl.h>
-/*====================================================================*/
-/* Stuff which really ought to be in compatmac.h */
-
-#if (LINUX_VERSION_CODE < 0x20328)
-#define register_disk(dev, drive, minors, ops, size) \
-    do { (dev)->part[(drive)*(minors)].nr_sects = size; \
-        if (size == 0) (dev)->part[(drive)*(minors)].start_sect = -1; \
-        resetup_one_dev(dev, drive); } while (0)
-#endif
-
-#if (LINUX_VERSION_CODE < 0x20320)
-#define BLK_DEFAULT_QUEUE(n)    blk_dev[n].request_fn
-#define blk_init_queue(q, req)  q = (req)
-#define blk_cleanup_queue(q)    q = NULL
-#define request_arg_t           void
-#else
-#define request_arg_t           request_queue_t *q
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,14)
-#define BLK_INC_USE_COUNT MOD_INC_USE_COUNT
-#define BLK_DEC_USE_COUNT MOD_DEC_USE_COUNT
-#else
-#define BLK_INC_USE_COUNT do {} while(0)
-#define BLK_DEC_USE_COUNT do {} while(0)
-#endif
 
 /*====================================================================*/
 
@@ -119,19 +88,6 @@
 #define FTL_MAJOR	44
 #endif
 
-/* Funky stuff for setting up a block device */
-#define MAJOR_NR		FTL_MAJOR
-#define DEVICE_NAME		"ftl"
-#define DEVICE_REQUEST		do_ftl_request
-#define DEVICE_ON(device)
-#define DEVICE_OFF(device)
-
-#define DEVICE_NR(minor)	((minor)>>5)
-#define REGION_NR(minor)	(((minor)>>3)&3)
-#define PART_NR(minor)		((minor)&7)
-#define MINOR_NR(dev,reg,part)	(((dev)<<5)+((reg)<<3)+(part))
-
-#include <linux/blk.h>
 
 /*====================================================================*/
 
@@ -154,7 +110,7 @@
 
 /* Each memory region corresponds to a minor device */
 typedef struct partition_t {
-    struct mtd_info	*mtd;
+    struct mtd_blktrans_dev mbd;
     u_int32_t		state;
     u_int32_t		*VirtualBlockMap;
     u_int32_t		*VirtualPageMap;
@@ -179,21 +135,10 @@
     region_info_t	region;
     memory_handle_t	handle;
 #endif
-    atomic_t		open;
 } partition_t;
 
-partition_t *myparts[MAX_MTD_DEVICES];
-
-static void ftl_notify_add(struct mtd_info *mtd);
-static void ftl_notify_remove(struct mtd_info *mtd);
-
 void ftl_freepart(partition_t *part);
 
-static struct mtd_notifier ftl_notifier = {
-	.add	= ftl_notify_add,
-	.remove	= ftl_notify_remove,
-};
-
 /* Partition state flags */
 #define FTL_FORMATTED	0x01
 
@@ -204,51 +149,11 @@
 #define XFER_PREPARED	0x03
 #define XFER_FAILED	0x04
 
-static struct hd_struct ftl_hd[MINOR_NR(MAX_DEV, 0, 0)];
-static int ftl_sizes[MINOR_NR(MAX_DEV, 0, 0)];
-static int ftl_blocksizes[MINOR_NR(MAX_DEV, 0, 0)];
-
-static struct gendisk ftl_gendisk = {
-    major:		FTL_MAJOR,
-    major_name:		"ftl",
-    minor_shift:	PART_BITS,
-    max_p:		MAX_PART,
-#if (LINUX_VERSION_CODE < 0x20328)
-    max_nr:		MAX_DEV*MAX_PART,
-#endif
-    part:		ftl_hd,
-    sizes:		ftl_sizes,
-};
-
 /*====================================================================*/
 
-static int ftl_ioctl(struct inode *inode, struct file *file,
-		     u_int cmd, u_long arg);
-static int ftl_open(struct inode *inode, struct file *file);
-static release_t ftl_close(struct inode *inode, struct file *file);
-static int ftl_reread_partitions(int minor);
 
 static void ftl_erase_callback(struct erase_info *done);
 
-#if LINUX_VERSION_CODE < 0x20326
-static struct file_operations ftl_blk_fops = {
-    open:	ftl_open,
-    release:	ftl_close,
-    ioctl:	ftl_ioctl,
-    read:	block_read,
-    write:	block_write,
-    fsync:	block_fsync
-};
-#else
-static struct block_device_operations ftl_blk_fops = {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,14)
-    owner:	THIS_MODULE,
-#endif
-    open:	ftl_open,
-    release:	ftl_close,
-    ioctl:	ftl_ioctl,
-};
-#endif
 
 /*======================================================================
 
@@ -264,13 +169,13 @@
     loff_t offset, max_offset;
     int ret;
     part->header.FormattedSize = 0;
-    max_offset = (0x100000<part->mtd->size)?0x100000:part->mtd->size;
+    max_offset = (0x100000<part->mbd.mtd->size)?0x100000:part->mbd.mtd->size;
     /* Search first megabyte for a valid FTL header */
     for (offset = 0;
 	 (offset + sizeof(header)) < max_offset;
-	 offset += part->mtd->erasesize ? : 0x2000) {
+	 offset += part->mbd.mtd->erasesize ? : 0x2000) {
 
-	ret = part->mtd->read(part->mtd, offset, sizeof(header), &ret, 
+	ret = part->mbd.mtd->read(part->mbd.mtd, offset, sizeof(header), &ret, 
 			      (unsigned char *)&header);
 	
 	if (ret) 
@@ -289,9 +194,9 @@
 	printk(KERN_NOTICE "ftl_cs: FTL header corrupt!\n");
 	return -1;
     }
-    if ((1 << header.EraseUnitSize) != part->mtd->erasesize) {
+    if ((1 << header.EraseUnitSize) != part->mbd.mtd->erasesize) {
 	printk(KERN_NOTICE "ftl: FTL EraseUnitSize %x != MTD erasesize %x\n",
-	       1 << header.EraseUnitSize,part->mtd->erasesize);
+	       1 << header.EraseUnitSize,part->mbd.mtd->erasesize);
 	return -1;
     }
     part->header = header;
@@ -326,7 +231,7 @@
     for (i = 0; i < le16_to_cpu(part->header.NumEraseUnits); i++) {
 	offset = ((i + le16_to_cpu(part->header.FirstPhysicalEUN))
 		      << part->header.EraseUnitSize);
-	ret = part->mtd->read(part->mtd, offset, sizeof(header), &retval, 
+	ret = part->mbd.mtd->read(part->mbd.mtd, offset, sizeof(header), &retval, 
 			      (unsigned char *)&header);
 	
 	if (ret) 
@@ -391,7 +296,7 @@
 	part->EUNInfo[i].Deleted = 0;
 	offset = part->EUNInfo[i].Offset + le32_to_cpu(header.BAMOffset);
 	
-	ret = part->mtd->read(part->mtd, offset,  
+	ret = part->mbd.mtd->read(part->mbd.mtd, offset,  
 			      part->BlocksPerUnit * sizeof(u_int32_t), &retval, 
 			      (unsigned char *)part->bam_cache);
 	
@@ -456,7 +361,7 @@
     erase->len = 1 << part->header.EraseUnitSize;
     erase->priv = (u_long)part;
     
-    ret = part->mtd->erase(part->mtd, erase);
+    ret = part->mbd.mtd->erase(part->mbd.mtd, erase);
 
     if (!ret)
 	    xfer->EraseCount++;
@@ -523,7 +428,7 @@
     header.LogicalEUN = cpu_to_le16(0xffff);
     header.EraseCount = cpu_to_le32(xfer->EraseCount);
 
-    ret = part->mtd->write(part->mtd, xfer->Offset, sizeof(header),
+    ret = part->mbd.mtd->write(part->mbd.mtd, xfer->Offset, sizeof(header),
 			   &retlen, (u_char *)&header);
 
     if (ret) {
@@ -539,7 +444,7 @@
 
     for (i = 0; i < nbam; i++, offset += sizeof(u_int32_t)) {
 
-	ret = part->mtd->write(part->mtd, offset, sizeof(u_int32_t), 
+	ret = part->mbd.mtd->write(part->mbd.mtd, offset, sizeof(u_int32_t), 
 			       &retlen, (u_char *)&ctl);
 
 	if (ret)
@@ -586,7 +491,7 @@
 
 	offset = eun->Offset + le32_to_cpu(part->header.BAMOffset);
 
-	ret = part->mtd->read(part->mtd, offset, 
+	ret = part->mbd.mtd->read(part->mbd.mtd, offset, 
 			      part->BlocksPerUnit * sizeof(u_int32_t),
 			      &retlen, (u_char *) (part->bam_cache));
 
@@ -604,7 +509,7 @@
     offset = xfer->Offset + 20; /* Bad! */
     unit = cpu_to_le16(0x7fff);
 
-    ret = part->mtd->write(part->mtd, offset, sizeof(u_int16_t),
+    ret = part->mbd.mtd->write(part->mbd.mtd, offset, sizeof(u_int16_t),
 			   &retlen, (u_char *) &unit);
     
     if (ret) {
@@ -624,7 +529,7 @@
 	    break;
 	case BLOCK_DATA:
 	case BLOCK_REPLACEMENT:
-	    ret = part->mtd->read(part->mtd, src, SECTOR_SIZE,
+	    ret = part->mbd.mtd->read(part->mbd.mtd, src, SECTOR_SIZE,
                         &retlen, (u_char *) buf);
 	    if (ret) {
 		printk(KERN_WARNING "ftl: Error reading old xfer unit in copy_erase_unit\n");
@@ -632,7 +537,7 @@
             }
 
 
-	    ret = part->mtd->write(part->mtd, dest, SECTOR_SIZE,
+	    ret = part->mbd.mtd->write(part->mbd.mtd, dest, SECTOR_SIZE,
                         &retlen, (u_char *) buf);
 	    if (ret)  {
 		printk(KERN_WARNING "ftl: Error writing new xfer unit in copy_erase_unit\n");
@@ -651,7 +556,7 @@
     }
 
     /* Write the BAM to the transfer unit */
-    ret = part->mtd->write(part->mtd, xfer->Offset + le32_to_cpu(part->header.BAMOffset), 
+    ret = part->mbd.mtd->write(part->mbd.mtd, xfer->Offset + le32_to_cpu(part->header.BAMOffset), 
                     part->BlocksPerUnit * sizeof(int32_t), &retlen, 
 		    (u_char *)part->bam_cache);
     if (ret) {
@@ -661,7 +566,7 @@
 
     
     /* All clear? Then update the LogicalEUN again */
-    ret = part->mtd->write(part->mtd, xfer->Offset + 20, sizeof(u_int16_t),
+    ret = part->mbd.mtd->write(part->mbd.mtd, xfer->Offset + 20, sizeof(u_int16_t),
 			   &retlen, (u_char *)&srcunitswap);
 
     if (ret) {
@@ -749,8 +654,8 @@
 	    if (queued) {
 		DEBUG(1, "ftl_cs: waiting for transfer "
 		      "unit to be prepared...\n");
-		if (part->mtd->sync)
-			part->mtd->sync(part->mtd);
+		if (part->mbd.mtd->sync)
+			part->mbd.mtd->sync(part->mbd.mtd);
 	    } else {
 		static int ne = 0;
 		if (++ne < 5)
@@ -848,7 +753,7 @@
 	/* Invalidate cache */
 	part->bam_index = 0xffff;
 
-	ret = part->mtd->read(part->mtd, 
+	ret = part->mbd.mtd->read(part->mbd.mtd, 
 		       part->EUNInfo[eun].Offset + le32_to_cpu(part->header.BAMOffset),
 		       part->BlocksPerUnit * sizeof(u_int32_t),
 		       &retlen, (u_char *) (part->bam_cache));
@@ -877,78 +782,6 @@
     
 } /* find_free */
 
-/*======================================================================
-
-    This gets a memory handle for the region corresponding to the
-    minor device number.
-    
-======================================================================*/
-
-static int ftl_open(struct inode *inode, struct file *file)
-{
-    int minor = MINOR(inode->i_rdev);
-    partition_t *partition;
-
-    if (minor>>4 >= MAX_MTD_DEVICES)
-	return -ENODEV;
-
-    partition = myparts[minor>>4];
-
-    if (!partition)
-	return -ENODEV;
-
-    if (partition->state != FTL_FORMATTED)
-	return -ENXIO;
-    
-    if (ftl_gendisk.part[minor].nr_sects == 0)
-	return -ENXIO;
-
-    BLK_INC_USE_COUNT;
-
-    if (!get_mtd_device(partition->mtd, -1)) {
-	    BLK_DEC_USE_COUNT;
-	    return -ENXIO;
-    }
-    
-    if ((file->f_mode & 2) && !(partition->mtd->flags & MTD_CLEAR_BITS) ) {
-	    put_mtd_device(partition->mtd);
-	    BLK_DEC_USE_COUNT;
-            return -EROFS;
-    }
-    
-    DEBUG(0, "ftl_cs: ftl_open(%d)\n", minor);
-
-    atomic_inc(&partition->open);
-
-    return 0;
-}
-
-/*====================================================================*/
-
-static release_t ftl_close(struct inode *inode, struct file *file)
-{
-    int minor = MINOR(inode->i_rdev);
-    partition_t *part = myparts[minor >> 4];
-    int i;
-    
-    DEBUG(0, "ftl_cs: ftl_close(%d)\n", minor);
-
-    /* Wait for any pending erase operations to complete */
-    if (part->mtd->sync)
-	    part->mtd->sync(part->mtd);
-    
-    for (i = 0; i < part->header.NumTransferUnits; i++) {
-	if (part->XferInfo[i].state == XFER_ERASED)
-	    prepare_xfer(part, i);
-    }
-
-    atomic_dec(&part->open);
-
-    put_mtd_device(part->mtd);
-    BLK_DEC_USE_COUNT;
-    release_return(0);
-} /* ftl_close */
-
 
 /*======================================================================
 
@@ -983,7 +816,7 @@
 	else {
 	    offset = (part->EUNInfo[log_addr / bsize].Offset
 			  + (log_addr % bsize));
-	    ret = part->mtd->read(part->mtd, offset, SECTOR_SIZE,
+	    ret = part->mbd.mtd->read(part->mbd.mtd, offset, SECTOR_SIZE,
 			   &retlen, (u_char *) buffer);
 
 	    if (ret) {
@@ -1022,7 +855,7 @@
 		  le32_to_cpu(part->header.BAMOffset));
     
 #ifdef PSYCHO_DEBUG
-    ret = part->mtd->read(part->mtd, offset, sizeof(u_int32_t),
+    ret = part->mbd.mtd->read(part->mbd.mtd, offset, sizeof(u_int32_t),
                         &retlen, (u_char *)&old_addr);
     if (ret) {
 	printk(KERN_WARNING"ftl: Error reading old_addr in set_bam_entry: %d\n",ret);
@@ -1059,7 +892,7 @@
 #endif
 	part->bam_cache[blk] = le_virt_addr;
     }
-    ret = part->mtd->write(part->mtd, offset, sizeof(u_int32_t),
+    ret = part->mbd.mtd->write(part->mbd.mtd, offset, sizeof(u_int32_t),
                             &retlen, (u_char *)&le_virt_addr);
 
     if (ret) {
@@ -1119,7 +952,7 @@
 	part->EUNInfo[part->bam_index].Deleted++;
 	offset = (part->EUNInfo[part->bam_index].Offset +
 		      blk * SECTOR_SIZE);
-	ret = part->mtd->write(part->mtd, offset, SECTOR_SIZE, &retlen, 
+	ret = part->mbd.mtd->write(part->mbd.mtd, offset, SECTOR_SIZE, &retlen, 
                                      buffer);
 
 	if (ret) {
@@ -1157,158 +990,43 @@
 
 ======================================================================*/
 
-static int ftl_ioctl(struct inode *inode, struct file *file,
-		     u_int cmd, u_long arg)
+static int ftl_ioctl(struct mtd_blktrans_dev *dev, struct inode *inode, 
+		     struct file *file, u_int cmd, u_long arg)
 {
     struct hd_geometry *geo = (struct hd_geometry *)arg;
-    int ret = 0, minor = MINOR(inode->i_rdev);
-    partition_t *part= myparts[minor >> 4];
+    partition_t *part = (void *)dev;
     u_long sect;
 
-    if (!part)
-	return -ENODEV; /* How? */
-
     switch (cmd) {
     case HDIO_GETGEO:
-	ret = verify_area(VERIFY_WRITE, (long *)arg, sizeof(*geo));
-	if (ret) return ret;
 	/* Sort of arbitrary: round size down to 4K boundary */
 	sect = le32_to_cpu(part->header.FormattedSize)/SECTOR_SIZE;
-	put_user(1, (char *)&geo->heads);
-	put_user(8, (char *)&geo->sectors);
-	put_user((sect>>3), (short *)&geo->cylinders);
-	put_user(ftl_hd[minor].start_sect, (u_long *)&geo->start);
-	break;
-    case BLKGETSIZE:
-	ret = put_user(ftl_hd[minor].nr_sects, (unsigned long *)arg);
-	break;
-#ifdef BLKGETSIZE64
-    case BLKGETSIZE64:
-	ret = put_user((u64)ftl_hd[minor].nr_sects << 9, (u64 *)arg);
-	break;
-#endif
-    case BLKRRPART:
-	ret = ftl_reread_partitions(minor);
-	break;
-#if (LINUX_VERSION_CODE < 0x20303)
-    case BLKFLSBUF:
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
-	if (!capable(CAP_SYS_ADMIN)) return -EACCES;
-#endif
-	fsync_dev(inode->i_rdev);
-	invalidate_buffers(inode->i_rdev);
-	break;
-    RO_IOCTLS(inode->i_rdev, arg);
-#else
-    case BLKROSET:
-    case BLKROGET:
+	if (put_user(1, (char *)&geo->heads) ||
+	    put_user(8, (char *)&geo->sectors) ||
+	    put_user((sect>>3), (short *)&geo->cylinders) ||
+	    put_user(0, (u_long *)&geo->start))
+		return -EFAULT;
+
     case BLKFLSBUF:
-	ret = blk_ioctl(inode->i_rdev, cmd, arg);
-	break;
-#endif
-    default:
-	ret = -EINVAL;
+	    return 0;
     }
-
-    return ret;
+    return -ENOTTY;
 } /* ftl_ioctl */
 
-/*======================================================================
-
-    Handler for block device requests
 
-======================================================================*/
+/*======================================================================*/
 
-static int ftl_reread_partitions(int minor)
+static int ftl_readsect(struct mtd_blktrans_dev *dev,
+			      unsigned long block, char *buf)
 {
-    partition_t *part = myparts[minor >> 4];
-    int i, whole;
-
-    DEBUG(0, "ftl_cs: ftl_reread_partition(%d)\n", minor);
-    if ((atomic_read(&part->open) > 1)) {
-	    return -EBUSY;
-    }
-    whole = minor & ~(MAX_PART-1);
-
-    i = MAX_PART - 1;
-    while (i-- > 0) {
-	if (ftl_hd[whole+i].nr_sects > 0) {
-	    kdev_t rdev = MKDEV(FTL_MAJOR, whole+i);
-
-	    invalidate_device(rdev, 1);
-	}
-	ftl_hd[whole+i].start_sect = 0;
-	ftl_hd[whole+i].nr_sects = 0;
-    }
-
-    scan_header(part);
-
-    register_disk(&ftl_gendisk, whole >> PART_BITS, MAX_PART,
-		  &ftl_blk_fops, le32_to_cpu(part->header.FormattedSize)/SECTOR_SIZE);
-
-#ifdef PCMCIA_DEBUG
-    for (i = 0; i < MAX_PART; i++) {
-	if (ftl_hd[whole+i].nr_sects > 0)
-	    printk(KERN_INFO "  %d: start %ld size %ld\n", i,
-		   ftl_hd[whole+i].start_sect,
-		   ftl_hd[whole+i].nr_sects);
-    }
-#endif
-    return 0;
+	return ftl_read((void *)dev, buf, block, 1);
 }
 
-/*======================================================================
-
-    Handler for block device requests
-
-======================================================================*/
-
-static void do_ftl_request(request_arg_t)
+static int ftl_writesect(struct mtd_blktrans_dev *dev,
+			      unsigned long block, char *buf)
 {
-    int ret, minor;
-    partition_t *part;
-
-    do {
-      //	    sti();
-	INIT_REQUEST;
-
-	minor = MINOR(CURRENT->rq_dev);
-	
-	part = myparts[minor >> 4];
-	if (part) {
-	  ret = 0;
-	  
-	  switch (CURRENT->cmd) {
-	  case READ:
-	    ret = ftl_read(part, CURRENT->buffer,
-			   CURRENT->sector+ftl_hd[minor].start_sect,
-			   CURRENT->current_nr_sectors);
-	    if (ret) printk("ftl_read returned %d\n", ret);
-	    break;
-	    
-	  case WRITE:
-	    ret = ftl_write(part, CURRENT->buffer,
-			    CURRENT->sector+ftl_hd[minor].start_sect,
-			    CURRENT->current_nr_sectors);
-	    if (ret) printk("ftl_write returned %d\n", ret);
-	    break;
-	    
-	  default:
-	    panic("ftl_cs: unknown block command!\n");
-	    
-	  }
-	} else {
-	  ret = 1;
-	  printk("NULL part in ftl_request\n");
-	}
-	 
-	if (!ret) {
-	  CURRENT->sector += CURRENT->current_nr_sectors;
-	}
-	
-	end_request((ret == 0) ? 1 : 0);
-    } while (1);
-} /* do_ftl_request */
+	return ftl_write((void *)dev, buf, block, 1);
+}
 
 /*====================================================================*/
 
@@ -1337,19 +1055,9 @@
     
 } /* ftl_freepart */
 
-static void ftl_notify_add(struct mtd_info *mtd)
+static void ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
 {
 	partition_t *partition;
-	int device;
-
-	for (device=0; device < MAX_MTD_DEVICES && myparts[device]; device++)
-		;
-
-	if (device == MAX_MTD_DEVICES) {
-		printk(KERN_NOTICE "Maximum number of FTL partitions reached\n"
-		       "Not scanning <%s>\n", mtd->name);
-		return;
-	}
 
 	partition = kmalloc(sizeof(partition_t), GFP_KERNEL);
 		
@@ -1361,92 +1069,55 @@
 
 	memset(partition, 0, sizeof(partition_t));
 
-	partition->mtd = mtd;
+	partition->mbd.mtd = mtd;
 
 	if ((scan_header(partition) == 0) && 
 	    (build_maps(partition) == 0)) {
 		
 		partition->state = FTL_FORMATTED;
-		atomic_set(&partition->open, 0);
-		myparts[device] = partition;
-		ftl_reread_partitions(device << 4);
 #ifdef PCMCIA_DEBUG
-		printk(KERN_INFO "ftl_cs: opening %d kb FTL partition\n",
+		printk(KERN_INFO "ftl_cs: opening %d KiB FTL partition\n",
 		       le32_to_cpu(partition->header.FormattedSize) >> 10);
 #endif
+		partition->mbd.size = le32_to_cpu(partition->header.FormattedSize) >> 9;
+		partition->mbd.blksize = 512;
+		partition->mbd.tr = tr;
+		partition->mbd.devnum = -1;
+		if (add_mtd_blktrans_dev((void *)partition))
+			kfree(partition);
+	
 	} else
 		kfree(partition);
 }
 
-static void ftl_notify_remove(struct mtd_info *mtd)
+static void ftl_remove_dev(struct mtd_blktrans_dev *dev)
 {
-        int i,j;
-
-	/* Q: What happens if you try to remove a device which has
-	 *    a currently-open FTL partition on it?
-	 *
-	 * A: You don't. The ftl_open routine is responsible for
-	 *    increasing the use count of the driver module which
-	 *    it uses.
-	 */
-
-	/* That's the theory, anyway :) */
-
-	for (i=0; i< MAX_MTD_DEVICES; i++)
-		if (myparts[i] && myparts[i]->mtd == mtd) {
-
-			if (myparts[i]->state == FTL_FORMATTED)
-				ftl_freepart(myparts[i]);
-			
-			myparts[i]->state = 0;
-			for (j=0; j<16; j++) {
-				ftl_gendisk.part[j].nr_sects=0;
-				ftl_gendisk.part[j].start_sect=0;
-			}
-			kfree(myparts[i]);
-			myparts[i] = NULL;
-		}
+	del_mtd_blktrans_dev(dev);
+	kfree(dev);
 }
 
+struct mtd_blktrans_ops ftl_tr = {
+	.name		= "ftl",
+	.major		= FTL_MAJOR,
+	.part_bits	= 4,
+	.readsect	= ftl_readsect,
+	.writesect	= ftl_writesect,
+	.ioctl		= ftl_ioctl,
+	.add_mtd	= ftl_add_mtd,
+	.remove_dev	= ftl_remove_dev,
+	.owner		= THIS_MODULE,
+};
+
 int init_ftl(void)
 {
-    int i;
+	DEBUG(0, "$Id$\n");
 
-    memset(myparts, 0, sizeof(myparts));
-    
-    DEBUG(0, "$Id$\n");
-    
-    if (register_blkdev(FTL_MAJOR, "ftl", &ftl_blk_fops)) {
-	printk(KERN_NOTICE "ftl_cs: unable to grab major "
-	       "device number!\n");
-	return -EAGAIN;
-    }
-    
-    for (i = 0; i < MINOR_NR(MAX_DEV, 0, 0); i++)
-	ftl_blocksizes[i] = 1024;
-    for (i = 0; i < MAX_DEV*MAX_PART; i++) {
-	ftl_hd[i].nr_sects = 0;
-	ftl_hd[i].start_sect = 0;
-    }
-    blksize_size[FTL_MAJOR] = ftl_blocksizes;
-    ftl_gendisk.major = FTL_MAJOR;
-    blk_init_queue(BLK_DEFAULT_QUEUE(FTL_MAJOR), &do_ftl_request);
-    add_gendisk(&ftl_gendisk);
-    
-    register_mtd_user(&ftl_notifier);
-    
-    return 0;
+	return register_mtd_blktrans(&ftl_tr);
 }
 
 static void __exit cleanup_ftl(void)
 {
-    unregister_mtd_user(&ftl_notifier);
-
-    unregister_blkdev(FTL_MAJOR, "ftl");
-    blk_cleanup_queue(BLK_DEFAULT_QUEUE(FTL_MAJOR));
-    blksize_size[FTL_MAJOR] = NULL;
-
-    del_gendisk(&ftl_gendisk);
+	deregister_mtd_blktrans(&ftl_tr);
 }
 
 module_init(init_ftl);


From dwmw2 at infradead.org  Sun May 18 17:52:24 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:19 2006
Subject: mtd/drivers/mtd ftl.c,1.47,1.48
Message-ID: <E19HW4u-0003uC-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv14993

Modified Files:
	ftl.c 
Log Message:
Fix part_bits to match devices.txt, and use it.


Index: ftl.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/ftl.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- ftl.c	18 May 2003 20:57:57 -0000	1.47
+++ ftl.c	18 May 2003 21:52:21 -0000	1.48
@@ -98,8 +98,7 @@
 #define MAX_REGION	4
 
 /* Maximum number of partitions in an FTL region */
-#define PART_BITS	3
-#define MAX_PART	8
+#define PART_BITS	4
 
 /* Maximum number of outstanding erase requests per socket */
 #define MAX_ERASE	8
@@ -1080,7 +1079,7 @@
 		       le32_to_cpu(partition->header.FormattedSize) >> 10);
 #endif
 		partition->mbd.size = le32_to_cpu(partition->header.FormattedSize) >> 9;
-		partition->mbd.blksize = 512;
+		partition->mbd.blksize = SECTOR_SIZE;
 		partition->mbd.tr = tr;
 		partition->mbd.devnum = -1;
 		if (add_mtd_blktrans_dev((void *)partition))
@@ -1099,7 +1098,7 @@
 struct mtd_blktrans_ops ftl_tr = {
 	.name		= "ftl",
 	.major		= FTL_MAJOR,
-	.part_bits	= 4,
+	.part_bits	= PART_BITS,
 	.readsect	= ftl_readsect,
 	.writesect	= ftl_writesect,
 	.ioctl		= ftl_ioctl,


From dwmw2 at infradead.org  Sun May 18 18:29:51 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:19 2006
Subject: mtd/drivers/mtd nftlmount.c,1.32,1.33 nftlcore.c,1.88,1.89
Message-ID: <E19HWf8-0003wd-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv15157

Modified Files:
	nftlmount.c nftlcore.c 
Log Message:
Convert NFTL to blktrans (untested)


Index: nftlmount.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nftlmount.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- nftlmount.c	9 May 2003 22:34:12 -0000	1.32
+++ nftlmount.c	18 May 2003 22:29:47 -0000	1.33
@@ -59,8 +59,8 @@
 
         /* Assume logical EraseSize == physical erasesize for starting the scan. 
 	   We'll sort it out later if we find a MediaHeader which says otherwise */
-	nftl->EraseSize = nftl->mtd->erasesize;
-        nftl->nb_blocks = nftl->mtd->size / nftl->EraseSize;
+	nftl->EraseSize = nftl->mbd.mtd->erasesize;
+        nftl->nb_blocks = nftl->mbd.mtd->size / nftl->EraseSize;
 
 	nftl->MediaUnit = BLOCK_NIL;
 	nftl->SpareMediaUnit = BLOCK_NIL;
@@ -71,12 +71,12 @@
 
 		/* Check for ANAND header first. Then can whinge if it's found but later
 		   checks fail */
-		if ((ret = MTD_READ(nftl->mtd, block * nftl->EraseSize, SECTORSIZE, &retlen, buf))) {
+		if ((ret = MTD_READ(nftl->mbd.mtd, block * nftl->EraseSize, SECTORSIZE, &retlen, buf))) {
 			static int warncount = 5;
 
 			if (warncount) {
 				printk(KERN_WARNING "Block read at 0x%x of mtd%d failed: %d\n",
-				       block * nftl->EraseSize, nftl->mtd->index, ret);
+				       block * nftl->EraseSize, nftl->mbd.mtd->index, ret);
 				if (!--warncount)
 					printk(KERN_WARNING "Further failures for this block will not be printed\n");
 			}
@@ -87,16 +87,16 @@
 			/* ANAND\0 not found. Continue */
 #if 0
 			printk(KERN_DEBUG "ANAND header not found at 0x%x in mtd%d\n", 
-			       block * nftl->EraseSize, nftl->mtd->index);
+			       block * nftl->EraseSize, nftl->mbd.mtd->index);
 #endif			
 			continue;
 		}
 
 		/* To be safer with BIOS, also use erase mark as discriminant */
-		if ((ret = MTD_READOOB(nftl->mtd, block * nftl->EraseSize + SECTORSIZE + 8,
+		if ((ret = MTD_READOOB(nftl->mbd.mtd, block * nftl->EraseSize + SECTORSIZE + 8,
 				8, &retlen, (char *)&h1) < 0)) {
 			printk(KERN_WARNING "ANAND header found at 0x%x in mtd%d, but OOB data read failed (err %d)\n",
-			       block * nftl->EraseSize, nftl->mtd->index, ret);
+			       block * nftl->EraseSize, nftl->mbd.mtd->index, ret);
 			continue;
 		}
 
@@ -106,23 +106,23 @@
       */
 		if (le16_to_cpu(h1.EraseMark | h1.EraseMark1) != ERASE_MARK) {
 			printk(KERN_NOTICE "ANAND header found at 0x%x in mtd%d, but erase mark not present (0x%04x,0x%04x instead)\n",
-			       block * nftl->EraseSize, nftl->mtd->index, 
+			       block * nftl->EraseSize, nftl->mbd.mtd->index, 
 			       le16_to_cpu(h1.EraseMark), le16_to_cpu(h1.EraseMark1));
 			continue;
 		}
 
 		/* Finally reread to check ECC */
-		if ((ret = MTD_READECC(nftl->mtd, block * nftl->EraseSize, SECTORSIZE,
+		if ((ret = MTD_READECC(nftl->mbd.mtd, block * nftl->EraseSize, SECTORSIZE,
 				&retlen, buf, (char *)&oob, NAND_ECC_DISKONCHIP) < 0)) {
 			printk(KERN_NOTICE "ANAND header found at 0x%x in mtd%d, but ECC read failed (err %d)\n",
-			       block * nftl->EraseSize, nftl->mtd->index, ret);
+			       block * nftl->EraseSize, nftl->mbd.mtd->index, ret);
 			continue;
 		}
 
 		/* Paranoia. Check the ANAND header is still there after the ECC read */
 		if (memcmp(buf, "ANAND", 6)) {
 			printk(KERN_NOTICE "ANAND header found at 0x%x in mtd%d, but went away on reread!\n",
-			       block * nftl->EraseSize, nftl->mtd->index);
+			       block * nftl->EraseSize, nftl->mbd.mtd->index);
 			printk(KERN_NOTICE "New data are: %02x %02x %02x %02x %02x %02x\n",
 			       buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
 			continue;
@@ -167,8 +167,8 @@
 		} else if (mh->UnitSizeFactor != 0xff) {
 			printk(KERN_NOTICE "WARNING: Support for NFTL with UnitSizeFactor 0x%02x is experimental\n",
 			       mh->UnitSizeFactor);
-			nftl->EraseSize = nftl->mtd->erasesize << (0xff - mh->UnitSizeFactor);
-			nftl->nb_blocks = nftl->mtd->size / nftl->EraseSize;
+			nftl->EraseSize = nftl->mbd.mtd->erasesize << (0xff - mh->UnitSizeFactor);
+			nftl->nb_blocks = nftl->mbd.mtd->size / nftl->EraseSize;
 		}
 		nftl->nb_boot_blocks = le16_to_cpu(mh->FirstPhysicalEUN);
 		if ((nftl->nb_boot_blocks + 2) >= nftl->nb_blocks) {
@@ -186,7 +186,7 @@
 			return -1;
 		}
 		
-		nftl->nr_sects  = nftl->numvunits * (nftl->EraseSize / SECTORSIZE);
+		nftl->mbd.size  = nftl->numvunits * (nftl->EraseSize / SECTORSIZE);
 
 		/* If we're not using the last sectors in the device for some reason,
 		   reduce nb_blocks accordingly so we forget they're there */
@@ -224,7 +224,7 @@
 		for (i = 0; i < nftl->nb_blocks; i++) {
 			if ((i & (SECTORSIZE - 1)) == 0) {
 				/* read one sector for every SECTORSIZE of blocks */
-				if ((ret = MTD_READECC(nftl->mtd, block * nftl->EraseSize +
+				if ((ret = MTD_READECC(nftl->mbd.mtd, block * nftl->EraseSize +
 						       i + SECTORSIZE, SECTORSIZE, &retlen, buf,
 						       (char *)&oob, NAND_ECC_DISKONCHIP)) < 0) {
 					printk(KERN_NOTICE "Read of bad sector table failed (err %d)\n",
@@ -267,16 +267,16 @@
 	for (i = 0; i < len; i += SECTORSIZE) {
 		/* we want to read the sector without ECC check here since a free
 		   sector does not have ECC syndrome on it yet */
-		if (MTD_READ(nftl->mtd, address, SECTORSIZE, &retlen, buf) < 0)
+		if (MTD_READ(nftl->mbd.mtd, address, SECTORSIZE, &retlen, buf) < 0)
 			return -1;
 		if (memcmpb(buf, 0xff, SECTORSIZE) != 0)
 			return -1;
 
 		if (check_oob) {
-			if (MTD_READOOB(nftl->mtd, address, nftl->mtd->oobsize,
+			if (MTD_READOOB(nftl->mbd.mtd, address, nftl->mbd.mtd->oobsize,
 					&retlen, buf) < 0)
 				return -1;
-			if (memcmpb(buf, 0xff, nftl->mtd->oobsize) != 0)
+			if (memcmpb(buf, 0xff, nftl->mbd.mtd->oobsize) != 0)
 				return -1;
 		}
 		address += SECTORSIZE;
@@ -301,7 +301,7 @@
 	struct erase_info *instr = &nftl->instr;
 
 	/* Read the Unit Control Information #1 for Wear-Leveling */
-	if (MTD_READOOB(nftl->mtd, block * nftl->EraseSize + SECTORSIZE + 8,
+	if (MTD_READOOB(nftl->mbd.mtd, block * nftl->EraseSize + SECTORSIZE + 8,
 			8, &retlen, (char *)&uci) < 0)
 		goto default_uci1;
 
@@ -318,7 +318,7 @@
 	/* XXX: use async erase interface, XXX: test return code */
 	instr->addr = block * nftl->EraseSize;
 	instr->len = nftl->EraseSize;
-	MTD_ERASE(nftl->mtd, instr);
+	MTD_ERASE(nftl->mbd.mtd, instr);
 
 	if (instr->state == MTD_ERASE_FAILED) {
 		/* could not format, FixMe: We should update the BadUnitTable 
@@ -341,7 +341,7 @@
 			return -1;
 
 		uci.WearInfo = le32_to_cpu(nb_erases);
-		if (MTD_WRITEOOB(nftl->mtd, block * nftl->EraseSize + SECTORSIZE + 8, 8,
+		if (MTD_WRITEOOB(nftl->mbd.mtd, block * nftl->EraseSize + SECTORSIZE + 8, 8,
 				 &retlen, (char *)&uci) < 0)
 			return -1;
 		return 0;
@@ -367,7 +367,7 @@
 	block = first_block;
 	for (;;) {
 		for (i = 0; i < sectors_per_block; i++) {
-			if (MTD_READOOB(nftl->mtd, block * nftl->EraseSize + i * SECTORSIZE,
+			if (MTD_READOOB(nftl->mbd.mtd, block * nftl->EraseSize + i * SECTORSIZE,
 					8, &retlen, (char *)&bci) < 0)
 				status = SECTOR_IGNORE;
 			else
@@ -387,7 +387,7 @@
 					/* sector not free actually : mark it as SECTOR_IGNORE  */
 					bci.Status = SECTOR_IGNORE;
 					bci.Status1 = SECTOR_IGNORE;
-					MTD_WRITEOOB(nftl->mtd,
+					MTD_WRITEOOB(nftl->mbd.mtd,
 						     block * nftl->EraseSize + i * SECTORSIZE,
 						     8, &retlen, (char *)&bci);
 				}
@@ -480,7 +480,7 @@
 	size_t retlen;
 
 	/* check erase mark. */
-	if (MTD_READOOB(nftl->mtd, block * nftl->EraseSize + SECTORSIZE + 8, 8, 
+	if (MTD_READOOB(nftl->mbd.mtd, block * nftl->EraseSize + SECTORSIZE + 8, 8, 
 			&retlen, (char *)&h1) < 0)
 		return -1;
 
@@ -495,7 +495,7 @@
 		h1.EraseMark = cpu_to_le16(ERASE_MARK);
 		h1.EraseMark1 = cpu_to_le16(ERASE_MARK);
 		h1.WearInfo = cpu_to_le32(0);
-		if (MTD_WRITEOOB(nftl->mtd, block * nftl->EraseSize + SECTORSIZE + 8, 8, 
+		if (MTD_WRITEOOB(nftl->mbd.mtd, block * nftl->EraseSize + SECTORSIZE + 8, 8, 
 				 &retlen, (char *)&h1) < 0)
 			return -1;
 	} else {
@@ -507,7 +507,7 @@
 						SECTORSIZE, 0) != 0)
 				return -1;
 
-			if (MTD_READOOB(nftl->mtd, block * nftl->EraseSize + i,
+			if (MTD_READOOB(nftl->mbd.mtd, block * nftl->EraseSize + i,
 					16, &retlen, buf) < 0)
 				return -1;
 			if (i == SECTORSIZE) {
@@ -537,7 +537,7 @@
 	struct nftl_uci2 uci;
 	size_t retlen;
 
-	if (MTD_READOOB(nftl->mtd, block * nftl->EraseSize + 2 * SECTORSIZE + 8,
+	if (MTD_READOOB(nftl->mbd.mtd, block * nftl->EraseSize + 2 * SECTORSIZE + 8,
 			8, &retlen, (char *)&uci) < 0)
 		return 0;
 
@@ -576,9 +576,9 @@
 
 			for (;;) {
 				/* read the block header. If error, we format the chain */
-				if (MTD_READOOB(s->mtd, block * s->EraseSize + 8, 8, 
+				if (MTD_READOOB(s->mbd.mtd, block * s->EraseSize + 8, 8, 
 						&retlen, (char *)&h0) < 0 ||
-				    MTD_READOOB(s->mtd, block * s->EraseSize + SECTORSIZE + 8, 8, 
+				    MTD_READOOB(s->mbd.mtd, block * s->EraseSize + SECTORSIZE + 8, 8, 
 						&retlen, (char *)&h1) < 0) {
 					s->ReplUnitTable[block] = BLOCK_NIL;
 					do_format_chain = 1;

Index: nftlcore.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nftlcore.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- nftlcore.c	2 Mar 2003 18:45:07 -0000	1.88
+++ nftlcore.c	18 May 2003 22:29:47 -0000	1.89
@@ -23,15 +23,13 @@
 #include <linux/slab.h>
 #include <linux/sched.h>
 #include <linux/init.h>
-#include <linux/blkpg.h>
+#include <linux/hdreg.h>
 
-#ifdef CONFIG_KMOD
 #include <linux/kmod.h>
-#endif
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/nftl.h>
-#include <linux/mtd/compatmac.h>
+#include <linux/mtd/blktrans.h>
 
 /* maximum number of loops while examining next block, to have a
    chance to detect consistency problems (they should never happen
@@ -39,87 +37,29 @@
 
 #define MAX_LOOPS 10000
 
-/* NFTL block device stuff */
-#define MAJOR_NR NFTL_MAJOR
-#define DEVICE_REQUEST nftl_request
-#define DEVICE_OFF(device)
-
-
-#include <linux/blk.h>
-#include <linux/hdreg.h>
-
-/* Linux-specific block device functions */
-
-/* I _HATE_ the Linux block device setup more than anything else I've ever
- *  encountered, except ...
- */
-
-static int nftl_sizes[256];
-static int nftl_blocksizes[256];
-
-/* .. for the Linux partition table handling. */
-struct hd_struct part_table[256];
-
-#if LINUX_VERSION_CODE < 0x20328
-static void dummy_init (struct gendisk *crap)
-{}
-#endif
-
-static struct gendisk nftl_gendisk = {
-	major:		MAJOR_NR,
-	major_name:	"nftl",
-	minor_shift:	NFTL_PARTN_BITS,	/* Bits to shift to get real from partition */
-	max_p:		(1<<NFTL_PARTN_BITS)-1,	/* Number of partitions per real */
-#if LINUX_VERSION_CODE < 0x20328
-	max_nr:		MAX_NFTLS,      /* maximum number of real */
-	init:		dummy_init,     /* init function */
-#endif
-	part:		part_table,     /* hd struct */
-	sizes:		nftl_sizes,     /* block sizes */
-};
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,14)
-#define BLK_INC_USE_COUNT MOD_INC_USE_COUNT
-#define BLK_DEC_USE_COUNT MOD_DEC_USE_COUNT
-#else
-#define BLK_INC_USE_COUNT do {} while(0)
-#define BLK_DEC_USE_COUNT do {} while(0)
-#endif
-
-struct NFTLrecord *NFTLs[MAX_NFTLS];
 
-static void NFTL_setup(struct mtd_info *mtd)
+static void nftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
 {
-	int i;
 	struct NFTLrecord *nftl;
 	unsigned long temp;
-	int firstfree = -1;
-
-	DEBUG(MTD_DEBUG_LEVEL1,"NFTL_setup\n");
 
-	for (i = 0; i < MAX_NFTLS; i++) {
-		if (!NFTLs[i] && firstfree == -1)
-			firstfree = i;
-		else if (NFTLs[i] && NFTLs[i]->mtd == mtd) {
-			/* This is a Spare Media Header for an NFTL we've already found */
-			DEBUG(MTD_DEBUG_LEVEL1, "MTD already mounted as NFTL\n");
-			return;
-		}
-	}
-        if (firstfree == -1) {
-		printk(KERN_WARNING "No more NFTL slot available\n");
+	if (mtd->ecctype != MTD_ECC_RS_DiskOnChip)
 		return;
-        }
+
+	DEBUG(MTD_DEBUG_LEVEL1, "nftl_add_mtd for %s\n", mtd->name);
 
 	nftl = kmalloc(sizeof(struct NFTLrecord), GFP_KERNEL);
+
 	if (!nftl) {
 		printk(KERN_WARNING "Out of memory for NFTL data structures\n");
 		return;
 	}
+	memset(nftl, 0, sizeof(*nftl));
 
-	init_MUTEX(&nftl->mutex);
-
-	nftl->mtd = mtd;
+	nftl->mbd.mtd = mtd;
+	nftl->mbd.devnum = -1;
+	nftl->mbd.blksize = 512;
+	nftl->mbd.tr = tr;
 
         if (NFTL_mount(nftl) < 0) {
 		printk(KERN_WARNING "Could not mount NFTL device\n");
@@ -128,100 +68,65 @@
         }
 
 	/* OK, it's a new one. Set up all the data structures. */
-#ifdef PSYCHO_DEBUG
-	printk("Found new NFTL nftl%c\n", firstfree + 'a');
-#endif
 
-        /* linux stuff */
-	nftl->usecount = 0;
+	/* Calculate geometry */
 	nftl->cylinders = 1024;
 	nftl->heads = 16;
 
 	temp = nftl->cylinders * nftl->heads;
-	nftl->sectors = nftl->nr_sects / temp;
-	if (nftl->nr_sects % temp) {
+	nftl->sectors = nftl->mbd.size / temp;
+	if (nftl->mbd.size % temp) {
 		nftl->sectors++;
 		temp = nftl->cylinders * nftl->sectors;
-		nftl->heads = nftl->nr_sects / temp;
+		nftl->heads = nftl->mbd.size / temp;
 
-		if (nftl->nr_sects % temp) {
+		if (nftl->mbd.size % temp) {
 			nftl->heads++;
 			temp = nftl->heads * nftl->sectors;
-			nftl->cylinders = nftl->nr_sects / temp;
+			nftl->cylinders = nftl->mbd.size / temp;
 		}
 	}
 
-	if (nftl->nr_sects != nftl->heads * nftl->cylinders * nftl->sectors) {
+	if (nftl->mbd.size != nftl->heads * nftl->cylinders * nftl->sectors) {
+		/*
+		  Oh no we don't have 
+		   mbd.size == heads * cylinders * sectors
+		*/
 		printk(KERN_WARNING "Cannot calculate an NFTL geometry to "
-		       "match size of 0x%x.\n", nftl->nr_sects);
+		       "precisely match size of 0x%lx.\n", nftl->mbd.size);
 		printk(KERN_WARNING "Using C:%d H:%d S:%d (== 0x%lx sects)\n", 
 		       nftl->cylinders, nftl->heads , nftl->sectors, 
 		       (long)nftl->cylinders * (long)nftl->heads * (long)nftl->sectors );
+	}
 
-		/* Oh no we don't have nftl->nr_sects = nftl->heads * nftl->cylinders * nftl->sectors; */
+	if (add_mtd_blktrans_dev) {
+		if (nftl->ReplUnitTable)
+			kfree(nftl->ReplUnitTable);
+		if (nftl->EUNtable)
+			kfree(nftl->EUNtable);
+		kfree(nftl);
+		return;
 	}
-	NFTLs[firstfree] = nftl;
-	/* Finally, set up the block device sizes */
-	nftl_sizes[firstfree * 16] = nftl->nr_sects;
-	//nftl_blocksizes[firstfree*16] = 512;
-	part_table[firstfree * 16].nr_sects = nftl->nr_sects;
-
-	nftl_gendisk.nr_real++;
-
-	/* partition check ... */
-#if LINUX_VERSION_CODE < 0x20328
-	resetup_one_dev(&nftl_gendisk, firstfree);
-#else
-	grok_partitions(&nftl_gendisk, firstfree, 1<<NFTL_PARTN_BITS, nftl->nr_sects);
+#ifdef PSYCHO_DEBUG
+	printk("Found new NFTL nftl%c\n", nftl->mbd.devnum + 'a');
 #endif
+	return;
 }
 
-static void NFTL_unsetup(int i)
+static void nftl_remove_dev(struct mtd_blktrans_dev *dev)
 {
-	struct NFTLrecord *nftl = NFTLs[i];
+	struct NFTLrecord *nftl = (void *)dev;
 
-	DEBUG(MTD_DEBUG_LEVEL1, "NFTL_unsetup %d\n", i);
-	
-	NFTLs[i] = NULL;
-	
+	DEBUG(MTD_DEBUG_LEVEL1, "nftl_remove_dev %d\n", dev->devnum);
+
+	del_mtd_blktrans_dev(dev);
 	if (nftl->ReplUnitTable)
 		kfree(nftl->ReplUnitTable);
 	if (nftl->EUNtable)
 		kfree(nftl->EUNtable);
-		      
-	nftl_gendisk.nr_real--;
 	kfree(nftl);
 }
 
-/* Search the MTD device for NFTL partitions */
-static void NFTL_notify_add(struct mtd_info *mtd)
-{
-	DEBUG(MTD_DEBUG_LEVEL1, "NFTL_notify_add for %s\n", mtd->name);
-
-	if (mtd) {
-		if (!mtd->read_oob) {
-			/* If this MTD doesn't have out-of-band data,
-			   then there's no point continuing */
-			DEBUG(MTD_DEBUG_LEVEL1, "No OOB data, quitting\n");
-			return;
-		}
-		DEBUG(MTD_DEBUG_LEVEL3, "mtd->read = %p, size = %d, erasesize = %d\n", 
-		      mtd->read, mtd->size, mtd->erasesize);
-
-                NFTL_setup(mtd);
-	}
-}
-
-static void NFTL_notify_remove(struct mtd_info *mtd)
-{
-	int i;
-
-	for (i = 0; i < MAX_NFTLS; i++) {
-		if (NFTLs[i] && NFTLs[i]->mtd == mtd)
-			NFTL_unsetup(i);
-	}
-}
-
 #ifdef CONFIG_NFTL_RW
 
 /* Actual NFTL access routines */
@@ -303,7 +208,7 @@
 
 		targetEUN = thisEUN;
 		for (block = 0; block < nftl->EraseSize / 512; block ++) {
-			MTD_READOOB(nftl->mtd,
+			MTD_READOOB(nftl->mbd.mtd,
 				    (thisEUN * nftl->EraseSize) + (block * 512),
 				    16 , &retlen, (char *)&oob);
 			if (block == 2) {
@@ -420,7 +325,7 @@
                chain by selecting the longer one */
             oob.u.c.FoldMark = oob.u.c.FoldMark1 = cpu_to_le16(FOLD_MARK_IN_PROGRESS);
             oob.u.c.unused = 0xffffffff;
-            MTD_WRITEOOB(nftl->mtd, (nftl->EraseSize * targetEUN) + 2 * 512 + 8, 
+            MTD_WRITEOOB(nftl->mbd.mtd, (nftl->EraseSize * targetEUN) + 2 * 512 + 8, 
                          8, &retlen, (char *)&oob.u);
         }
 
@@ -444,16 +349,16 @@
                 if (BlockMap[block] == BLOCK_NIL)
                         continue;
                 
-                ret = MTD_READECC(nftl->mtd, (nftl->EraseSize * BlockMap[block]) + (block * 512),
+                ret = MTD_READECC(nftl->mbd.mtd, (nftl->EraseSize * BlockMap[block]) + (block * 512),
 				  512, &retlen, movebuf, (char *)&oob, NAND_ECC_DISKONCHIP); 
                 if (ret < 0) {
-                    ret = MTD_READECC(nftl->mtd, (nftl->EraseSize * BlockMap[block])
+                    ret = MTD_READECC(nftl->mbd.mtd, (nftl->EraseSize * BlockMap[block])
                                       + (block * 512), 512, &retlen,
                                       movebuf, (char *)&oob, NAND_ECC_DISKONCHIP); 
                     if (ret != -EIO) 
                         printk("Error went away on retry.\n");
                 }
-                MTD_WRITEECC(nftl->mtd, (nftl->EraseSize * targetEUN) + (block * 512),
+                MTD_WRITEECC(nftl->mbd.mtd, (nftl->EraseSize * targetEUN) + (block * 512),
                              512, &retlen, movebuf, (char *)&oob, NAND_ECC_DISKONCHIP);
 	}
         
@@ -462,7 +367,7 @@
                 = cpu_to_le16(thisVUC);
         oob.u.a.ReplUnitNum = oob.u.a.SpareReplUnitNum = 0xffff;
         
-        MTD_WRITEOOB(nftl->mtd, (nftl->EraseSize * targetEUN) + 8, 
+        MTD_WRITEOOB(nftl->mbd.mtd, (nftl->EraseSize * targetEUN) + 8, 
                      8, &retlen, (char *)&oob.u);
 
 	/* OK. We've moved the whole lot into the new block. Now we have to free the original blocks. */
@@ -582,7 +487,7 @@
 
 			lastEUN = writeEUN;
 
-			MTD_READOOB(nftl->mtd, (writeEUN * nftl->EraseSize) + blockofs,
+			MTD_READOOB(nftl->mbd.mtd, (writeEUN * nftl->EraseSize) + blockofs,
 				    8, &retlen, (char *)&bci);
 			
 			DEBUG(MTD_DEBUG_LEVEL2, "Status of block %d in EUN %d is %x\n",
@@ -670,12 +575,12 @@
 		nftl->ReplUnitTable[writeEUN] = BLOCK_NIL;
 
 		/* ... and on the flash itself */
-		MTD_READOOB(nftl->mtd, writeEUN * nftl->EraseSize + 8, 8,
+		MTD_READOOB(nftl->mbd.mtd, writeEUN * nftl->EraseSize + 8, 8,
 			    &retlen, (char *)&oob.u);
 
 		oob.u.a.VirtUnitNum = oob.u.a.SpareVirtUnitNum = cpu_to_le16(thisVUC);
 
-		MTD_WRITEOOB(nftl->mtd, writeEUN * nftl->EraseSize + 8, 8,
+		MTD_WRITEOOB(nftl->mbd.mtd, writeEUN * nftl->EraseSize + 8, 8,
                              &retlen, (char *)&oob.u);
 
                 /* we link the new block to the chain only after the
@@ -685,13 +590,13 @@
 			/* Both in our cache... */
 			nftl->ReplUnitTable[lastEUN] = writeEUN;
 			/* ... and on the flash itself */
-			MTD_READOOB(nftl->mtd, (lastEUN * nftl->EraseSize) + 8,
+			MTD_READOOB(nftl->mbd.mtd, (lastEUN * nftl->EraseSize) + 8,
 				    8, &retlen, (char *)&oob.u);
 
 			oob.u.a.ReplUnitNum = oob.u.a.SpareReplUnitNum
 				= cpu_to_le16(writeEUN);
 
-			MTD_WRITEOOB(nftl->mtd, (lastEUN * nftl->EraseSize) + 8,
+			MTD_WRITEOOB(nftl->mbd.mtd, (lastEUN * nftl->EraseSize) + 8,
 				     8, &retlen, (char *)&oob.u);
 		}
 
@@ -704,8 +609,10 @@
 	return 0xffff;
 }
 
-static int NFTL_writeblock(struct NFTLrecord *nftl, unsigned block, char *buffer)
+static int nftl_writeblock(struct mtd_blktrans_dev *mbd, unsigned long block,
+			   char *buffer)
 {
+	struct NFTLrecord *nftl = (void *)mbd;
 	u16 writeEUN;
 	unsigned long blockofs = (block * 512) & (nftl->EraseSize - 1);
 	size_t retlen;
@@ -720,7 +627,7 @@
 		return 1;
 	}
 
-	MTD_WRITEECC(nftl->mtd, (writeEUN * nftl->EraseSize) + blockofs,
+	MTD_WRITEECC(nftl->mbd.mtd, (writeEUN * nftl->EraseSize) + blockofs,
 		     512, &retlen, (char *)buffer, (char *)eccbuf, NAND_ECC_DISKONCHIP);
         /* no need to write SECTOR_USED flags since they are written in mtd_writeecc */
 
@@ -728,8 +635,10 @@
 }
 #endif /* CONFIG_NFTL_RW */
 
-static int NFTL_readblock(struct NFTLrecord *nftl, unsigned block, char *buffer)
+static int nftl_readblock(struct mtd_blktrans_dev *mbd, unsigned long block,
+			  char *buffer)
 {
+	struct NFTLrecord *nftl = (void *)mbd;
 	u16 lastgoodEUN;
 	u16 thisEUN = nftl->EUNtable[block / (nftl->EraseSize / 512)];
 	unsigned long blockofs = (block * 512) & (nftl->EraseSize - 1);
@@ -742,7 +651,7 @@
 
         if (thisEUN != BLOCK_NIL) {
 		while (thisEUN < nftl->nb_blocks) {
-			if (MTD_READOOB(nftl->mtd, (thisEUN * nftl->EraseSize) + blockofs,
+			if (MTD_READOOB(nftl->mbd.mtd, (thisEUN * nftl->EraseSize) + blockofs,
 					8, &retlen, (char *)&bci) < 0)
 				status = SECTOR_IGNORE;
 			else
@@ -761,13 +670,13 @@
 			case SECTOR_IGNORE:
 				break;
 			default:
-				printk("Unknown status for block %d in EUN %d: %x\n",
+				printk("Unknown status for block %ld in EUN %d: %x\n",
 				       block, thisEUN, status);
 				break;
 			}
 
 			if (!silly--) {
-				printk(KERN_WARNING "Infinite loop in Virtual Unit Chain 0x%x\n",
+				printk(KERN_WARNING "Infinite loop in Virtual Unit Chain 0x%lx\n",
 				       block / (nftl->EraseSize / 512));
 				return 1;
 			}
@@ -783,20 +692,17 @@
 		loff_t ptr = (lastgoodEUN * nftl->EraseSize) + blockofs;
 		size_t retlen;
 		u_char eccbuf[6];
-		if (MTD_READECC(nftl->mtd, ptr, 512, &retlen, buffer, eccbuf, NAND_ECC_DISKONCHIP))
+		if (MTD_READECC(nftl->mbd.mtd, ptr, 512, &retlen, buffer, eccbuf, NAND_ECC_DISKONCHIP))
 			return -EIO;
 	}
 	return 0;
 }
 
-static int nftl_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg)
+static int nftl_ioctl(struct mtd_blktrans_dev *dev,
+		     struct inode * inode, struct file * file, 
+		     unsigned int cmd, unsigned long arg)
 {
-	struct NFTLrecord *nftl;
-	int p;
-
-	nftl = NFTLs[MINOR(inode->i_rdev) >> NFTL_PARTN_BITS];
-
-	if (!nftl) return -EINVAL;
+	struct NFTLrecord *nftl = (void *)dev;
 
 	switch (cmd) {
 	case HDIO_GETGEO: {
@@ -805,242 +711,18 @@
 		g.heads = nftl->heads;
 		g.sectors = nftl->sectors;
 		g.cylinders = nftl->cylinders;
-		g.start = part_table[MINOR(inode->i_rdev)].start_sect;
+		g.start = 0;
 		return copy_to_user((void *)arg, &g, sizeof g) ? -EFAULT : 0;
 	}
-	case BLKGETSIZE:   /* Return device size */
-		return put_user(part_table[MINOR(inode->i_rdev)].nr_sects,
-                                (unsigned long *) arg);
-
-#ifdef BLKGETSIZE64
-	case BLKGETSIZE64:
-		return put_user((u64)part_table[MINOR(inode->i_rdev)].nr_sects << 9,
-                                (u64 *)arg);
-#endif
 
 	case BLKFLSBUF:
-		if (!capable(CAP_SYS_ADMIN)) return -EACCES;
-		fsync_dev(inode->i_rdev);
-		invalidate_buffers(inode->i_rdev);
-		if (nftl->mtd->sync)
-			nftl->mtd->sync(nftl->mtd);
 		return 0;
 
-	case BLKRRPART:
-		if (!capable(CAP_SYS_ADMIN)) return -EACCES;
-		if (nftl->usecount > 1) return -EBUSY;
-		/* 
-		 * We have to flush all buffers and invalidate caches,
-		 * or we won't be able to re-use the partitions,
-		 * if there was a change and we don't want to reboot
-		 */
-		p = (1<<NFTL_PARTN_BITS) - 1;
-		while (p-- > 0) {
-			kdev_t devp = MKDEV(MAJOR(inode->i_dev), MINOR(inode->i_dev)+p);
-			if (part_table[p].nr_sects > 0)
-				invalidate_device (devp, 1);
-
-			part_table[MINOR(inode->i_dev)+p].start_sect = 0;
-			part_table[MINOR(inode->i_dev)+p].nr_sects = 0;
-		}
-		
-#if LINUX_VERSION_CODE < 0x20328
-		resetup_one_dev(&nftl_gendisk, MINOR(inode->i_rdev) >> NFTL_PARTN_BITS);
-#else
-		grok_partitions(&nftl_gendisk, MINOR(inode->i_rdev) >> NFTL_PARTN_BITS,
-				1<<NFTL_PARTN_BITS, nftl->nr_sects);
-#endif
-		return 0;
-
-#if (LINUX_VERSION_CODE < 0x20303)		
-	RO_IOCTLS(inode->i_rdev, arg);  /* ref. linux/blk.h */
-#else
-	case BLKROSET:
-	case BLKROGET:
-	case BLKSSZGET:
-		return blk_ioctl(inode->i_rdev, cmd, arg);
-#endif
-
 	default:
-		return -EINVAL;
-	}
-}
-
-void nftl_request(RQFUNC_ARG)
-{
-	unsigned int dev, block, nsect;
-	struct NFTLrecord *nftl;
-	char *buffer;
-	struct request *req;
-	int res;
-
-	while (1) {
-		INIT_REQUEST;	/* blk.h */
-		req = CURRENT;
-		
-		/* We can do this because the generic code knows not to
-		   touch the request at the head of the queue */
-		spin_unlock_irq(&io_request_lock);
-
-		DEBUG(MTD_DEBUG_LEVEL2, "NFTL_request\n");
-		DEBUG(MTD_DEBUG_LEVEL3, "NFTL %s request, from sector 0x%04lx for 0x%04lx sectors\n",
-		      (req->cmd == READ) ? "Read " : "Write",
-		      req->sector, req->current_nr_sectors);
-
-		dev = MINOR(req->rq_dev);
-		block = req->sector;
-		nsect = req->current_nr_sectors;
-		buffer = req->buffer;
-		res = 1; /* succeed */
-
-		if (dev >= MAX_NFTLS * (1<<NFTL_PARTN_BITS)) {
-			/* there is no such partition */
-			printk("nftl: bad minor number: device = %s\n",
-			       kdevname(req->rq_dev));
-			res = 0; /* fail */
-			goto repeat;
-		}
-		
-		nftl = NFTLs[dev / (1<<NFTL_PARTN_BITS)];
-		DEBUG(MTD_DEBUG_LEVEL3, "Waiting for mutex\n");
-		down(&nftl->mutex);
-		DEBUG(MTD_DEBUG_LEVEL3, "Got mutex\n");
-
-		if (block + nsect > part_table[dev].nr_sects) {
-			/* access past the end of device */
-			printk("nftl%c%d: bad access: block = %d, count = %d\n",
-			       (MINOR(req->rq_dev)>>6)+'a', dev & 0xf, block, nsect);
-			up(&nftl->mutex);
-			res = 0; /* fail */
-			goto repeat;
-		}
-		
-		block += part_table[dev].start_sect;
-		
-		if (req->cmd == READ) {
-			DEBUG(MTD_DEBUG_LEVEL2, "NFTL read request of 0x%x sectors @ %x "
-			      "(req->nr_sectors == %lx)\n", nsect, block, req->nr_sectors);
-	
-			for ( ; nsect > 0; nsect-- , block++, buffer += 512) {
-				/* Read a single sector to req->buffer + (512 * i) */
-				if (NFTL_readblock(nftl, block, buffer)) {
-					DEBUG(MTD_DEBUG_LEVEL2, "NFTL read request failed\n");
-					up(&nftl->mutex);
-					res = 0;
-					goto repeat;
-				}
-			}
-
-			DEBUG(MTD_DEBUG_LEVEL2,"NFTL read request completed OK\n");
-			up(&nftl->mutex);
-			goto repeat;
-		} else if (req->cmd == WRITE) {
-			DEBUG(MTD_DEBUG_LEVEL2, "NFTL write request of 0x%x sectors @ %x "
-			      "(req->nr_sectors == %lx)\n", nsect, block,
-			      req->nr_sectors);
-#ifdef CONFIG_NFTL_RW
-			for ( ; nsect > 0; nsect-- , block++, buffer += 512) {
-				/* Read a single sector to req->buffer + (512 * i) */
-				if (NFTL_writeblock(nftl, block, buffer)) {
-					DEBUG(MTD_DEBUG_LEVEL1,"NFTL write request failed\n");
-					up(&nftl->mutex);
-					res = 0;
-					goto repeat;
-				}
-			}
-			DEBUG(MTD_DEBUG_LEVEL2,"NFTL write request completed OK\n");
-#else
-			res = 0; /* Writes always fail */
-#endif /* CONFIG_NFTL_RW */
-			up(&nftl->mutex);
-			goto repeat;
-		} else {
-			DEBUG(MTD_DEBUG_LEVEL0, "NFTL unknown request\n");
-			up(&nftl->mutex);
-			res = 0;
-			goto repeat;
-		}
-	repeat: 
-		DEBUG(MTD_DEBUG_LEVEL3, "end_request(%d)\n", res);
-		spin_lock_irq(&io_request_lock);
-		end_request(res);
+		return -ENOTTY;
 	}
 }
 
-static int nftl_open(struct inode *ip, struct file *fp)
-{
-	int nftlnum = MINOR(ip->i_rdev) >> NFTL_PARTN_BITS;
-	struct NFTLrecord *thisNFTL;
-	thisNFTL = NFTLs[nftlnum];
-
-	DEBUG(MTD_DEBUG_LEVEL2,"NFTL_open\n");
-
-#ifdef CONFIG_KMOD
-	if (!thisNFTL && nftlnum == 0) {
-		request_module("docprobe");
-		thisNFTL = NFTLs[nftlnum];
-	}
-#endif
-	if (!thisNFTL) {
-		DEBUG(MTD_DEBUG_LEVEL2,"ENODEV: thisNFTL = %d, minor = %d, ip = %p, fp = %p\n", 
-		      nftlnum, ip->i_rdev, ip, fp);
-		return -ENODEV;
-	}
-
-#ifndef CONFIG_NFTL_RW
-	if (fp->f_mode & FMODE_WRITE)
-		return -EROFS;
-#endif /* !CONFIG_NFTL_RW */
-
-	thisNFTL->usecount++;
-	BLK_INC_USE_COUNT;
-	if (!get_mtd_device(thisNFTL->mtd, -1)) {
-		BLK_DEC_USE_COUNT;
-		return -ENXIO;
-	}
-
-	return 0;
-}
-
-static int nftl_release(struct inode *inode, struct file *fp)
-{
-	struct NFTLrecord *thisNFTL;
-
-	thisNFTL = NFTLs[MINOR(inode->i_rdev) / 16];
-
-	DEBUG(MTD_DEBUG_LEVEL2, "NFTL_release\n");
-
-	if (thisNFTL->mtd->sync)
-		thisNFTL->mtd->sync(thisNFTL->mtd);
-	thisNFTL->usecount--;
-	BLK_DEC_USE_COUNT;
-
-	put_mtd_device(thisNFTL->mtd);
-
-	return 0;
-}
-#if LINUX_VERSION_CODE < 0x20326
-static struct file_operations nftl_fops = {
-	read:		block_read,
-	write:		block_write,
-	ioctl:		nftl_ioctl,
-	open:		nftl_open,
-	release:	nftl_release,
-	fsync:		block_fsync,
-};
-#else
-static struct block_device_operations nftl_fops = 
-{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,14)
-	owner:		THIS_MODULE,
-#endif
-	open:		nftl_open,
-	release:	nftl_release,
-	ioctl: 		nftl_ioctl
-};
-#endif
-
-
 
 /****************************************************************************
  *
@@ -1048,49 +730,31 @@
  *
  ****************************************************************************/
 
-static struct mtd_notifier nftl_notifier = {
-	.add	= NFTL_notify_add,
-	.remove	= NFTL_notify_remove
+
+struct mtd_blktrans_ops nftl_tr = {
+	.name		= "nftl",
+	.major		= NFTL_MAJOR,
+	.part_bits	= NFTL_PARTN_BITS,
+	.ioctl		= nftl_ioctl,
+	.readsect	= nftl_readblock,
+	.writesect	= nftl_writeblock,
+	.add_mtd	= nftl_add_mtd,
+	.remove_dev	= nftl_remove_dev,
+	.owner		= THIS_MODULE,
 };
 
 extern char nftlmountrev[];
 
 int __init init_nftl(void)
 {
-	int i;
-
-#ifdef PRERELEASE 
 	printk(KERN_INFO "NFTL driver: nftlcore.c $Revision$, nftlmount.c %s\n", nftlmountrev);
-#endif
-
-	if (register_blkdev(MAJOR_NR, "nftl", &nftl_fops)){
-		printk("unable to register NFTL block device on major %d\n", MAJOR_NR);
-		return -EBUSY;
-	} else {
-		blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), &nftl_request);
 
-		/* set block size to 1kB each */
-		for (i = 0; i < 256; i++) {
-			nftl_blocksizes[i] = 1024;
-		}
-		blksize_size[MAJOR_NR] = nftl_blocksizes;
-
-		add_gendisk(&nftl_gendisk);
-	}
-	
-	register_mtd_user(&nftl_notifier);
-
-	return 0;
+	return register_mtd_blktrans(&nftl_tr);
 }
 
 static void __exit cleanup_nftl(void)
 {
-  	unregister_mtd_user(&nftl_notifier);
-  	unregister_blkdev(MAJOR_NR, "nftl");
-  	
-  	blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
-
-	del_gendisk(&nftl_gendisk);
+	deregister_mtd_blktrans(&nftl_tr);
 }
 
 module_init(init_nftl);


From dwmw2 at infradead.org  Mon May 19 10:22:43 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:19 2006
Subject: mtd/drivers/mtd redboot.c,1.9,1.10
Message-ID: <E19HlXH-0004fA-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv17905/drivers/mtd

Modified Files:
	redboot.c 
Log Message:
Fix module leaving strings behind

Index: redboot.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/redboot.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- redboot.c	16 May 2003 17:08:24 -0000	1.9
+++ redboot.c	19 May 2003 14:22:41 -0000	1.10
@@ -45,7 +45,9 @@
 	int ret, i;
 	size_t retlen;
 	char *names;
+	char *nullname;
 	int namelen = 0;
+	static char nullstring[] = "unallocated";
 
 	buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
 
@@ -116,18 +118,24 @@
 		if (tmp_fl->img->flash_base + tmp_fl->img->size + master->erasesize < tmp_fl->next->img->flash_base)
 			nrparts++;
 	}
-	parts = kmalloc(sizeof(*parts)*nrparts + namelen, GFP_KERNEL);
+	parts = kmalloc(sizeof(*parts)*nrparts + sizeof(nullstring) + namelen, GFP_KERNEL);
 
 	if (!parts) {
 		ret = -ENOMEM;
 		goto out;
 	}
-	names = (char *)&parts[nrparts];
+
 	memset(parts, 0, sizeof(*parts)*nrparts + namelen);
+
+	/* FIXME: Include nullname only if it's used */
+	nullname = (char *)&parts[nrparts];
+	sprintf(nullname, nullstring);
+	names = nullname + sizeof(nullstring);
+
 	i=0;
 
 	if (fl->img->flash_base) {
-	       parts[0].name = "unallocated space";
+	       parts[0].name = nullname;
 	       parts[0].size = fl->img->flash_base;
 	       parts[0].offset = 0;
 	}
@@ -143,7 +151,7 @@
 			i++;
 			parts[i].offset = parts[i-1].size + parts[i-1].offset;
 			parts[i].size = fl->next->img->flash_base - parts[i].offset;
-			parts[i].name = "unallocated space";
+			parts[i].name = nullname;
 		}
 		tmp_fl = fl;
 		fl = fl->next;


From dwmw2 at infradead.org  Tue May 20 09:10:07 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:19 2006
Subject: mtd/drivers/mtd/maps Makefile,1.42,1.43
Message-ID: <E19I6sZ-0003o6-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv14593/maps

Modified Files:
	Makefile 
Log Message:
don't die if no Rules.make

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Makefile,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- Makefile	17 May 2003 00:00:12 -0000	1.42
+++ Makefile	20 May 2003 13:10:05 -0000	1.43
@@ -66,4 +66,4 @@
 obj-$(CONFIG_MTD_ARCTIC)	+= arctic-mtd.o
 obj-$(CONFIG_MTD_H720X)		+= h720x-flash.o
 
-include $(TOPDIR)/Rules.make
+-include $(TOPDIR)/Rules.make


From dwmw2 at infradead.org  Tue May 20 09:10:08 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:20 2006
Subject: mtd/drivers/mtd/nand Makefile,1.10,1.11
Message-ID: <E19I6sa-0003oA-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv14593/nand

Modified Files:
	Makefile 
Log Message:
don't die if no Rules.make

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/Makefile,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Makefile	1 Dec 2002 13:23:05 -0000	1.10
+++ Makefile	20 May 2003 13:10:05 -0000	1.11
@@ -20,4 +20,4 @@
 obj-$(CONFIG_MTD_NAND_EDB7312)  += edb7312.o
 obj-$(CONFIG_MTD_NAND_IDS)	+= nand_ids.o
 
-include $(TOPDIR)/Rules.make
+-include $(TOPDIR)/Rules.make


From dwmw2 at infradead.org  Tue May 20 09:10:06 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:20 2006
Subject: mtd/drivers/mtd Makefile,1.71,1.72
Message-ID: <E19I6sY-0003nu-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv14593

Modified Files:
	Makefile 
Log Message:
don't die if no Rules.make

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/Makefile,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- Makefile	18 May 2003 19:11:20 -0000	1.71
+++ Makefile	20 May 2003 13:10:03 -0000	1.72
@@ -66,7 +66,7 @@
 mtd_blkdevs	+= mtd_blkdevs.o
 endif
 
-include $(TOPDIR)/Rules.make
+-include $(TOPDIR)/Rules.make
 
 # below 2.5 only
 ifeq ($(BELOW25),y)


From dwmw2 at infradead.org  Tue May 20 09:10:07 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:20 2006
Subject: mtd/drivers/mtd/devices Makefile,1.6,1.7
Message-ID: <E19I6sZ-0003o3-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/devices
In directory phoenix.infradead.org:/tmp/cvs-serv14593/devices

Modified Files:
	Makefile 
Log Message:
don't die if no Rules.make

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/Makefile,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Makefile	27 Nov 2002 10:28:14 -0000	1.6
+++ Makefile	20 May 2003 13:10:04 -0000	1.7
@@ -27,4 +27,4 @@
 obj-$(CONFIG_MTD_LART)		+= lart.o
 obj-$(CONFIG_MTD_BLKMTD)	+= blkmtd.o
 
-include $(TOPDIR)/Rules.make
+-include $(TOPDIR)/Rules.make


From dwmw2 at infradead.org  Tue May 20 09:10:07 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:20 2006
Subject: mtd/drivers/mtd/chips Makefile,1.10,1.11
Message-ID: <E19I6sZ-0003o5-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv14593/chips

Modified Files:
	Makefile 
Log Message:
don't die if no Rules.make

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/Makefile,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Makefile	13 Feb 2003 21:07:31 -0000	1.10
+++ Makefile	20 May 2003 13:10:04 -0000	1.11
@@ -32,4 +32,4 @@
 obj-$(CONFIG_MTD_SHARP)		+= sharp.o
 obj-$(CONFIG_MTD_ABSENT)	+= map_absent.o
 
-include $(TOPDIR)/Rules.make
+-include $(TOPDIR)/Rules.make


From dwmw2 at infradead.org  Tue May 20 09:43:00 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:20 2006
Subject: mtd/include/linux/mtd blktrans.h,1.1,1.2
Message-ID: <E19I7OO-00040X-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv15386

Modified Files:
	blktrans.h 
Log Message:
include cleanups, readonly

Index: blktrans.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/blktrans.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- blktrans.h	18 May 2003 13:10:21 -0000	1.1
+++ blktrans.h	20 May 2003 13:42:57 -0000	1.2
@@ -10,9 +10,12 @@
 #ifndef __MTD_TRANS_H__
 #define __MTD_TRANS_H__
 
+#include <asm/semaphore.h>
+
 struct mtd_info;
-struct semaphore;
 struct mtd_blktrans_ops;
+struct file;
+struct inode;
 
 struct mtd_blktrans_dev {
 	struct mtd_blktrans_ops *tr;
@@ -23,7 +26,7 @@
 	int devnum;
 	int blksize;
 	unsigned long size;
-	/* readonly? */
+	int readonly;
 };
 
 struct blkcore_priv; /* Differs for 2.4 and 2.5 kernels; private */
@@ -38,6 +41,9 @@
 		    unsigned long block, char *buffer);
 	int (*writesect)(struct mtd_blktrans_dev *dev,
 		     unsigned long block, char *buffer);
+
+	/* HDIO_GETGEO and HDIO_GETGEO_BIG are the only non-private
+	   ioctls which are expected to be passed through */
 	int (*ioctl)(struct mtd_blktrans_dev *dev,
 		     struct inode * inode, struct file * file, 
 		     unsigned int cmd, unsigned long arg);


From dwmw2 at infradead.org  Tue May 20 10:30:50 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:20 2006
Subject: mtd/drivers/mtd mtd_blkdevs.c,1.7,1.8
Message-ID: <E19I88g-00052M-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv19341

Modified Files:
	mtd_blkdevs.c 
Log Message:
Wheee. Builds for 2.5. Probably doesn't work but testing is boring.


Index: mtd_blkdevs.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- mtd_blkdevs.c	18 May 2003 19:09:02 -0000	1.7
+++ mtd_blkdevs.c	20 May 2003 14:30:47 -0000	1.8
@@ -3,7 +3,7 @@
  *
  * (C) 2003 David Woodhouse <dwmw2@infradead.org>
  *
- * Interface to Linux 2.4 block layer for MTD 'translation layers'.
+ * Interface to Linux 2.5 block layer for MTD 'translation layers'.
  *
  */
 
@@ -19,20 +19,15 @@
 #include <linux/blkpg.h>
 #include <linux/spinlock.h>
 #include <asm/semaphore.h>
+#include <linux/devfs_fs_kernel.h>
 
 static LIST_HEAD(blktrans_majors);
 
 extern struct semaphore mtd_table_mutex;
 extern struct mtd_info *mtd_table[];
 
-struct mtd_blkcore_priv {
-	devfs_handle_t devfs_handle;
-	int blksizes[256];
-	int sizes[256];
-	struct hd_struct part_table[256];
-	struct gendisk gd;
-	spinlock_t devs_lock; /* See comment in _request function */
-};
+static struct request_queue mtd_blktrans_queue;
+static spinlock_t mtd_blktrans_queue_lock;
 
 static inline struct mtd_blktrans_dev *tr_get_dev(struct mtd_blktrans_ops *tr,
 					   int devnum)
@@ -69,20 +64,18 @@
 {
 	unsigned long block, nsect;
 	char *buf;
-	int minor;
 
-	minor = MINOR(req->rq_dev);
 	block = req->sector;
 	nsect = req->current_nr_sectors;
 	buf = req->buffer;
 
-	if (block + nsect > tr->blkcore_priv->part_table[minor].nr_sects) {
-		printk(KERN_WARNING "Access beyond end of device.\n");
+	if (!req->flags & REQ_CMD)
+		return 0;
+
+	if (block + nsect > get_capacity(req->rq_disk))
 		return 0;
-	}
-	block += tr->blkcore_priv->part_table[minor].start_sect;
 
-	switch(req->cmd) {
+	switch(rq_data_dir(req)) {
 	case READ:
 		for (; nsect > 0; nsect--, block++, buf += 512)
 			if (tr->readsect(dev, block, buf))
@@ -99,7 +92,7 @@
 		return 1;
 
 	default:
-		printk(KERN_NOTICE "Unknown request cmd %d\n", req->cmd);
+		printk(KERN_NOTICE "Unknown request %ld\n", rq_data_dir(req));
 		return 0;
 	}
 }
@@ -107,55 +100,24 @@
 static void mtd_blktrans_request(request_queue_t *rq)
 {
 	struct request *req;
-	struct mtd_blktrans_ops *tr = rq->queuedata;
-	struct mtd_blktrans_dev *dev;
-
-	BUG_ON(!tr);
 
-	for (;;) {
-		int devnum;
+	while ((req = elv_next_request(rq))) {
+		struct mtd_blktrans_ops *tr;
+		struct mtd_blktrans_dev *dev;
 		int res = 0;
 
-		if (list_empty(&rq->queue_head))
-			return;
-
-		req = blkdev_entry_next_request(&rq->queue_head);
+		dev = req->rq_disk->private_data;
+		tr = dev->tr;
 
-		devnum = MINOR(req->rq_dev) >> tr->part_bits;
+		spin_unlock_irq(rq->queue_lock);
 
-		/* The ll_rw_blk code knows not to touch the request
-		   at the head of the queue */
-		spin_unlock_irq(&io_request_lock);
-
-		/* FIXME: Where can we store the dev, on which
-		   we already have a refcount anyway? We need to
-		   lock against concurrent addition/removal of devices,
-		   but if we use the mtd_table_mutex we deadlock when
-		   grok_partitions is called from the registration
-		   callbacks. */
-		spin_lock(&tr->blkcore_priv->devs_lock);
-		dev = tr_get_dev(tr, devnum);
-		spin_unlock(&tr->blkcore_priv->devs_lock);
-
-		if (!dev) {
-			/* We'd BUG() but it's rude to do so when we know
-			   we'd leave the io_request_lock locked */
-			printk(KERN_CRIT "mtd_blktrans request for unknown %s device #%d\n", 
-			       tr->name, devnum);
-			goto relock;
-			
-		}
-		/* Ensure serialisation of requests */
 		down(&dev->sem);
 		res = do_blktrans_request(tr, dev, req);
 		up(&dev->sem);
-	relock:
-		spin_lock_irq(&io_request_lock);
 
-		if (!end_that_request_first(req, res, tr->name)) {
-			blkdev_dequeue_request(req);
-			end_that_request_last(req);
-		}
+		spin_lock_irq(rq->queue_lock);
+
+		end_request(req, res);
 	}
 }
 
@@ -163,13 +125,16 @@
 {
 	struct mtd_blktrans_ops *tr = NULL;
 	struct mtd_blktrans_dev *dev = NULL;
-	int major_nr = MAJOR(i->i_rdev);
-	int minor_nr = MINOR(i->i_rdev);
+	int major_nr = major(i->i_rdev);
+	int minor_nr = minor(i->i_rdev);
 	int devnum;
 	int ret = -ENODEV;
 
+#if 0 /* Do we still have to do this in 2.5? Hopefully not since I don't
+	 see how */
 	if (is_read_only(i->i_rdev) && (f->f_mode & FMODE_WRITE))
 		return -EROFS;
+#endif
 
 	down(&mtd_table_mutex);
 
@@ -185,11 +150,12 @@
 	if (!dev)
 		goto out;
 
+#if 0
 	if (!tr->blkcore_priv->part_table[minor_nr].nr_sects) {
 		ret = -ENODEV;
 		goto out;
 	}
-
+#endif
 	if (!try_module_get(dev->mtd->owner))
 		goto out;
 
@@ -223,13 +189,13 @@
 
 	down(&mtd_table_mutex);
 
-	tr = get_tr(MAJOR(i->i_rdev));
+	tr = get_tr(major(i->i_rdev));
 	if (!tr) {
 		up(&mtd_table_mutex);
 		return -ENODEV;
 	}
 
-	devnum = MINOR(i->i_rdev) >> tr->part_bits;
+	devnum = minor(i->i_rdev) >> tr->part_bits;
 	dev = tr_get_dev(tr, devnum);
 
 	if (!dev) {
@@ -253,43 +219,6 @@
 	return ret;
 }
 
-static int mtd_blktrans_rrpart(kdev_t rdev, struct mtd_blktrans_ops *tr,
-			       struct mtd_blktrans_dev *dev)
-{
-	struct gendisk *gd = &(tr->blkcore_priv->gd);
-	int i;
-	int minor = MINOR(rdev);
-
-	if (minor & ((1<<tr->part_bits)-1) || !tr->part_bits) {
-		/* BLKRRPART on a partition. Go away. */
-		return -ENOTTY;
-	}
-
-	if (!capable(CAP_SYS_ADMIN))
-	    return -EACCES;
-
-	/* We are required to prevent simultaneous open() ourselves.
-	   The core doesn't do that for us. Did I ever mention how
-	   much the Linux block layer sucks? Sledgehammer approach... */
-	down(&mtd_table_mutex);
-
-	if (dev->usecount > 1) {
-		up(&mtd_table_mutex);
-		return -EBUSY;
-	}
-
-	for (i=0; i < (1<<tr->part_bits); i++) {
-		invalidate_device(MKDEV(tr->major, minor+i), 1);
-		gd->part[minor + i].start_sect = 0;
-		gd->part[minor + i].nr_sects = 0;
-	}
-
-	grok_partitions(gd, minor, 1 << tr->part_bits, 
-			tr->blkcore_priv->sizes[minor]);
-	up(&mtd_table_mutex);
-
-	return 0;
-}
 
 static int blktrans_ioctl(struct inode *inode, struct file *file, 
 			      unsigned int cmd, unsigned long arg)
@@ -297,31 +226,17 @@
 	struct mtd_blktrans_dev *dev;
 	struct mtd_blktrans_ops *tr;
 	int devnum;
-
-	switch(cmd) {
-	case BLKGETSIZE:
-        case BLKGETSIZE64:
-        case BLKBSZSET:
-        case BLKBSZGET:
-        case BLKROSET:
-        case BLKROGET:
-        case BLKRASET:
-        case BLKRAGET:
-        case BLKPG:
-        case BLKELVGET:
-        case BLKELVSET:
-		return blk_ioctl(inode->i_rdev, cmd, arg);
-	}
+	int ret = -ENOTTY;
 
 	down(&mtd_table_mutex);
 
-	tr = get_tr(MAJOR(inode->i_rdev));
+	tr = get_tr(major(inode->i_rdev));
 	if (!tr) {
 		up(&mtd_table_mutex);
 		return -ENODEV;
 	}
 
-	devnum = MINOR(inode->i_rdev) >> tr->part_bits;
+	devnum = minor(inode->i_rdev) >> tr->part_bits;
 	dev = tr_get_dev(tr, devnum);
 
 	up(&mtd_table_mutex);
@@ -329,20 +244,14 @@
 	if (!dev)
 		return -ENODEV;
 
-	switch(cmd) {
-	case BLKRRPART:
-		return mtd_blktrans_rrpart(inode->i_rdev, tr, dev);
-		
-        case BLKFLSBUF:
-		blk_ioctl(inode->i_rdev, cmd, arg);
-		if (!tr->ioctl)
-			return 0;
+	if (tr->ioctl)
+		ret = tr->ioctl(dev, inode, file, cmd, arg);
 
-	default:
-		if (!tr->ioctl)
-			return -ENOTTY;
-		return tr->ioctl(dev, inode, file, cmd, arg);
+	if (ret == -ENOTTY && (cmd == BLKROSET || cmd == BLKFLSBUF)) {
+		/* The core code did the work, we had nothing to do. */
+		ret = 0;
 	}
+	return ret;
 }
 
 struct block_device_operations mtd_blktrans_ops = {
@@ -357,15 +266,13 @@
 	struct mtd_blktrans_ops *tr = new->tr;
 	struct list_head *this;
 	int last_devnum = -1;
-	int i;
+	struct gendisk *gd;
 
 	if (!down_trylock(&mtd_table_mutex)) {
 		up(&mtd_table_mutex);
 		BUG();
 	}
 
-	spin_lock(&tr->blkcore_priv->devs_lock);
-
 	list_for_each(this, &tr->devs) {
 		struct mtd_blktrans_dev *d = list_entry(this, struct mtd_blktrans_dev, list);
 		if (new->devnum == -1) {
@@ -378,7 +285,6 @@
 			}
 		} else if (d->devnum == new->devnum) {
 			/* Required number taken */
-			spin_unlock(&tr->blkcore_priv->devs_lock);
 			return -EBUSY;
 		} else if (d->devnum > new->devnum) {
 			/* Required number was free */
@@ -391,45 +297,46 @@
 		new->devnum = last_devnum+1;
 
 	if ((new->devnum << tr->part_bits) > 256) {
-		spin_unlock(&tr->blkcore_priv->devs_lock);
 		return -EBUSY;
 	}
 
 	init_MUTEX(&new->sem);
 	list_add_tail(&new->list, &tr->devs);
  added:
-	spin_unlock(&tr->blkcore_priv->devs_lock);
 	new->usecount = 0;
 
 	if (!tr->writesect)
 		new->readonly = 1;
 
-	for (i = new->devnum << tr->part_bits;
-	     i < (new->devnum+1) << tr->part_bits; 
-	     i++) {
-		set_device_ro(MKDEV(tr->major, i), new->readonly);
-		tr->blkcore_priv->blksizes[i] = new->blksize;
-		tr->blkcore_priv->sizes[i] = 0;
-		tr->blkcore_priv->part_table[i].nr_sects = 0;
-		tr->blkcore_priv->part_table[i].start_sect = 0;
-	}
-
-	tr->blkcore_priv->sizes[new->devnum << tr->part_bits] = new->size;
-	tr->blkcore_priv->part_table[new->devnum << tr->part_bits].nr_sects = new->size;
-	tr->blkcore_priv->gd.nr_real++;
-
-	if (tr->part_bits) {
-		grok_partitions(&tr->blkcore_priv->gd, new->devnum,
-				1 << tr->part_bits, new->size);
+	gd = alloc_disk(1 << tr->part_bits);
+	if (!gd) {
+		list_del(&new->list);
+		return -ENOMEM;
 	}
+	gd->major = tr->major;
+	gd->first_minor = (new->devnum) << tr->part_bits;
+	gd->fops = &mtd_blktrans_ops;
+	
+	snprintf(gd->disk_name, sizeof(gd->disk_name),
+		 "%s%c", tr->name, (tr->part_bits?'a':'0') + new->devnum);
+	snprintf(gd->devfs_name, sizeof(gd->devfs_name),
+		 "%s/%c", tr->name, (tr->part_bits?'a':'0') + new->devnum);
+
+	set_capacity(gd, new->size);
+	gd->private_data = new;
+	new->blkcore_priv = gd;
+	gd->queue = &mtd_blktrans_queue;
+
+	if (new->readonly)
+		set_disk_ro(gd, 1);
+
+	add_disk(gd);
+	
 	return 0;
 }
 
 int del_mtd_blktrans_dev(struct mtd_blktrans_dev *old)
 {
-	struct mtd_blktrans_ops *tr = old->tr;
-	int i;
-
 	if (!down_trylock(&mtd_table_mutex)) {
 		up(&mtd_table_mutex);
 		BUG();
@@ -438,17 +345,10 @@
 	if (old->usecount)
 		return -EBUSY;
 
-	spin_lock(&tr->blkcore_priv->devs_lock);
 	list_del(&old->list);
-	spin_unlock(&tr->blkcore_priv->devs_lock);
 
-	for (i = (old->devnum << tr->part_bits); 
-	     i < ((old->devnum+1) << tr->part_bits); i++) {
-		tr->blkcore_priv->sizes[i] = 0;
-		tr->blkcore_priv->part_table[i].nr_sects = 0;
-		tr->blkcore_priv->part_table[i].start_sect = 0;
-	}
-	tr->blkcore_priv->gd.nr_real--;
+	del_gendisk(old->blkcore_priv);
+	put_disk(old->blkcore_priv);
 		
 	return 0;
 }
@@ -496,40 +396,19 @@
 	if (!blktrans_notifier.list.next)
 		register_mtd_user(&blktrans_notifier);
 
-	tr->blkcore_priv = kmalloc(sizeof(*tr->blkcore_priv), GFP_KERNEL);
-	if (!tr->blkcore_priv)
-		return -ENOMEM;
-
-	memset(tr->blkcore_priv, 0, sizeof(*tr->blkcore_priv));
-
 	down(&mtd_table_mutex);
 
-	ret = devfs_register_blkdev(tr->major, tr->name, &mtd_blktrans_ops);
+	ret = register_blkdev(tr->major, tr->name);
 	if (ret) {
 		printk(KERN_WARNING "Unable to register %s block device on major %d: %d\n",
 		       tr->name, tr->major, ret);
-		kfree(tr->blkcore_priv);
 		up(&mtd_table_mutex);
 		return ret;
 	}
+	blk_init_queue(&mtd_blktrans_queue, mtd_blktrans_request, 
+		       &mtd_blktrans_queue_lock);
 
-	tr->blkcore_priv->devfs_handle = devfs_mk_dir(NULL, tr->name, NULL);
-	blk_init_queue(BLK_DEFAULT_QUEUE(tr->major), &mtd_blktrans_request);
-	(BLK_DEFAULT_QUEUE(tr->major))->queuedata = tr;
-	
-	blksize_size[tr->major] = tr->blkcore_priv->blksizes;
-	blk_size[tr->major] = tr->blkcore_priv->sizes;
-
-	tr->blkcore_priv->gd.major = tr->major;
-	tr->blkcore_priv->gd.major_name = tr->name;
-	tr->blkcore_priv->gd.minor_shift = tr->part_bits;
-	tr->blkcore_priv->gd.max_p = (1<<tr->part_bits) - 1;
-	tr->blkcore_priv->gd.part = tr->blkcore_priv->part_table;
-	tr->blkcore_priv->gd.sizes = tr->blkcore_priv->sizes;
-
-	spin_lock_init(&tr->blkcore_priv->devs_lock);
-
-	add_gendisk(&tr->blkcore_priv->gd);
+	devfs_mk_dir(tr->name);
 
 	tr->usecount = 0;
 	INIT_LIST_HEAD(&tr->devs);
@@ -539,6 +418,7 @@
 		if (mtd_table[i])
 			tr->add_mtd(tr, mtd_table[i]);
 	}
+
 	up(&mtd_table_mutex);
 	return 0;
 }
@@ -546,6 +426,7 @@
 int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr)
 {
 	struct list_head *this, *next;
+
 	down(&mtd_table_mutex);
 	if (tr->usecount) {
 		up(&mtd_table_mutex);
@@ -557,16 +438,12 @@
 		struct mtd_blktrans_dev *dev = list_entry(this, struct mtd_blktrans_dev, list);
 		tr->remove_dev(dev);
 	}
-	devfs_unregister(tr->blkcore_priv->devfs_handle);
-	devfs_unregister_blkdev(tr->major, tr->name);
-	blk_cleanup_queue(BLK_DEFAULT_QUEUE(tr->major));
-	blksize_size[tr->major] = NULL;
-	blk_size[tr->major] = NULL;
-	del_gendisk(&tr->blkcore_priv->gd);
 
-	up(&mtd_table_mutex);
+	devfs_remove(tr->name);
+	blk_cleanup_queue(&mtd_blktrans_queue);
+	unregister_blkdev(tr->major, tr->name);
 
-	kfree(tr->blkcore_priv);
+	up(&mtd_table_mutex);
 
 	if (!list_empty(&tr->devs))
 		BUG();


From dwmw2 at infradead.org  Tue May 20 10:36:24 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:20 2006
Subject: mtd/drivers/mtd mtd_blkdevs.c,1.8,1.9
Message-ID: <E19I8E4-00054L-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv19466

Modified Files:
	mtd_blkdevs.c 
Log Message:
comment the second #if 0

Index: mtd_blkdevs.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- mtd_blkdevs.c	20 May 2003 14:30:47 -0000	1.8
+++ mtd_blkdevs.c	20 May 2003 14:36:21 -0000	1.9
@@ -150,7 +150,7 @@
 	if (!dev)
 		goto out;
 
-#if 0
+#if 0 /* Does it prevent us from opening a partition which doesn't exist */
 	if (!tr->blkcore_priv->part_table[minor_nr].nr_sects) {
 		ret = -ENODEV;
 		goto out;


From dwmw2 at infradead.org  Tue May 20 11:36:31 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:20 2006
Subject: mtd/include/linux/mtd nftl.h,1.11,1.12
Message-ID: <E19I9AF-0005xJ-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv22869

Modified Files:
	nftl.h 
Log Message:
Missed parts of conversion to blktrans


Index: nftl.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/nftl.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- nftl.h	18 Jun 2002 13:54:24 -0000	1.11
+++ nftl.h	20 May 2003 15:36:29 -0000	1.12
@@ -1,15 +1,14 @@
-
-/* Defines for NAND Flash Translation Layer  */
-/* (c) 1999 Machine Vision Holdings, Inc.    */
-/* Author: David Woodhouse <dwmw2@mvhi.com>  */
-/* $Id$ */
+/*
+ * $Id$
+ *
+ * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org>
+ */
 
 #ifndef __MTD_NFTL_H__
 #define __MTD_NFTL_H__
 
-#ifndef __BOOT__
 #include <linux/mtd/mtd.h>
-#endif
+#include <linux/mtd/blktrans.h>
 
 /* Block Control Information */
 
@@ -84,8 +83,7 @@
 #define BLOCK_RESERVED     0xfffc /* bios block or bad block */
 
 struct NFTLrecord {
-	struct mtd_info *mtd;
-	struct semaphore mutex;
+	struct mtd_blktrans_dev mbd;
 	__u16 MediaUnit, SpareMediaUnit;
 	__u32 EraseSize;
 	struct NFTLMediaHeader MediaHdr;


From dwmw2 at infradead.org  Tue May 20 11:37:08 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:20 2006
Subject: mtd/include/linux/mtd mtd.h,1.43,1.44
Message-ID: <E19I9Aq-0005yt-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv22967

Modified Files:
	mtd.h 
Log Message:
fix get_mtd_device

Index: mtd.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/mtd.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- mtd.h	14 May 2003 22:26:26 -0000	1.43
+++ mtd.h	20 May 2003 15:37:05 -0000	1.44
@@ -236,11 +236,7 @@
 extern int add_mtd_device(struct mtd_info *mtd);
 extern int del_mtd_device (struct mtd_info *mtd);
 
-#define get_mtd_device(mtd, num) ___get_mtd_device(mtd, num, 1)
-#undef __get_mtd_device
-#define __get_mtd_device(mtd, num) ___get_mtd_device(mtd, num, 0)
-
-extern struct mtd_info *___get_mtd_device(struct mtd_info *mtd, int num, int count);
+extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num);
 
 extern void put_mtd_device(struct mtd_info *mtd);
 


From dwmw2 at infradead.org  Tue May 20 11:37:44 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:20 2006
Subject: mtd/drivers/mtd mtdcore.c,1.36,1.37
Message-ID: <E19I9BQ-0005zz-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv23040

Modified Files:
	mtdcore.c 
Log Message:
Remove __get_mtd_device

Index: mtdcore.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdcore.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- mtdcore.c	15 May 2003 17:00:07 -0000	1.36
+++ mtdcore.c	20 May 2003 15:37:41 -0000	1.37
@@ -24,8 +24,14 @@
 
 #include <linux/mtd/mtd.h>
 
-static DECLARE_MUTEX(mtd_table_mutex);
-static struct mtd_info *mtd_table[MAX_MTD_DEVICES];
+/* These are exported solely for the purpose of mtd_blkdevs.c. You 
+   should not use them for _anything_ else */
+DECLARE_MUTEX(mtd_table_mutex);
+struct mtd_info *mtd_table[MAX_MTD_DEVICES];
+
+EXPORT_SYMBOL_GPL(mtd_table_mutex);
+EXPORT_SYMBOL_GPL(mtd_table);
+
 static LIST_HEAD(mtd_notifiers);
 
 /**
@@ -170,7 +176,7 @@
 
 
 /**
- *	___get_mtd_device - obtain a validated handle for an MTD device
+ *	get_mtd_device - obtain a validated handle for an MTD device
  *	@mtd: last known address of the required MTD device
  *	@num: internal device number of the required MTD device
  *
@@ -178,11 +184,10 @@
  *	table, if any.	Given an address and num == -1, search the device table
  *	for a device with that address and return if it's still present. Given
  *	both, return the num'th driver only if its address matches. Return NULL
- *	if not. get_mtd_device() increases the use count, but
- *	__get_mtd_device() doesn't - you should generally use get_mtd_device().
+ *	if not.
  */
 	
-struct mtd_info *___get_mtd_device(struct mtd_info *mtd, int num, int count)
+struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num)
 {
 	struct mtd_info *ret = NULL;
 	int i;
@@ -198,13 +203,13 @@
 		if (mtd && mtd != ret)
 			ret = NULL;
 	}
-	if (count) {
-		if (ret && !try_module_get(ret->owner))
-			ret = NULL;
-	
-		if (ret)
-			ret->usecount++;
-	}
+
+	if (ret && !try_module_get(ret->owner))
+		ret = NULL;
+
+	if (ret)
+		ret->usecount++;
+
 	up(&mtd_table_mutex);
 	return ret;
 }
@@ -283,7 +288,7 @@
 
 EXPORT_SYMBOL(add_mtd_device);
 EXPORT_SYMBOL(del_mtd_device);
-EXPORT_SYMBOL(___get_mtd_device);
+EXPORT_SYMBOL(get_mtd_device);
 EXPORT_SYMBOL(put_mtd_device);
 EXPORT_SYMBOL(register_mtd_user);
 EXPORT_SYMBOL(unregister_mtd_user);


From dwmw2 at infradead.org  Tue May 20 13:17:29 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:20 2006
Subject: mtd/drivers/mtd mtd_blkdevs-24.c,1.1,1.2
Message-ID: <E19IAjx-0007dH-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv29320

Modified Files:
	mtd_blkdevs-24.c 
Log Message:
Add kernel thread again.


Index: mtd_blkdevs-24.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs-24.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mtd_blkdevs-24.c	18 May 2003 19:10:12 -0000	1.1
+++ mtd_blkdevs-24.c	20 May 2003 17:17:26 -0000	1.2
@@ -26,12 +26,15 @@
 extern struct mtd_info *mtd_table[];
 
 struct mtd_blkcore_priv {
-	devfs_handle_t devfs_handle;
+	devfs_handle_t devfs_dir_handle;
 	int blksizes[256];
 	int sizes[256];
 	struct hd_struct part_table[256];
 	struct gendisk gd;
 	spinlock_t devs_lock; /* See comment in _request function */
+	struct completion thread_dead;
+	int exiting;
+	wait_queue_head_t thread_wq;
 };
 
 static inline struct mtd_blktrans_dev *tr_get_dev(struct mtd_blktrans_ops *tr,
@@ -104,20 +107,50 @@
 	}
 }
 
-static void mtd_blktrans_request(request_queue_t *rq)
+static int mtd_blktrans_thread(void *arg)
 {
-	struct request *req;
-	struct mtd_blktrans_ops *tr = rq->queuedata;
-	struct mtd_blktrans_dev *dev;
+	struct mtd_blktrans_ops *tr = arg;
+	request_queue_t *rq = (BLK_DEFAULT_QUEUE(tr->major));
 
 	BUG_ON(!tr);
 
-	for (;;) {
+	/* we might get involved when memory gets low, so use PF_MEMALLOC */
+	current->flags |= PF_MEMALLOC;
+
+	snprintf(current->comm, sizeof(current->comm), "%sd", tr->name);
+
+	/* daemonize() doesn't do this for us since some kernel threads
+	   actually want to deal with signals. We can't just call 
+	   exit_sighand() since that'll cause an oops when we finally
+	   do exit. */
+	spin_lock_irq(&current->sighand->siglock);
+	sigfillset(&current->blocked);
+	recalc_sigpending();
+	spin_unlock_irq(&current->sighand->siglock);
+
+	daemonize();
+
+	while (!tr->blkcore_priv->exiting) {
+		struct request *req;
+		struct mtd_blktrans_dev *dev;
 		int devnum;
 		int res = 0;
+		DECLARE_WAITQUEUE(wait, current);
+
+		spin_lock_irq(&io_request_lock);
+
+		if (list_empty(&rq->queue_head)) {
+
+			add_wait_queue(&tr->blkcore_priv->thread_wq, &wait);
+			set_current_state(TASK_INTERRUPTIBLE);
+
+			spin_unlock_irq(&io_request_lock);
 
-		if (list_empty(&rq->queue_head))
-			return;
+			schedule();
+			remove_wait_queue(&tr->blkcore_priv->thread_wq, &wait);
+
+			continue;
+		}
 
 		req = blkdev_entry_next_request(&rq->queue_head);
 
@@ -137,26 +170,28 @@
 		dev = tr_get_dev(tr, devnum);
 		spin_unlock(&tr->blkcore_priv->devs_lock);
 
-		if (!dev) {
-			/* We'd BUG() but it's rude to do so when we know
-			   we'd leave the io_request_lock locked */
-			printk(KERN_CRIT "mtd_blktrans request for unknown %s device #%d\n", 
-			       tr->name, devnum);
-			goto relock;
-			
-		}
+		BUG_ON(!dev);
+
 		/* Ensure serialisation of requests */
 		down(&dev->sem);
+
 		res = do_blktrans_request(tr, dev, req);
 		up(&dev->sem);
-	relock:
-		spin_lock_irq(&io_request_lock);
 
 		if (!end_that_request_first(req, res, tr->name)) {
+			spin_lock_irq(&io_request_lock);
 			blkdev_dequeue_request(req);
 			end_that_request_last(req);
+			spin_unlock_irq(&io_request_lock);
 		}
 	}
+	complete_and_exit(&tr->blkcore_priv->thread_dead, 0);
+}
+
+static void mtd_blktrans_request(struct request_queue *rq)
+{
+	struct mtd_blktrans_ops *tr = rq->queuedata;
+	wake_up(&tr->blkcore_priv->thread_wq);
 }
 
 int blktrans_open(struct inode *i, struct file *f)
@@ -190,10 +225,10 @@
 		goto out;
 	}
 
-	if (!try_module_get(dev->mtd->owner))
+	if (!try_inc_mod_count(dev->mtd->owner))
 		goto out;
 
-	if (!try_module_get(tr->owner))
+	if (!try_inc_mod_count(tr->owner))
 		goto out_tr;
 
 	dev->mtd->usecount++;
@@ -205,12 +240,13 @@
 		tr->usecount--;
 		dev->usecount--;
 		dev->mtd->usecount--;
-		module_put(dev->mtd->owner);
+		__MOD_DEC_USE_COUNT(dev->mtd->owner);
 	out_tr:
-		module_put(tr->owner);
+		__MOD_DEC_USE_COUNT(tr->owner);
 	}
  out:
 	up(&mtd_table_mutex);
+
 	return ret;
 }
 
@@ -244,8 +280,8 @@
 		tr->usecount--;
 		dev->usecount--;
 		dev->mtd->usecount--;
-		module_put(dev->mtd->owner);
-		module_put(tr->owner);
+		__MOD_DEC_USE_COUNT(dev->mtd->owner);
+		__MOD_DEC_USE_COUNT(tr->owner);
 	}
 	
 	up(&mtd_table_mutex);
@@ -422,6 +458,20 @@
 		grok_partitions(&tr->blkcore_priv->gd, new->devnum,
 				1 << tr->part_bits, new->size);
 	}
+#ifdef CONFIG_DEVFS_FS 
+	{
+		char name[2];
+
+		name[0] = (tr->part_bits?'a':'0')+new->devnum;
+		name[1] = 0;
+
+		new->blkcore_priv = 
+			devfs_register(tr->blkcore_priv->devfs_dir_handle,
+				       name, DEVFS_FL_DEFAULT, tr->major,
+				       new->devnum, S_IFBLK|S_IRUGO|S_IWUGO,
+				       &mtd_blktrans_ops, NULL);
+	}
+#endif
 	return 0;
 }
 
@@ -437,7 +487,9 @@
 
 	if (old->usecount)
 		return -EBUSY;
-
+#ifdef CONFIG_DEVFS_FS
+	devfs_unregister(old->blkcore_priv);
+#endif
 	spin_lock(&tr->blkcore_priv->devs_lock);
 	list_del(&old->list);
 	spin_unlock(&tr->blkcore_priv->devs_lock);
@@ -461,7 +513,7 @@
 		struct mtd_blktrans_ops *tr = list_entry(this, struct mtd_blktrans_ops, list);
 
 		list_for_each_safe(this2, next, &tr->devs) {
-			struct mtd_blktrans_dev *dev = list_entry(this, struct mtd_blktrans_dev, list);
+			struct mtd_blktrans_dev *dev = list_entry(this2, struct mtd_blktrans_dev, list);
 
 			if (dev->mtd == mtd)
 				tr->remove_dev(dev);
@@ -513,10 +565,22 @@
 		return ret;
 	}
 
-	tr->blkcore_priv->devfs_handle = devfs_mk_dir(NULL, tr->name, NULL);
 	blk_init_queue(BLK_DEFAULT_QUEUE(tr->major), &mtd_blktrans_request);
 	(BLK_DEFAULT_QUEUE(tr->major))->queuedata = tr;
 	
+	init_completion(&tr->blkcore_priv->thread_dead);
+	init_waitqueue_head(&tr->blkcore_priv->thread_wq);
+
+	ret = kernel_thread(mtd_blktrans_thread, tr, 
+			  CLONE_FS|CLONE_FILES|CLONE_SIGHAND);
+	if (ret < 0) {
+		blk_cleanup_queue(BLK_DEFAULT_QUEUE(tr->major));
+		devfs_unregister_blkdev(tr->major, tr->name);
+		return ret;
+	} 
+
+	tr->blkcore_priv->devfs_dir_handle = devfs_mk_dir(NULL, tr->name, NULL);
+
 	blksize_size[tr->major] = tr->blkcore_priv->blksizes;
 	blk_size[tr->major] = tr->blkcore_priv->sizes;
 
@@ -540,29 +604,42 @@
 			tr->add_mtd(tr, mtd_table[i]);
 	}
 	up(&mtd_table_mutex);
+
 	return 0;
 }
 
 int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr)
 {
 	struct list_head *this, *next;
+
 	down(&mtd_table_mutex);
+
 	if (tr->usecount) {
 		up(&mtd_table_mutex);
 		return -EBUSY;
 	}
+
+	/* Clean up the kernel thread */
+	tr->blkcore_priv->exiting = 1;
+	wake_up(&tr->blkcore_priv->thread_wq);
+	wait_for_completion(&tr->blkcore_priv->thread_dead);
+	
+	/* Remove it from the list of active majors */
 	list_del(&tr->list);
 
+	/* Remove each of its devices */
 	list_for_each_safe(this, next, &tr->devs) {
 		struct mtd_blktrans_dev *dev = list_entry(this, struct mtd_blktrans_dev, list);
 		tr->remove_dev(dev);
 	}
-	devfs_unregister(tr->blkcore_priv->devfs_handle);
-	devfs_unregister_blkdev(tr->major, tr->name);
 	blk_cleanup_queue(BLK_DEFAULT_QUEUE(tr->major));
 	blksize_size[tr->major] = NULL;
 	blk_size[tr->major] = NULL;
+
 	del_gendisk(&tr->blkcore_priv->gd);
+
+	devfs_unregister_blkdev(tr->major, tr->name);
+	devfs_unregister(tr->blkcore_priv->devfs_dir_handle);
 
 	up(&mtd_table_mutex);
 


From dwmw2 at infradead.org  Tue May 20 16:39:16 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:21 2006
Subject: mtd/drivers/mtd mtdblock.c,1.58,1.59
Message-ID: <E19IDtE-0001r6-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv7109

Modified Files:
	mtdblock.c 
Log Message:
vmalloc.h

Index: mtdblock.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdblock.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- mtdblock.c	18 May 2003 19:59:28 -0000	1.58
+++ mtdblock.c	20 May 2003 20:39:12 -0000	1.59
@@ -12,6 +12,7 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
+#include <linux/vmalloc.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/blktrans.h>
 


From dwmw2 at infradead.org  Tue May 20 16:39:51 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:21 2006
Subject: mtd/drivers/mtd mtdblock.c,1.59,1.60
Message-ID: <E19IDtn-0001rj-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv7150

Modified Files:
	mtdblock.c 
Log Message:
kill bogus release_t

Index: mtdblock.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdblock.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- mtdblock.c	20 May 2003 20:39:12 -0000	1.59
+++ mtdblock.c	20 May 2003 20:39:48 -0000	1.60
@@ -291,7 +291,7 @@
 	return 0;
 }
 
-static release_t mtdblock_release(struct mtd_blktrans_dev *mbd,
+static int mtdblock_release(struct mtd_blktrans_dev *mbd,
 				  struct inode *inode, struct file *file)
 {
 	int dev;


From dwmw2 at infradead.org  Tue May 20 16:40:10 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:21 2006
Subject: mtd/drivers/mtd ftl.c,1.48,1.49
Message-ID: <E19IDu6-0001sO-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv7192

Modified Files:
	ftl.c 
Log Message:
uaccess.h

Index: ftl.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/ftl.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- ftl.c	18 May 2003 21:52:21 -0000	1.48
+++ ftl.c	20 May 2003 20:40:07 -0000	1.49
@@ -72,6 +72,7 @@
 #include <linux/hdreg.h>
 #include <linux/vmalloc.h>
 #include <linux/blkpg.h>
+#include <asm/uaccess.h>
 
 #include <linux/mtd/ftl.h>
 


From dwmw2 at infradead.org  Tue May 20 16:41:33 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:21 2006
Subject: mtd/drivers/mtd/maps GNUmakefile,1.10,1.11
Message-ID: <E19IDvR-0001v5-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv7352

Modified Files:
	GNUmakefile 
Log Message:
not the complex ones

Index: GNUmakefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/GNUmakefile,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- GNUmakefile	14 May 2003 15:05:14 -0000	1.10
+++ GNUmakefile	20 May 2003 20:41:30 -0000	1.11
@@ -7,21 +7,21 @@
 CONFIG_MTD_CFI_FLAGADM := m
 # CONFIG_MTD_CSTM_MIPS_IXX := m
 # CONFIG_MTD_DC21285 := m
-CONFIG_MTD_ELAN_104NC := m
+# CONFIG_MTD_ELAN_104NC := m
 CONFIG_MTD_IQ80310 := m
 CONFIG_MTD_L440GX := m
 CONFIG_MTD_NORA := m
-CONFIG_MTD_OCTAGON := m
+# CONFIG_MTD_OCTAGON := m
 CONFIG_MTD_PHYSMAP := m
 CONFIG_MTD_PNC2000 := m
 CONFIG_MTD_RPXLITE := m
 # CONFIG_MTD_SA1100 := m
-CONFIG_MTD_PCMCIA := m
-CONFIG_MTD_SBC_GXX := m
+# CONFIG_MTD_PCMCIA := m
+# CONFIG_MTD_SBC_GXX := m
 CONFIG_MTD_SC520CDP := m
 CONFIG_MTD_NETSC520 := m
 # CONFIG_MTD_SUN_UFLASH := m
-CONFIG_MTD_VMAX := m
+# CONFIG_MTD_VMAX := m
 CONFIG_MTD_DBOX2 := m
 
 CFLAGS_physmap.o := -DCONFIG_MTD_PHYSMAP_START=0x8000000 -DCONFIG_MTD_PHYSMAP_LEN=0x4000000 -DCONFIG_MTD_PHYSMAP_BUSWIDTH=2


From dwmw2 at infradead.org  Tue May 20 16:59:36 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:21 2006
Subject: mtd/drivers/mtd/maps amd76xrom.c,1.5,1.6 arctic-mtd.c,1.6,1.7
 autcpu12-nvram.c,1.3,1.4 beech-mtd.c,1.5,1.6 cdb89712.c,1.5,1.6
 ceiva.c,1.6,1.7 cfi_flagadm.c,1.9,1.10 cstm_mips_ixx.c,1.7,1.8
 dbox2-flash.c,1.7,1.8 dc21285.c,1.13,1.14 dilnetpc.c,1.10,1.11
 ebony.c,1.5,1.6 edb7312.c,1.6,1.7 elan-104nc.c,1.15,1.16
 epxa10db-flash.c,1.8,1.9 fortunet.c,1.4,1.5 h720x-flash.c,1.4,1.5
 ich2rom.c,1.5,1.6 impa7.c,1.6,1.7 integrator-flash.c,1.11,1.12
 iq80310.c,1.13,1.14 l440gx.c,1.10,1.11 lasat.c,1.3,1.4
 lubbock-flash.c,1.6,1.7 mbx860.c,1.3,1.4 netsc520.c,1.7,1.8
 nettel.c,1.3,1.4 nora.c,1.22,1.23 ocelot.c,1.10,1.11
 octagon-5066.c,1.22,1.23 pb1xxx-flash.c,1.6,1.7 pci.c,1.4,1.5
 pcmciamtd.c,1.42,1.43 physmap.c,1.25,1.26 pnc2000.c,1.12,1.13
 redwood.c,1.4,1.5 rpxlite.c,1.17,1.18 sa1100-flash.c,1.33,1.34
 sbc_gxx.c,1.23,1.24 sc520cdp.c,1.13,1.14 scb2_flash.c,1.4,1.5
 scx200_docflash.c,1.3,1.4 solutionengine.c,1.8,1.9
 sun_uflash.c,1.6,1.7 tqm8xxl.c,1.6,1.7 tsunami_flash.c,1.3,1.4
 uclinux.c,1.4,1.5 vmax301.c,1.26,1.27
Message-ID: <E19IECu-0002Tj-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv9525

Modified Files:
	amd76xrom.c arctic-mtd.c autcpu12-nvram.c beech-mtd.c 
	cdb89712.c ceiva.c cfi_flagadm.c cstm_mips_ixx.c dbox2-flash.c 
	dc21285.c dilnetpc.c ebony.c edb7312.c elan-104nc.c 
	epxa10db-flash.c fortunet.c h720x-flash.c ich2rom.c impa7.c 
	integrator-flash.c iq80310.c l440gx.c lasat.c lubbock-flash.c 
	mbx860.c netsc520.c nettel.c nora.c ocelot.c octagon-5066.c 
	pb1xxx-flash.c pci.c pcmciamtd.c physmap.c pnc2000.c redwood.c 
	rpxlite.c sa1100-flash.c sbc_gxx.c sc520cdp.c scb2_flash.c 
	scx200_docflash.c solutionengine.c sun_uflash.c tqm8xxl.c 
	tsunami_flash.c uclinux.c vmax301.c 
Log Message:
set owner explicitly. No set_module_owner

Index: amd76xrom.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/amd76xrom.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- amd76xrom.c	14 May 2003 22:26:29 -0000	1.5
+++ amd76xrom.c	20 May 2003 20:59:29 -0000	1.6
@@ -120,7 +120,7 @@
 	printk(KERN_NOTICE "amd76xrom chip at offset: 0x%x\n",
 		window->size - rom_size);
 		
-	set_module_owner(info->mtd);
+	info->mtd->owner = THIS_MODULE;
 	add_mtd_device(info->mtd);
 	info->window_start = window->start;
 	info->window_size = window->size;

Index: arctic-mtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/arctic-mtd.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- arctic-mtd.c	14 May 2003 22:26:29 -0000	1.6
+++ arctic-mtd.c	20 May 2003 20:59:29 -0000	1.7
@@ -104,7 +104,7 @@
 	if (!arctic_mtd)
 		return -ENXIO;
 
-	set_module_owner(arctic_mtd);
+	arctic_mtd->owner = THIS_MODULE;
 
 	return add_mtd_partitions(arctic_mtd, arctic_partitions, 3);
 }

Index: autcpu12-nvram.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/autcpu12-nvram.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- autcpu12-nvram.c	14 May 2003 22:26:29 -0000	1.3
+++ autcpu12-nvram.c	20 May 2003 20:59:29 -0000	1.4
@@ -86,7 +86,7 @@
 		goto out_ioremap;
 	}
 
-	set_module_owner(sram_mtd);
+	sram_mtd->owner = THIS_MODULE;
 	sram_mtd->erasesize = 16;
 	
 	if (add_mtd_device(sram_mtd)) {

Index: beech-mtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/beech-mtd.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- beech-mtd.c	14 May 2003 22:26:29 -0000	1.5
+++ beech-mtd.c	20 May 2003 20:59:29 -0000	1.6
@@ -88,7 +88,7 @@
 	if (!beech_mtd)
 		return -ENXIO;
 
-	set_module_owner(beech_mtd);
+	beech_mtd->owner = THIS_MODULE;
 
 	return add_mtd_partitions(beech_mtd, beech_partitions, 2);
 }

Index: cdb89712.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/cdb89712.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- cdb89712.c	14 May 2003 22:26:29 -0000	1.5
+++ cdb89712.c	20 May 2003 20:59:29 -0000	1.6
@@ -62,7 +62,7 @@
 		goto out_ioremap;
 	}
 
-	set_module_owner(flash_mtd);
+	flash_mtd->owner = THIS_MODULE;
 	
 	if (add_mtd_device(flash_mtd)) {
 		printk("FLASH device addition failed\n");
@@ -127,7 +127,7 @@
 		goto out_ioremap;
 	}
 
-	set_module_owner(sram_mtd);
+	sram_mtd->owner = THIS_MODULE;
 	sram_mtd->erasesize = 16;
 	
 	if (add_mtd_device(sram_mtd)) {
@@ -195,7 +195,7 @@
 		goto out_ioremap;
 	}
 
-	set_module_owner(bootrom_mtd);
+	bootrom_mtd->owner = THIS_MODULE;
 	bootrom_mtd->erasesize = 0x10000;
 	
 	if (add_mtd_device(bootrom_mtd)) {

Index: ceiva.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ceiva.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ceiva.c	16 May 2003 17:07:15 -0000	1.6
+++ ceiva.c	20 May 2003 20:59:29 -0000	1.7
@@ -160,7 +160,7 @@
 			ret = -ENXIO;
 			break;
 		}
-		set_module_owner(clps[i].mtd);
+		clps[i].mtd->owner = THIS_MODULE;
 		subdev[i] = clps[i].mtd;
 
 		printk(KERN_INFO "clps flash: JEDEC device at 0x%08lx, %dMiB, "

Index: cfi_flagadm.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/cfi_flagadm.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- cfi_flagadm.c	14 May 2003 22:26:29 -0000	1.9
+++ cfi_flagadm.c	20 May 2003 20:59:29 -0000	1.10
@@ -107,7 +107,7 @@
 
 	mymtd = do_map_probe("cfi_probe", &flagadm_map);
 	if (mymtd) {
-		set_module_owner(mymtd);
+		mymtd->owner = THIS_MODULE;
 		add_mtd_partitions(mymtd, flagadm_parts, PARTITION_COUNT);
 		printk(KERN_NOTICE "FlagaDM flash device initialized\n");
 		return 0;

Index: cstm_mips_ixx.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/cstm_mips_ixx.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- cstm_mips_ixx.c	14 May 2003 22:26:29 -0000	1.7
+++ cstm_mips_ixx.c	20 May 2003 20:59:29 -0000	1.8
@@ -199,7 +199,7 @@
 		        printk(KERN_NOTICE "cstm_mips_ixx %d jedec: mymtd is %x\n",i,(unsigned int)mymtd);
 		}
 		if (mymtd) {
-			set_module_owner(mymtd);
+			mymtd->owner = THIS_MODULE;
 
 	                cstm_mips_ixx_map[i].map_priv_2 = (unsigned long)mymtd;
 		        add_mtd_partitions(mymtd, parts, cstm_mips_ixx_board_desc[i].num_partitions);

Index: dbox2-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dbox2-flash.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- dbox2-flash.c	14 May 2003 22:26:29 -0000	1.7
+++ dbox2-flash.c	20 May 2003 20:59:29 -0000	1.8
@@ -91,7 +91,7 @@
 	}
 	    
 	if (mymtd) {
-		set_module_owner(mymtd);
+		mymtd->owner = THIS_MODULE;
 
                 /* Create MTD devices for each partition. */
 	        add_mtd_partitions(mymtd, partition_info, NUM_PARTITIONS);

Index: dc21285.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dc21285.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- dc21285.c	16 May 2003 17:07:15 -0000	1.13
+++ dc21285.c	20 May 2003 20:59:29 -0000	1.14
@@ -157,7 +157,7 @@
 	if (mymtd) {
 		int nrparts = 0;
 
-		set_module_owner(mymtd);
+		mymtd->owner = THIS_MODULE;
 			
 		/* partition fixup */
 

Index: dilnetpc.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dilnetpc.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- dilnetpc.c	14 May 2003 22:26:29 -0000	1.10
+++ dilnetpc.c	20 May 2003 20:59:29 -0000	1.11
@@ -433,7 +433,7 @@
 		return -ENXIO;
 	}
 		
-	set_module_owner(mymtd);
+	mymtd->owner = THIS_MODULE;
 
 	/*
 	** Supply pointers to lowlvl_parts[] array to add_mtd_partitions()

Index: ebony.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ebony.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ebony.c	14 May 2003 22:26:29 -0000	1.5
+++ ebony.c	20 May 2003 20:59:29 -0000	1.6
@@ -106,7 +106,7 @@
 
 	flash = do_map_probe("map_rom", &ebony_small_map);
 	if (flash) {
-		set_module_owner(flash);
+		flash->owner = THIS_MODULE;
 		add_mtd_partitions(flash, ebony_small_partitions,
 					NB_OF(ebony_small_partitions));
 	} else {
@@ -128,7 +128,7 @@
 
 	flash = do_map_probe("cfi_probe", &ebony_large_map);
 	if (flash) {
-		set_module_owner(flash);
+		flash->owner = THIS_MODULE;
 		add_mtd_partitions(flash, ebony_large_partitions,
 					NB_OF(ebony_large_partitions));
 	} else {

Index: edb7312.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/edb7312.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- edb7312.c	16 May 2003 17:07:15 -0000	1.6
+++ edb7312.c	20 May 2003 20:59:29 -0000	1.7
@@ -98,7 +98,7 @@
 		mymtd = do_map_probe(*type, &edb7312nor_map);
 	}
 	if (mymtd) {
-		set_module_owner(mymtd);
+		mymtd->owner = THIS_MODULE;
 
 #ifdef CONFIG_MTD_PARTITIONS
 		mtd_parts_nb = parse_mtd_partitions(mymtd, probes, &mtd_parts, MTDID);

Index: elan-104nc.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/elan-104nc.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- elan-104nc.c	14 May 2003 22:26:29 -0000	1.15
+++ elan-104nc.c	20 May 2003 20:59:29 -0000	1.16
@@ -261,7 +261,7 @@
 		return -ENXIO;
 	}
 	
-	set_module_owner(all_mtd);
+	all_mtd->owner = THIS_MODULE;
 
 	/* Create MTD devices for each partition. */
 	add_mtd_partitions( all_mtd, partition_info, NUM_PARTITIONS );

Index: epxa10db-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/epxa10db-flash.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- epxa10db-flash.c	16 May 2003 17:07:15 -0000	1.8
+++ epxa10db-flash.c	20 May 2003 20:59:30 -0000	1.9
@@ -74,7 +74,7 @@
 		return -ENXIO;
 	}
 
-	set_module_owner(mymtd);
+	mymtd->owner = THIS_MODULE;
 
 	/* Unlock the flash device. */
 	if(mymtd->unlock){

Index: fortunet.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/fortunet.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- fortunet.c	14 May 2003 22:26:30 -0000	1.4
+++ fortunet.c	20 May 2003 20:59:30 -0000	1.5
@@ -236,7 +236,7 @@
 				map_regions[ix].mymtd = do_map_probe("cfi_probe",
 					&map_regions[ix].map_info);
 			}
-			set_module_owner(map_regions[ix].mymtd);
+			map_regions[ix].mymtd->owner = THIS_MODULE;
 			add_mtd_partitions(map_regions[ix].mymtd,
 				map_regions[ix].parts,map_regions_parts[ix]);
 		}

Index: h720x-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/h720x-flash.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- h720x-flash.c	16 May 2003 17:07:16 -0000	1.4
+++ h720x-flash.c	20 May 2003 20:59:30 -0000	1.5
@@ -89,7 +89,7 @@
 	}
 	    
 	if (mymtd) {
-		set_module_owner(mymtd);
+		mymtd->owner = THIS_MODULE;
 
 #ifdef CONFIG_MTD_PARTITIONS
 		nr_mtd_parts = parse_mtd_partitions(mymtd, probes, &mtd_parts, 0);

Index: ich2rom.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ich2rom.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ich2rom.c	14 May 2003 22:26:30 -0000	1.5
+++ ich2rom.c	20 May 2003 20:59:30 -0000	1.6
@@ -222,7 +222,7 @@
 	info->mtd->lock = ich2rom_lock;
 	info->mtd->unlock = ich2rom_unlock;
 		
-	set_module_owner(info->mtd);
+	info->mtd->owner = THIS_MODULE;
 	add_mtd_device(info->mtd);
 	return 0;
 

Index: impa7.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/impa7.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- impa7.c	16 May 2003 17:07:16 -0000	1.6
+++ impa7.c	20 May 2003 20:59:30 -0000	1.7
@@ -108,7 +108,7 @@
 
 		if (impa7_mtd[i]) 
 		{
-			set_module_owner(impa7_mtd[i]);
+			impa7_mtd[i]->owner = THIS_MODULE;
 			add_mtd_device(impa7_mtd[i]);
 			devicesfound++;
 #ifdef CONFIG_MTD_PARTITIONS

Index: integrator-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/integrator-flash.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- integrator-flash.c	16 May 2003 17:07:16 -0000	1.11
+++ integrator-flash.c	20 May 2003 20:59:30 -0000	1.12
@@ -188,7 +188,7 @@
 	if (!mtd)
 		return -ENXIO;
 
-	set_module_owner(mtd);
+	mtd->owner = THIS_MODULE;
 
 	ret = parse_mtd_partitions(mtd, probes, &parts, (void *)0);
 	if (ret > 0) {

Index: iq80310.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/iq80310.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- iq80310.c	16 May 2003 17:07:16 -0000	1.13
+++ iq80310.c	20 May 2003 20:59:30 -0000	1.14
@@ -80,7 +80,7 @@
 		iounmap((void *)iq80310_map.virt);
 		return -ENXIO;
 	}
-	set_module_owner(mymtd);
+	mymtd->owner = THIS_MODULE;
 
 	ret = parse_mtd_partitions(mymtd, probes, &parsed_parts, 0);
 

Index: l440gx.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/l440gx.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- l440gx.c	14 May 2003 22:26:30 -0000	1.10
+++ l440gx.c	20 May 2003 20:59:30 -0000	1.11
@@ -130,7 +130,7 @@
 		mymtd = do_map_probe("map_rom", &l440gx_map);
 	}
 	if (mymtd) {
-		set_module_owner(mymtd);
+		mymtd->owner = THIS_MODULE;
 
 		add_mtd_device(mymtd);
 		return 0;

Index: lasat.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/lasat.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- lasat.c	14 May 2003 22:26:30 -0000	1.3
+++ lasat.c	20 May 2003 20:59:30 -0000	1.4
@@ -58,7 +58,7 @@
 	if (mymtd) {
 		u32 size, offset = 0;
 
-		set_module_owner(mymtd);
+		mymtd->owner = THIS_MODULE;
 
 		for (i=0; i < LASAT_MTD_LAST; i++) {
 			size = lasat_flash_partition_size(i);

Index: lubbock-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/lubbock-flash.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- lubbock-flash.c	16 May 2003 17:25:31 -0000	1.6
+++ lubbock-flash.c	20 May 2003 20:59:30 -0000	1.7
@@ -96,7 +96,7 @@
 				ret = -EIO;
 			continue;
 		}
-		set_module_owner(mymtds[i]);
+		mymtds[i]->owner = THIS_MODULE;
 
 		int ret = parse_mtd_partitions(mymtds[i], probes,
 					       &parsed_parts[i], 0);

Index: mbx860.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/mbx860.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- mbx860.c	14 May 2003 22:26:30 -0000	1.3
+++ mbx860.c	20 May 2003 20:59:30 -0000	1.4
@@ -69,7 +69,7 @@
 
 	mymtd = do_map_probe("jedec_probe", &mbx_map);
 	if (mymtd) {
-		set_module_owner(mymtd);
+		mymtd->owner = THIS_MODULE;
 		add_mtd_device(mymtd);
                 add_mtd_partitions(mymtd, partition_info, NUM_PARTITIONS);
 		return 0;

Index: netsc520.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/netsc520.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- netsc520.c	14 May 2003 22:26:30 -0000	1.7
+++ netsc520.c	20 May 2003 20:59:30 -0000	1.8
@@ -114,7 +114,7 @@
 		return -ENXIO;
 	}
 		
-	set_module_owner(mymtd);
+	mymtd->owner = THIS_MODULE;
 	add_mtd_partitions( mymtd, partition_info, NUM_PARTITIONS );
 	return 0;
 }

Index: nettel.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/nettel.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- nettel.c	14 May 2003 22:26:30 -0000	1.3
+++ nettel.c	20 May 2003 20:59:30 -0000	1.4
@@ -285,7 +285,7 @@
 		printk(KERN_NOTICE "SNAPGEAR: AMD flash device size = %dK\n",
 			amd_mtd->size>>10);
 
-		set_module_owner(amd_mtd);
+		amd_mtd->owner = THIS_MODULE;
 
 		/* The high BIOS partition is only present for 2MB units */
 		num_amd_partitions = NUM_AMD_PARTITIONS;
@@ -416,7 +416,7 @@
 	printk(KERN_NOTICE "SNAPGEAR: Intel flash device size = %dK\n",
 		(intel_mtd->size >> 10));
 
-	set_module_owner(intel_mtd);
+	intel_mtd->owner = THIS_MODULE;
 
 #ifndef CONFIG_BLK_DEV_INITRD
 	ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, 1);

Index: nora.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/nora.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- nora.c	14 May 2003 22:26:30 -0000	1.22
+++ nora.c	20 May 2003 20:59:30 -0000	1.23
@@ -173,7 +173,7 @@
 
 	mymtd = do_map_probe("cfi_probe", &nora_map);
 	if (mymtd) {
-		set_module_owner(mymtd);
+		mymtd->owner = THIS_MODULE;
 		
 		add_mtd_device(&nora_mtds[2]);
 		add_mtd_device(&nora_mtds[0]);

Index: ocelot.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ocelot.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ocelot.c	16 May 2003 17:07:16 -0000	1.10
+++ ocelot.c	20 May 2003 20:59:30 -0000	1.11
@@ -94,7 +94,7 @@
 		printk("NVRAM probe failed\n");
 		goto fail_1;
 	}
-	set_module_owner(nvram_mtd);
+	nvram_mtd->owner = THIS_MODULE;
 	nvram_mtd->erasesize = 16;
 	/* Override the write() method */
 	nvram_mtd->write = ocelot_ram_write;
@@ -128,7 +128,7 @@
 
 	add_mtd_device(nvram_mtd);
 
-	set_module_owner(flash_mtd);
+	flash_mtd->owner = THIS_MODULE;
 	nr_parts = parse_mtd_partitions(flash_mtd, probes, &parsed_parts, 0);
 
 	if (nr_parts > 0)

Index: octagon-5066.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/octagon-5066.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- octagon-5066.c	14 May 2003 22:26:30 -0000	1.22
+++ octagon-5066.c	20 May 2003 20:59:31 -0000	1.23
@@ -264,7 +264,7 @@
 		if (!oct5066_mtd[i])
 			oct5066_mtd[i] = do_map_probe("map_rom", &oct5066_map[i]);
 		if (oct5066_mtd[i]) {
-			set_module_owner(oct5066_mtd[i]);
+			oct5066_mtd[i]->owner = THIS_MODULE;
 			add_mtd_device(oct5066_mtd[i]);
 		}
 	}

Index: pb1xxx-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pb1xxx-flash.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- pb1xxx-flash.c	14 May 2003 22:26:30 -0000	1.6
+++ pb1xxx-flash.c	20 May 2003 20:59:31 -0000	1.7
@@ -169,7 +169,7 @@
 		iounmap(pb1xxx_map.virt);
 		return -ENXIO;
 	}
-	set_module_owner(mymtd);
+	mymtd->owner = THIS_MODULE;
 
 	add_mtd_partitions(mymtd, parts, nb_parts);
 	return 0;

Index: pci.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pci.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- pci.c	14 May 2003 22:26:30 -0000	1.4
+++ pci.c	20 May 2003 20:59:31 -0000	1.5
@@ -321,7 +321,7 @@
 	if (!mtd)
 		goto release;
 
-	set_module_owner(mtd);
+	mtd->owner = THIS_MODULE;
 	add_mtd_device(mtd);
 
 	pci_set_drvdata(dev, mtd);

Index: pcmciamtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pcmciamtd.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- pcmciamtd.c	14 May 2003 22:26:30 -0000	1.42
+++ pcmciamtd.c	20 May 2003 20:59:31 -0000	1.43
@@ -645,7 +645,7 @@
 	}
 
 	dev->mtd_info = mtd;
-	set_module_owner(mtd);
+	mtd->owner = THIS_MODULE;
 
 	if(new_name) {
 		int size = 0;

Index: physmap.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/physmap.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- physmap.c	16 May 2003 17:07:16 -0000	1.25
+++ physmap.c	20 May 2003 20:59:31 -0000	1.26
@@ -82,7 +82,7 @@
 		mymtd = do_map_probe(*type, &physmap_map);
 	}
 	if (mymtd) {
-		set_module_owner(mymtd);
+		mymtd->owner = THIS_MODULE;
 
 #ifdef CONFIG_MTD_PARTITIONS
 		mtd_parts_nb = parse_mtd_partitions(mymtd, probes, 

Index: pnc2000.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pnc2000.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- pnc2000.c	14 May 2003 22:26:31 -0000	1.12
+++ pnc2000.c	20 May 2003 20:59:31 -0000	1.13
@@ -69,7 +69,7 @@
 
 	mymtd = do_map_probe("cfi_probe", &pnc_map);
 	if (mymtd) {
-		set_module_owner(mymtd);
+		mymtd->owner = THIS_MODULE;
 		return add_mtd_partitions(mymtd, pnc_partitions, 3);
 	}
 

Index: redwood.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/redwood.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- redwood.c	14 May 2003 22:26:31 -0000	1.4
+++ redwood.c	20 May 2003 20:59:31 -0000	1.5
@@ -143,7 +143,7 @@
 	redwood_mtd = do_map_probe("cfi_probe",&redwood_flash_map);
 
 	if (redwood_mtd) {
-		set_module_owner(redwood_mtd);
+		redwood_mtd->owner = THIS_MODULE;
 		return add_mtd_partitions(redwood_mtd,
 				redwood_flash_partitions,
 				NUM_REDWOOD_FLASH_PARTITIONS);

Index: rpxlite.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/rpxlite.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- rpxlite.c	14 May 2003 22:26:31 -0000	1.17
+++ rpxlite.c	20 May 2003 20:59:31 -0000	1.18
@@ -36,7 +36,7 @@
 	simple_map_init(&rpxlite_map);
 	mymtd = do_map_probe("cfi_probe", &rpxlite_map);
 	if (mymtd) {
-		set_module_owner(mymtd);
+		mymtd->owner = THIS_MODULE;
 		add_mtd_device(mymtd);
 		return 0;
 	}

Index: sa1100-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sa1100-flash.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- sa1100-flash.c	16 May 2003 17:07:16 -0000	1.33
+++ sa1100-flash.c	20 May 2003 20:59:31 -0000	1.34
@@ -910,7 +910,7 @@
 	ret = -ENXIO;
 	if (!mymtd)
 		goto out_err;
-	set_module_owner(mymtd);
+	mymtd->owner = THIS_MODULE;
 
 	/*
 	 * Dynamic partition selection stuff (might override the static ones)

Index: sbc_gxx.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sbc_gxx.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- sbc_gxx.c	14 May 2003 22:26:31 -0000	1.23
+++ sbc_gxx.c	20 May 2003 20:59:31 -0000	1.24
@@ -262,7 +262,7 @@
 		return -ENXIO;
 	}
 	
-	set_module_owner(all_mtd);
+	all_mtd->owner = THIS_MODULE;
 
 	/* Create MTD devices for each partition. */
 	add_mtd_partitions(all_mtd, partition_info, NUM_PARTITIONS );

Index: sc520cdp.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sc520cdp.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- sc520cdp.c	14 May 2003 22:26:31 -0000	1.13
+++ sc520cdp.c	20 May 2003 20:59:31 -0000	1.14
@@ -256,7 +256,7 @@
 			mymtd[i] = do_map_probe("map_rom", &sc520cdp_map[i]);
 
 		if (mymtd[i]) {
-			set_module_owner(mymtd[i]);
+			mymtd[i]->owner = THIS_MODULE;
 			++devices_found;
 		}
 		else {

Index: scb2_flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/scb2_flash.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- scb2_flash.c	14 May 2003 22:26:31 -0000	1.4
+++ scb2_flash.c	20 May 2003 20:59:32 -0000	1.5
@@ -178,7 +178,7 @@
 		return -ENODEV;
 	}
 
-	set_module_owner(scb2_mtd);
+	scb2_mtd->owner = THIS_MODULE;
 	if (scb2_fixup_mtd(scb2_mtd) < 0) {
 		del_mtd_device(scb2_mtd);
 		map_destroy(scb2_mtd);

Index: scx200_docflash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/scx200_docflash.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- scx200_docflash.c	14 May 2003 22:26:31 -0000	1.3
+++ scx200_docflash.c	20 May 2003 20:59:32 -0000	1.4
@@ -197,7 +197,7 @@
 	if (size < mymtd->size)
 		printk(KERN_WARNING NAME ": warning, flash mapping is smaller than flash size\n");
 
-	set_module_owner(mymtd);
+	mymtd->owner = THIS_MODULE;
 
 #if PARTITION
 	partition_info[3].offset = mymtd->size-partition_info[3].size;

Index: solutionengine.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/solutionengine.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- solutionengine.c	16 May 2003 17:07:16 -0000	1.8
+++ solutionengine.c	20 May 2003 20:59:32 -0000	1.9
@@ -86,11 +86,11 @@
 	printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n",
 	       soleng_flash_map.phys & 0x1fffffff,
 	       soleng_eprom_map.phys & 0x1fffffff);
-	set_module_owner(flash_mtd);
+	flash_mtd->owner = THIS_MODULE;
 
 	eprom_mtd = do_map_probe("map_rom", &soleng_eprom_map);
 	if (eprom_mtd) {
-		set_module_owner(eprom_mtd);
+		eprom_mtd->owner = THIS_MODULE;
 		add_mtd_device(eprom_mtd);
 	}
 

Index: sun_uflash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sun_uflash.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- sun_uflash.c	14 May 2003 22:26:31 -0000	1.6
+++ sun_uflash.c	20 May 2003 20:59:32 -0000	1.7
@@ -119,7 +119,7 @@
 
 	list_add(&pdev->list, &device_list);
 
-	set_module_owner(pdev->mtd);
+	pdev->mtd->owner = THIS_MODULE;
 
 	add_mtd_device(pdev->mtd);
 	return(0);

Index: tqm8xxl.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/tqm8xxl.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- tqm8xxl.c	14 May 2003 22:26:31 -0000	1.6
+++ tqm8xxl.c	20 May 2003 20:59:32 -0000	1.7
@@ -175,7 +175,7 @@
 		mtd_banks[idx] = do_map_probe("cfi_probe", map_banks[idx]);
 
 		if (mtd_banks[idx]) {
-			set_module_owner(mtd_banks[idx]);
+			mtd_banks[idx]->owner = THIS_MODULE;
 			mtd_size += mtd_banks[idx]->size;
 			num_banks++;
 

Index: tsunami_flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/tsunami_flash.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- tsunami_flash.c	14 May 2003 22:26:31 -0000	1.3
+++ tsunami_flash.c	20 May 2003 20:59:32 -0000	1.4
@@ -93,7 +93,7 @@
 		tsunami_flash_mtd = do_map_probe(*type, &tsunami_flash_map);
 	}
 	if (tsunami_flash_mtd) {
-		set_module_owner(tsunami_flash_mtd);
+		tsunami_flash_mtd->owner = THIS_MODULE;
 		add_mtd_device(tsunami_flash_mtd);
 		return 0;
 	}

Index: uclinux.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/uclinux.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- uclinux.c	14 May 2003 22:26:31 -0000	1.4
+++ uclinux.c	20 May 2003 20:59:32 -0000	1.5
@@ -85,7 +85,7 @@
 		return(-ENXIO);
 	}
 		
-	set_module_owner(mtd);
+	mtd->owner = THIS_MODULE;
 	mtd->point = uclinux_point;
 	mtd->priv = mapp;
 

Index: vmax301.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/vmax301.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- vmax301.c	14 May 2003 22:26:31 -0000	1.26
+++ vmax301.c	20 May 2003 20:59:32 -0000	1.27
@@ -220,7 +220,7 @@
 		if (!vmax_mtd[i])
 			vmax_mtd[i] = do_map_probe("map_rom", &vmax_map[i]);
 		if (vmax_mtd[i]) {
-			set_module_owner(vmax_mtd[i]);
+			vmax_mtd[i]->owner = THIS_MODULE;
 			add_mtd_device(vmax_mtd[i]);
 		}
 	}


From dwmw2 at infradead.org  Tue May 20 17:01:33 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:21 2006
Subject: mtd/drivers/mtd/nand nand.c,1.44,1.45
Message-ID: <E19IEEn-0002V0-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv9604

Modified Files:
	nand.c 
Log Message:
set owner explicitly. No set_module_owner

Index: nand.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- nand.c	14 May 2003 22:26:32 -0000	1.44
+++ nand.c	20 May 2003 21:01:30 -0000	1.45
@@ -1370,7 +1370,7 @@
 	mtd->unlock = NULL;
 	mtd->suspend = NULL;
 	mtd->resume = NULL;
-	set_module_owner(mtd);
+	mtd->owner = THIS_MODULE;
 
 	/* Return happy */
 	return 0;


From dwmw2 at infradead.org  Tue May 20 17:03:11 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:21 2006
Subject: mtd/drivers/mtd/devices blkmtd-25.c,1.3,1.4 blkmtd.c,1.18,1.19
 doc2000.c,1.51,1.52 doc2001.c,1.39,1.40 lart.c,1.4,1.5
 ms02-nv.c,1.3,1.4 mtdram.c,1.30,1.31 pmc551.c,1.23,1.24slram.c,1.29,1.30
Message-ID: <E19IEGN-0002VC-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/devices
In directory phoenix.infradead.org:/tmp/cvs-serv9616

Modified Files:
	blkmtd-25.c blkmtd.c doc2000.c doc2001.c lart.c ms02-nv.c 
	mtdram.c pmc551.c slram.c 
Log Message:
set owner explicitly. No set_module_owner

Index: blkmtd-25.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/blkmtd-25.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- blkmtd-25.c	14 May 2003 22:26:27 -0000	1.3
+++ blkmtd-25.c	20 May 2003 21:03:07 -0000	1.4
@@ -731,7 +731,7 @@
 	}
 	dev->mtd_info.read = blkmtd_read;
 	dev->mtd_info.priv = dev;
-	set_module_owner(&dev->mtd_info);
+	&dev->mtd_info->owner = THIS_MODULE;
 
 	list_add(&dev->list, &blkmtd_device_list);
 	if (add_mtd_device(&dev->mtd_info)) {

Index: blkmtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/blkmtd.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- blkmtd.c	14 May 2003 22:26:27 -0000	1.18
+++ blkmtd.c	20 May 2003 21:03:07 -0000	1.19
@@ -912,7 +912,7 @@
 	dev->mtd_info.point = 0;
 	dev->mtd_info.unpoint = 0;
 	dev->mtd_info.priv = dev;
-	set_module_owner(&dev->mtd_info);
+	dev->mtd_info.owner = THIS_MODULE;
 
 	list_add(&dev->list, &blkmtd_device_list);
 	if (add_mtd_device(&dev->mtd_info)) {

Index: doc2000.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/doc2000.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- doc2000.c	14 May 2003 22:26:28 -0000	1.51
+++ doc2000.c	20 May 2003 21:03:07 -0000	1.52
@@ -557,7 +557,7 @@
 	mtd->erasesize = 0;
 	mtd->oobblock = 512;
 	mtd->oobsize = 16;
-	set_module_owner(mtd);
+	mtd->owner = THIS_MODULE;
 	mtd->erase = doc_erase;
 	mtd->point = NULL;
 	mtd->unpoint = NULL;

Index: doc2001.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/doc2001.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- doc2001.c	14 May 2003 22:26:28 -0000	1.39
+++ doc2001.c	20 May 2003 21:03:07 -0000	1.40
@@ -366,7 +366,7 @@
 
 	mtd->oobblock = 512;
 	mtd->oobsize = 16;
-	set_module_owner(mtd);
+	mtd->owner = THIS_MODULE;
 	mtd->erase = doc_erase;
 	mtd->point = NULL;
 	mtd->unpoint = NULL;

Index: lart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/lart.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- lart.c	14 May 2003 22:26:28 -0000	1.4
+++ lart.c	20 May 2003 21:03:07 -0000	1.5
@@ -644,7 +644,7 @@
    mtd.erase = flash_erase;
    mtd.read = flash_read;
    mtd.write = flash_write;
-   set_module_owner(&mtd);
+   mtd.owner = THIS_MODULE;
 
 #ifdef LART_DEBUG
    printk (KERN_DEBUG

Index: ms02-nv.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/ms02-nv.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ms02-nv.c	14 May 2003 22:26:28 -0000	1.3
+++ ms02-nv.c	20 May 2003 21:03:07 -0000	1.4
@@ -222,7 +222,7 @@
 	mtd->flags = MTD_CAP_RAM | MTD_XIP;
 	mtd->size = fixsize;
 	mtd->name = (char *)ms02nv_name;
-	set_module_owner(mtd);
+	mtd->owner = THIS_MODULE;
 	mtd->read = ms02nv_read;
 	mtd->write = ms02nv_write;
 

Index: mtdram.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/mtdram.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- mtdram.c	14 May 2003 22:26:28 -0000	1.30
+++ mtdram.c	20 May 2003 21:03:07 -0000	1.31
@@ -136,7 +136,7 @@
    mtd->erasesize = MTDRAM_ERASE_SIZE;
    mtd->priv = mapped_address;
 
-   set_module_owner(mtd);
+   mtd->owner = THIS_MODULE;
    mtd->erase = ram_erase;
    mtd->point = ram_point;
    mtd->unpoint = ram_unpoint;

Index: pmc551.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/pmc551.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- pmc551.c	14 May 2003 22:26:28 -0000	1.23
+++ pmc551.c	20 May 2003 21:03:08 -0000	1.24
@@ -790,7 +790,7 @@
                 mtd->type 	= MTD_RAM;
                 mtd->name 	= "PMC551 RAM board";
                 mtd->erasesize 	= 0x10000;
-		set_module_owner(mtd);
+		mtd->owner = THIS_MODULE;
 
                 if (add_mtd_device(mtd)) {
                         printk(KERN_NOTICE "pmc551: Failed to register new device\n");

Index: slram.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/slram.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- slram.c	14 May 2003 22:26:28 -0000	1.29
+++ slram.c	20 May 2003 21:03:08 -0000	1.30
@@ -199,7 +199,7 @@
 	(*curmtd)->mtdinfo->unpoint = slram_unpoint;
 	(*curmtd)->mtdinfo->read = slram_read;
 	(*curmtd)->mtdinfo->write = slram_write;
-	set_module_owner((*curmtd)->mtdinfo);
+	(*curmtd)->mtdinfo->owner = THIS_MODULE;
 	(*curmtd)->mtdinfo->type = MTD_RAM;
 	(*curmtd)->mtdinfo->erasesize = 0x0;
 


From dwmw2 at infradead.org  Tue May 20 17:29:40 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:22 2006
Subject: mtd/drivers/mtd mtd_blkdevs-24.c,1.2,1.3
Message-ID: <E19IEg0-0002bl-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv10023

Modified Files:
	mtd_blkdevs-24.c 
Log Message:
Remove O(1) scheduler stuff. This is for 2.4, not 2.4++.
Set gd.nr_real to maximum -- it doesn't handle sparse minors properly.
Avoid MTD_ABSENT devices.


Index: mtd_blkdevs-24.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs-24.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- mtd_blkdevs-24.c	20 May 2003 17:17:26 -0000	1.2
+++ mtd_blkdevs-24.c	20 May 2003 21:29:37 -0000	1.3
@@ -123,10 +123,10 @@
 	   actually want to deal with signals. We can't just call 
 	   exit_sighand() since that'll cause an oops when we finally
 	   do exit. */
-	spin_lock_irq(&current->sighand->siglock);
+	spin_lock_irq(&current->sigmask_lock);
 	sigfillset(&current->blocked);
-	recalc_sigpending();
-	spin_unlock_irq(&current->sighand->siglock);
+	recalc_sigpending(current);
+	spin_unlock_irq(&current->sigmask_lock);
 
 	daemonize();
 
@@ -452,7 +452,6 @@
 
 	tr->blkcore_priv->sizes[new->devnum << tr->part_bits] = new->size;
 	tr->blkcore_priv->part_table[new->devnum << tr->part_bits].nr_sects = new->size;
-	tr->blkcore_priv->gd.nr_real++;
 
 	if (tr->part_bits) {
 		grok_partitions(&tr->blkcore_priv->gd, new->devnum,
@@ -500,7 +499,6 @@
 		tr->blkcore_priv->part_table[i].nr_sects = 0;
 		tr->blkcore_priv->part_table[i].start_sect = 0;
 	}
-	tr->blkcore_priv->gd.nr_real--;
 		
 	return 0;
 }
@@ -525,6 +523,9 @@
 {
 	struct list_head *this;
 
+	if (mtd->type == MTD_ABSENT)
+		return;
+
 	list_for_each(this, &blktrans_majors) {
 		struct mtd_blktrans_ops *tr = list_entry(this, struct mtd_blktrans_ops, list);
 
@@ -590,6 +591,7 @@
 	tr->blkcore_priv->gd.max_p = (1<<tr->part_bits) - 1;
 	tr->blkcore_priv->gd.part = tr->blkcore_priv->part_table;
 	tr->blkcore_priv->gd.sizes = tr->blkcore_priv->sizes;
+	tr->blkcore_priv->gd.nr_real = 256 >> tr->part_bits;
 
 	spin_lock_init(&tr->blkcore_priv->devs_lock);
 
@@ -600,7 +602,7 @@
 	list_add(&tr->list, &blktrans_majors);
 
 	for (i=0; i<MAX_MTD_DEVICES; i++) {
-		if (mtd_table[i])
+		if (mtd_table[i] && mtd_table[i]->type != MTD_ABSENT)
 			tr->add_mtd(tr, mtd_table[i]);
 	}
 	up(&mtd_table_mutex);


From dwmw2 at infradead.org  Tue May 20 17:31:56 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:22 2006
Subject: mtd/drivers/mtd mtd_blkdevs.c,1.9,1.10
Message-ID: <E19IEiC-0002cq-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv10073

Modified Files:
	mtd_blkdevs.c 
Log Message:
Fix list bug, avoid MTD_ABSENT devices


Index: mtd_blkdevs.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- mtd_blkdevs.c	20 May 2003 14:36:21 -0000	1.9
+++ mtd_blkdevs.c	20 May 2003 21:31:53 -0000	1.10
@@ -361,7 +361,7 @@
 		struct mtd_blktrans_ops *tr = list_entry(this, struct mtd_blktrans_ops, list);
 
 		list_for_each_safe(this2, next, &tr->devs) {
-			struct mtd_blktrans_dev *dev = list_entry(this, struct mtd_blktrans_dev, list);
+			struct mtd_blktrans_dev *dev = list_entry(this2, struct mtd_blktrans_dev, list);
 
 			if (dev->mtd == mtd)
 				tr->remove_dev(dev);
@@ -373,6 +373,9 @@
 {
 	struct list_head *this;
 
+	if (mtd->type == MTD_ABSENT)
+		return;
+
 	list_for_each(this, &blktrans_majors) {
 		struct mtd_blktrans_ops *tr = list_entry(this, struct mtd_blktrans_ops, list);
 
@@ -415,7 +418,7 @@
 	list_add(&tr->list, &blktrans_majors);
 
 	for (i=0; i<MAX_MTD_DEVICES; i++) {
-		if (mtd_table[i])
+		if (mtd_table[i] && mtd_table[i]->type != MTD_ABSENT)
 			tr->add_mtd(tr, mtd_table[i]);
 	}
 


From dwmw2 at infradead.org  Tue May 20 17:43:29 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:22 2006
Subject: mtd/drivers/mtd mtd_blkdevs-24.c,1.3,1.4
Message-ID: <E19IEtN-00038e-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv12062

Modified Files:
	mtd_blkdevs-24.c 
Log Message:
slight cleanup

Index: mtd_blkdevs-24.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs-24.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- mtd_blkdevs-24.c	20 May 2003 21:29:37 -0000	1.3
+++ mtd_blkdevs-24.c	20 May 2003 21:43:26 -0000	1.4
@@ -110,9 +110,7 @@
 static int mtd_blktrans_thread(void *arg)
 {
 	struct mtd_blktrans_ops *tr = arg;
-	request_queue_t *rq = (BLK_DEFAULT_QUEUE(tr->major));
-
-	BUG_ON(!tr);
+	struct request_queue *rq = BLK_DEFAULT_QUEUE(tr->major);
 
 	/* we might get involved when memory gets low, so use PF_MEMALLOC */
 	current->flags |= PF_MEMALLOC;


From dwmw2 at infradead.org  Tue May 20 17:50:06 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:22 2006
Subject: mtd/drivers/mtd mtdchar.c,1.52,1.53
Message-ID: <E19IEzm-0003AA-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv12156

Modified Files:
	mtdchar.c 
Log Message:
More missing includes

Index: mtdchar.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdchar.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- mtdchar.c	2 Mar 2003 18:45:07 -0000	1.52
+++ mtdchar.c	20 May 2003 21:50:03 -0000	1.53
@@ -11,6 +11,9 @@
 #include <linux/module.h>
 #include <linux/mtd/mtd.h>
 #include <linux/slab.h>
+#include <linux/init.h>
+#include <linux/fs.h>
+#include <asm/uaccess.h>
 
 #ifdef CONFIG_DEVFS_FS
 #include <linux/devfs_fs_kernel.h>


From dwmw2 at infradead.org  Tue May 20 17:52:11 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:22 2006
Subject: mtd/drivers/mtd mtd_blkdevs-24.c,1.4,1.5
Message-ID: <E19IF1n-0003B8-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv12199

Modified Files:
	mtd_blkdevs-24.c 
Log Message:
Add missing init.h


Index: mtd_blkdevs-24.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs-24.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- mtd_blkdevs-24.c	20 May 2003 21:43:26 -0000	1.4
+++ mtd_blkdevs-24.c	20 May 2003 21:52:08 -0000	1.5
@@ -18,6 +18,7 @@
 #include <linux/blk.h>
 #include <linux/blkpg.h>
 #include <linux/spinlock.h>
+#include <linux/init.h>
 #include <asm/semaphore.h>
 
 static LIST_HEAD(blktrans_majors);


From dwmw2 at infradead.org  Tue May 20 17:54:43 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:22 2006
Subject: mtd/include/linux/mtd blktrans.h,1.2,1.3
Message-ID: <E19IF4F-0003Bf-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv12249

Modified Files:
	blktrans.h 
Log Message:
blkcore_priv in dev struct

Index: blktrans.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/blktrans.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- blktrans.h	20 May 2003 13:42:57 -0000	1.2
+++ blktrans.h	20 May 2003 21:54:40 -0000	1.3
@@ -27,6 +27,7 @@
 	int blksize;
 	unsigned long size;
 	int readonly;
+	void *blkcore_priv;
 };
 
 struct blkcore_priv; /* Differs for 2.4 and 2.5 kernels; private */


From dwmw2 at infradead.org  Tue May 20 17:56:43 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:22 2006
Subject: mtd/include/linux/mtd mtd.h,1.44,1.45
Message-ID: <E19IF6B-0003C7-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv12277

Modified Files:
	mtd.h 
Log Message:
no compatmac.h

Index: mtd.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/mtd.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- mtd.h	20 May 2003 15:37:05 -0000	1.44
+++ mtd.h	20 May 2003 21:56:40 -0000	1.45
@@ -9,7 +9,6 @@
 #include <linux/config.h>
 #include <linux/version.h>
 #include <linux/types.h>
-#include <linux/mtd/compatmac.h>
 #include <linux/module.h>
 #include <linux/uio.h>
 


From dwmw2 at infradead.org  Tue May 20 17:56:31 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:22 2006
Subject: mtd/include/linux/mtd partitions.h,1.13,1.14
Message-ID: <E19IF5z-0003By-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv12268

Modified Files:
	partitions.h 
Log Message:
make pur_partition_parser a #define

Index: partitions.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/partitions.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- partitions.h	16 May 2003 16:33:35 -0000	1.13
+++ partitions.h	20 May 2003 21:56:29 -0000	1.14
@@ -70,10 +70,7 @@
 extern int parse_mtd_partitions(struct mtd_info *master, const char **types, 
 				struct mtd_partition **pparts, unsigned long origin);
 
-static inline void put_partition_parser(struct mtd_part_parser *p)
-{
-	module_put(p->owner);
-}
+#define put_partition_parser(p) do { module_put((p)->owner); } while(0)
 
 #endif
 


From dwmw2 at infradead.org  Tue May 20 18:29:11 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:22 2006
Subject: mtd/drivers/mtd mtd_blkdevs.c,1.10,1.11
Message-ID: <E19IFbb-0003N4-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv12939

Modified Files:
	mtd_blkdevs.c 
Log Message:
Reinstate kernel thread.


Index: mtd_blkdevs.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- mtd_blkdevs.c	20 May 2003 21:31:53 -0000	1.10
+++ mtd_blkdevs.c	20 May 2003 22:29:08 -0000	1.11
@@ -18,6 +18,7 @@
 #include <linux/blk.h>
 #include <linux/blkpg.h>
 #include <linux/spinlock.h>
+#include <linux/init.h>
 #include <asm/semaphore.h>
 #include <linux/devfs_fs_kernel.h>
 
@@ -29,6 +30,12 @@
 static struct request_queue mtd_blktrans_queue;
 static spinlock_t mtd_blktrans_queue_lock;
 
+struct mtd_blkcore_priv {
+	struct completion thread_dead;
+	int exiting;
+	wait_queue_head_t thread_wq;
+};
+
 static inline struct mtd_blktrans_dev *tr_get_dev(struct mtd_blktrans_ops *tr,
 					   int devnum)
 {
@@ -97,14 +104,46 @@
 	}
 }
 
-static void mtd_blktrans_request(request_queue_t *rq)
+static int mtd_blktrans_thread(void *arg)
 {
-	struct request *req;
+	struct mtd_blktrans_ops *tr = arg;
+	struct request_queue *rq = &mtd_blktrans_queue;
+
+	/* we might get involved when memory gets low, so use PF_MEMALLOC */
+	current->flags |= PF_MEMALLOC;
+
+	daemonize("%sd", tr->name);
+
+	/* daemonize() doesn't do this for us since some kernel threads
+	   actually want to deal with signals. We can't just call 
+	   exit_sighand() since that'll cause an oops when we finally
+	   do exit. */
+	spin_lock_irq(&current->sighand->siglock);
+	sigfillset(&current->blocked);
+	recalc_sigpending();
+	spin_unlock_irq(&current->sighand->siglock);
 
-	while ((req = elv_next_request(rq))) {
-		struct mtd_blktrans_ops *tr;
+	while (!tr->blkcore_priv->exiting) {
+		struct request *req;
 		struct mtd_blktrans_dev *dev;
 		int res = 0;
+		DECLARE_WAITQUEUE(wait, current);
+
+		spin_lock_irq(rq->queue_lock);
+
+		req = elv_next_request(rq);
+
+		if (!req) {
+			add_wait_queue(&tr->blkcore_priv->thread_wq, &wait);
+			set_current_state(TASK_INTERRUPTIBLE);
+
+			spin_unlock_irq(rq->queue_lock);
+
+			schedule();
+			remove_wait_queue(&tr->blkcore_priv->thread_wq, &wait);
+
+			continue;
+		}
 
 		dev = req->rq_disk->private_data;
 		tr = dev->tr;
@@ -119,8 +158,16 @@
 
 		end_request(req, res);
 	}
+	complete_and_exit(&tr->blkcore_priv->thread_dead, 0);
 }
 
+static void mtd_blktrans_request(struct request_queue *rq)
+{
+	struct mtd_blktrans_ops *tr = rq->queuedata;
+	wake_up(&tr->blkcore_priv->thread_wq);
+}
+
+
 int blktrans_open(struct inode *i, struct file *f)
 {
 	struct mtd_blktrans_ops *tr = NULL;
@@ -177,6 +224,7 @@
 	}
  out:
 	up(&mtd_table_mutex);
+
 	return ret;
 }
 
@@ -411,6 +459,17 @@
 	blk_init_queue(&mtd_blktrans_queue, mtd_blktrans_request, 
 		       &mtd_blktrans_queue_lock);
 
+	init_completion(&tr->blkcore_priv->thread_dead);
+	init_waitqueue_head(&tr->blkcore_priv->thread_wq);
+
+	ret = kernel_thread(mtd_blktrans_thread, tr, 
+			    CLONE_FS|CLONE_FILES|CLONE_SIGHAND);
+	if (ret < 0) {
+		blk_cleanup_queue(&mtd_blktrans_queue);
+		unregister_blkdev(tr->major, tr->name);
+		return ret;
+       } 
+
 	devfs_mk_dir(tr->name);
 
 	tr->usecount = 0;
@@ -423,6 +482,7 @@
 	}
 
 	up(&mtd_table_mutex);
+
 	return 0;
 }
 
@@ -431,10 +491,19 @@
 	struct list_head *this, *next;
 
 	down(&mtd_table_mutex);
+
 	if (tr->usecount) {
 		up(&mtd_table_mutex);
 		return -EBUSY;
 	}
+
+
+	/* Clean up the kernel thread */
+	tr->blkcore_priv->exiting = 1;
+	wake_up(&tr->blkcore_priv->thread_wq);
+	wait_for_completion(&tr->blkcore_priv->thread_dead);
+
+	/* Remove it from the list of active majors */
 	list_del(&tr->list);
 
 	list_for_each_safe(this, next, &tr->devs) {


From dwmw2 at infradead.org  Tue May 20 21:01:02 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:22 2006
Subject: mtd/drivers/mtd mtd_blkdevs.c,1.11,1.12
Message-ID: <E19IHyY-0005OB-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv20708/drivers/mtd

Modified Files:
	mtd_blkdevs.c 
Log Message:
clean up open, release and ioctl to avoid lookups and locking

Index: mtd_blkdevs.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- mtd_blkdevs.c	20 May 2003 22:29:08 -0000	1.11
+++ mtd_blkdevs.c	21 May 2003 01:00:59 -0000	1.12
@@ -27,44 +27,14 @@
 extern struct semaphore mtd_table_mutex;
 extern struct mtd_info *mtd_table[];
 
-static struct request_queue mtd_blktrans_queue;
-static spinlock_t mtd_blktrans_queue_lock;
-
 struct mtd_blkcore_priv {
 	struct completion thread_dead;
 	int exiting;
 	wait_queue_head_t thread_wq;
+	struct request_queue rq;
+	spinlock_t queue_lock;
 };
 
-static inline struct mtd_blktrans_dev *tr_get_dev(struct mtd_blktrans_ops *tr,
-					   int devnum)
-{
-	struct list_head *this;
-	struct mtd_blktrans_dev *d;
-
-	list_for_each(this, &tr->devs) {
-		d = list_entry(this, struct mtd_blktrans_dev, list);
-
-		if (d->devnum == devnum)
-			return d;
-	}
-	return NULL;
-}
-
-static inline struct mtd_blktrans_ops *get_tr(int major)
-{
-	struct list_head *this;
-	struct mtd_blktrans_ops *t;
-
-	list_for_each(this, &blktrans_majors) {
-		t = list_entry(this, struct mtd_blktrans_ops, list);
-
-		if (t->major == major)
-			return t;
-	}
-	return NULL;
-}
-
 static int do_blktrans_request(struct mtd_blktrans_ops *tr,
 			       struct mtd_blktrans_dev *dev,
 			       struct request *req)
@@ -107,7 +77,7 @@
 static int mtd_blktrans_thread(void *arg)
 {
 	struct mtd_blktrans_ops *tr = arg;
-	struct request_queue *rq = &mtd_blktrans_queue;
+	struct request_queue *rq = &tr->blkcore_priv->rq;
 
 	/* we might get involved when memory gets low, so use PF_MEMALLOC */
 	current->flags |= PF_MEMALLOC;
@@ -170,61 +140,32 @@
 
 int blktrans_open(struct inode *i, struct file *f)
 {
-	struct mtd_blktrans_ops *tr = NULL;
-	struct mtd_blktrans_dev *dev = NULL;
-	int major_nr = major(i->i_rdev);
-	int minor_nr = minor(i->i_rdev);
-	int devnum;
+	struct mtd_blktrans_dev *dev;
+	struct mtd_blktrans_ops *tr;
 	int ret = -ENODEV;
 
-#if 0 /* Do we still have to do this in 2.5? Hopefully not since I don't
-	 see how */
-	if (is_read_only(i->i_rdev) && (f->f_mode & FMODE_WRITE))
-		return -EROFS;
-#endif
-
-	down(&mtd_table_mutex);
-
-	tr = get_tr(major_nr);
+	dev = i->i_bdev->bd_disk->private_data;
+	tr = dev->tr;
 
-	if (!tr)
-		goto out;
- 
-	devnum = minor_nr >> tr->part_bits;
-
-	dev = tr_get_dev(tr, devnum);
-
-	if (!dev)
-		goto out;
-
-#if 0 /* Does it prevent us from opening a partition which doesn't exist */
-	if (!tr->blkcore_priv->part_table[minor_nr].nr_sects) {
-		ret = -ENODEV;
-		goto out;
-	}
-#endif
 	if (!try_module_get(dev->mtd->owner))
 		goto out;
 
 	if (!try_module_get(tr->owner))
 		goto out_tr;
 
+	/* FIXME: Locking. A hot pluggable device can go away 
+	   (del_mtd_device can be called for it) without its module
+	   being unloaded. */
 	dev->mtd->usecount++;
-	dev->usecount++;
-	tr->usecount++;
 
 	ret = 0;
 	if (tr->open && (ret = tr->open(dev, i, f))) {
-		tr->usecount--;
-		dev->usecount--;
 		dev->mtd->usecount--;
 		module_put(dev->mtd->owner);
 	out_tr:
 		module_put(tr->owner);
 	}
  out:
-	up(&mtd_table_mutex);
-
 	return ret;
 }
 
@@ -233,36 +174,18 @@
 	struct mtd_blktrans_dev *dev;
 	struct mtd_blktrans_ops *tr;
 	int ret = 0;
-	int devnum;
 
-	down(&mtd_table_mutex);
-
-	tr = get_tr(major(i->i_rdev));
-	if (!tr) {
-		up(&mtd_table_mutex);
-		return -ENODEV;
-	}
-
-	devnum = minor(i->i_rdev) >> tr->part_bits;
-	dev = tr_get_dev(tr, devnum);
-
-	if (!dev) {
-		up(&mtd_table_mutex);
-		return -ENODEV;
-	}
+	dev = i->i_bdev->bd_disk->private_data;
+	tr = dev->tr;
 
 	if (tr->release)
 		ret = tr->release(dev, i, f);
 
 	if (!ret) {
-		tr->usecount--;
-		dev->usecount--;
 		dev->mtd->usecount--;
 		module_put(dev->mtd->owner);
 		module_put(tr->owner);
 	}
-	
-	up(&mtd_table_mutex);
 
 	return ret;
 }
@@ -273,24 +196,10 @@
 {
 	struct mtd_blktrans_dev *dev;
 	struct mtd_blktrans_ops *tr;
-	int devnum;
 	int ret = -ENOTTY;
 
-	down(&mtd_table_mutex);
-
-	tr = get_tr(major(inode->i_rdev));
-	if (!tr) {
-		up(&mtd_table_mutex);
-		return -ENODEV;
-	}
-
-	devnum = minor(inode->i_rdev) >> tr->part_bits;
-	dev = tr_get_dev(tr, devnum);
-
-	up(&mtd_table_mutex);
-
-	if (!dev)
-		return -ENODEV;
+	dev = inode->i_bdev->bd_disk->private_data;
+	tr = dev->tr;
 
 	if (tr->ioctl)
 		ret = tr->ioctl(dev, inode, file, cmd, arg);
@@ -351,8 +260,6 @@
 	init_MUTEX(&new->sem);
 	list_add_tail(&new->list, &tr->devs);
  added:
-	new->usecount = 0;
-
 	if (!tr->writesect)
 		new->readonly = 1;
 
@@ -373,7 +280,7 @@
 	set_capacity(gd, new->size);
 	gd->private_data = new;
 	new->blkcore_priv = gd;
-	gd->queue = &mtd_blktrans_queue;
+	gd->queue = &tr->blkcore_priv->rq;
 
 	if (new->readonly)
 		set_disk_ro(gd, 1);
@@ -390,9 +297,6 @@
 		BUG();
 	}
 
-	if (old->usecount)
-		return -EBUSY;
-
 	list_del(&old->list);
 
 	del_gendisk(old->blkcore_priv);
@@ -424,6 +328,8 @@
 	if (mtd->type == MTD_ABSENT)
 		return;
 
+	printk("%s:%s %d: count %d\n", __FILE__, __func__, __LINE__, atomic_read(&mtd_table_mutex.count));
+
 	list_for_each(this, &blktrans_majors) {
 		struct mtd_blktrans_ops *tr = list_entry(this, struct mtd_blktrans_ops, list);
 
@@ -447,35 +353,47 @@
 	if (!blktrans_notifier.list.next)
 		register_mtd_user(&blktrans_notifier);
 
+	tr->blkcore_priv = kmalloc(sizeof(*tr->blkcore_priv), GFP_KERNEL);
+	if (!tr->blkcore_priv)
+		return -ENOMEM;
+
+	memset(tr->blkcore_priv, 0, sizeof(*tr->blkcore_priv));
+
 	down(&mtd_table_mutex);
 
 	ret = register_blkdev(tr->major, tr->name);
 	if (ret) {
 		printk(KERN_WARNING "Unable to register %s block device on major %d: %d\n",
 		       tr->name, tr->major, ret);
+		kfree(tr->blkcore_priv);
 		up(&mtd_table_mutex);
 		return ret;
 	}
-	blk_init_queue(&mtd_blktrans_queue, mtd_blktrans_request, 
-		       &mtd_blktrans_queue_lock);
-
+	spin_lock_init(&tr->blkcore_priv->queue_lock);
 	init_completion(&tr->blkcore_priv->thread_dead);
 	init_waitqueue_head(&tr->blkcore_priv->thread_wq);
 
+	blk_init_queue(&tr->blkcore_priv->rq, mtd_blktrans_request, 
+		       &tr->blkcore_priv->queue_lock);
+	tr->blkcore_priv->rq.queuedata = tr;
+
 	ret = kernel_thread(mtd_blktrans_thread, tr, 
 			    CLONE_FS|CLONE_FILES|CLONE_SIGHAND);
 	if (ret < 0) {
-		blk_cleanup_queue(&mtd_blktrans_queue);
+		blk_cleanup_queue(&tr->blkcore_priv->rq);
 		unregister_blkdev(tr->major, tr->name);
+		kfree(tr->blkcore_priv);
+		up(&mtd_table_mutex);
 		return ret;
-       } 
+	} 
 
 	devfs_mk_dir(tr->name);
 
-	tr->usecount = 0;
 	INIT_LIST_HEAD(&tr->devs);
 	list_add(&tr->list, &blktrans_majors);
 
+	printk("%s:%s %d: count %d\n", __FILE__, __func__, __LINE__, atomic_read(&mtd_table_mutex.count));
+
 	for (i=0; i<MAX_MTD_DEVICES; i++) {
 		if (mtd_table[i] && mtd_table[i]->type != MTD_ABSENT)
 			tr->add_mtd(tr, mtd_table[i]);
@@ -492,12 +410,6 @@
 
 	down(&mtd_table_mutex);
 
-	if (tr->usecount) {
-		up(&mtd_table_mutex);
-		return -EBUSY;
-	}
-
-
 	/* Clean up the kernel thread */
 	tr->blkcore_priv->exiting = 1;
 	wake_up(&tr->blkcore_priv->thread_wq);
@@ -512,11 +424,13 @@
 	}
 
 	devfs_remove(tr->name);
-	blk_cleanup_queue(&mtd_blktrans_queue);
+	blk_cleanup_queue(&tr->blkcore_priv->rq);
 	unregister_blkdev(tr->major, tr->name);
 
 	up(&mtd_table_mutex);
 
+	kfree(tr->blkcore_priv);
+
 	if (!list_empty(&tr->devs))
 		BUG();
 	return 0;
@@ -531,6 +445,11 @@
 }
 
 module_exit(mtd_blktrans_exit);
+
+EXPORT_SYMBOL_GPL(register_mtd_blktrans);
+EXPORT_SYMBOL_GPL(deregister_mtd_blktrans);
+EXPORT_SYMBOL_GPL(add_mtd_blktrans_dev);
+EXPORT_SYMBOL_GPL(del_mtd_blktrans_dev);
 
 MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
 MODULE_LICENSE("GPL");


From dwmw2 at infradead.org  Tue May 20 21:01:35 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:22 2006
Subject: mtd/include/linux/mtd blktrans.h,1.3,1.4
Message-ID: <E19IHz5-0005Og-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv20742/include/linux/mtd

Modified Files:
	blktrans.h 
Log Message:
Remove unnecessary usecounts in dev and tr

Index: blktrans.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/blktrans.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- blktrans.h	20 May 2003 21:54:40 -0000	1.3
+++ blktrans.h	21 May 2003 01:01:32 -0000	1.4
@@ -22,12 +22,11 @@
 	struct list_head list;
 	struct mtd_info *mtd;
 	struct semaphore sem;
-	int usecount;
 	int devnum;
 	int blksize;
 	unsigned long size;
 	int readonly;
-	void *blkcore_priv;
+	void *blkcore_priv; /* gendisk in 2.5, devfs_handle in 2.4 */
 };
 
 struct blkcore_priv; /* Differs for 2.4 and 2.5 kernels; private */
@@ -63,7 +62,6 @@
 	struct list_head devs;
 	struct list_head list;
 	struct module *owner;
-	int usecount;
 
 	struct mtd_blkcore_priv *blkcore_priv;
 };


From dwmw2 at infradead.org  Tue May 20 21:01:36 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:23 2006
Subject: mtd/drivers/mtd mtd_blkdevs-24.c,1.5,1.6
Message-ID: <E19IHz6-0005Oj-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv20742/drivers/mtd

Modified Files:
	mtd_blkdevs-24.c 
Log Message:
Remove unnecessary usecounts in dev and tr

Index: mtd_blkdevs-24.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs-24.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- mtd_blkdevs-24.c	20 May 2003 21:52:08 -0000	1.5
+++ mtd_blkdevs-24.c	21 May 2003 01:01:33 -0000	1.6
@@ -231,13 +231,9 @@
 		goto out_tr;
 
 	dev->mtd->usecount++;
-	dev->usecount++;
-	tr->usecount++;
 
 	ret = 0;
 	if (tr->open && (ret = tr->open(dev, i, f))) {
-		tr->usecount--;
-		dev->usecount--;
 		dev->mtd->usecount--;
 		__MOD_DEC_USE_COUNT(dev->mtd->owner);
 	out_tr:
@@ -276,8 +272,6 @@
 		ret = tr->release(dev, i, f);
 
 	if (!ret) {
-		tr->usecount--;
-		dev->usecount--;
 		dev->mtd->usecount--;
 		__MOD_DEC_USE_COUNT(dev->mtd->owner);
 		__MOD_DEC_USE_COUNT(tr->owner);
@@ -308,11 +302,6 @@
 	   much the Linux block layer sucks? Sledgehammer approach... */
 	down(&mtd_table_mutex);
 
-	if (dev->usecount > 1) {
-		up(&mtd_table_mutex);
-		return -EBUSY;
-	}
-
 	for (i=0; i < (1<<tr->part_bits); i++) {
 		invalidate_device(MKDEV(tr->major, minor+i), 1);
 		gd->part[minor + i].start_sect = 0;
@@ -434,7 +423,6 @@
 	list_add_tail(&new->list, &tr->devs);
  added:
 	spin_unlock(&tr->blkcore_priv->devs_lock);
-	new->usecount = 0;
 
 	if (!tr->writesect)
 		new->readonly = 1;
@@ -483,8 +471,6 @@
 		BUG();
 	}
 
-	if (old->usecount)
-		return -EBUSY;
 #ifdef CONFIG_DEVFS_FS
 	devfs_unregister(old->blkcore_priv);
 #endif
@@ -576,6 +562,8 @@
 	if (ret < 0) {
 		blk_cleanup_queue(BLK_DEFAULT_QUEUE(tr->major));
 		devfs_unregister_blkdev(tr->major, tr->name);
+		kfree(tr->blkcore_priv);
+		up(&mtd_table_mutex);
 		return ret;
 	} 
 
@@ -596,7 +584,6 @@
 
 	add_gendisk(&tr->blkcore_priv->gd);
 
-	tr->usecount = 0;
 	INIT_LIST_HEAD(&tr->devs);
 	list_add(&tr->list, &blktrans_majors);
 
@@ -615,11 +602,6 @@
 
 	down(&mtd_table_mutex);
 
-	if (tr->usecount) {
-		up(&mtd_table_mutex);
-		return -EBUSY;
-	}
-
 	/* Clean up the kernel thread */
 	tr->blkcore_priv->exiting = 1;
 	wake_up(&tr->blkcore_priv->thread_wq);
@@ -633,14 +615,16 @@
 		struct mtd_blktrans_dev *dev = list_entry(this, struct mtd_blktrans_dev, list);
 		tr->remove_dev(dev);
 	}
-	blk_cleanup_queue(BLK_DEFAULT_QUEUE(tr->major));
+
+	devfs_unregister(tr->blkcore_priv->devfs_dir_handle);
+
 	blksize_size[tr->major] = NULL;
 	blk_size[tr->major] = NULL;
 
 	del_gendisk(&tr->blkcore_priv->gd);
 
+	blk_cleanup_queue(BLK_DEFAULT_QUEUE(tr->major));
 	devfs_unregister_blkdev(tr->major, tr->name);
-	devfs_unregister(tr->blkcore_priv->devfs_dir_handle);
 
 	up(&mtd_table_mutex);
 
@@ -660,6 +644,11 @@
 }
 
 module_exit(mtd_blktrans_exit);
+
+EXPORT_SYMBOL_GPL(register_mtd_blktrans);
+EXPORT_SYMBOL_GPL(deregister_mtd_blktrans);
+EXPORT_SYMBOL_GPL(add_mtd_blktrans_dev);
+EXPORT_SYMBOL_GPL(del_mtd_blktrans_dev);
 
 MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
 MODULE_LICENSE("GPL");


From dwmw2 at infradead.org  Wed May 21 03:53:46 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:23 2006
Subject: mtd/drivers/mtd mtd_blkdevs-24.c,1.6,1.7
Message-ID: <E19IOPy-0001XE-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv5881

Modified Files:
	mtd_blkdevs-24.c 
Log Message:
Don't register devfs subdir entries if there are partitions -- grok_partitions() seems to do that already

Index: mtd_blkdevs-24.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs-24.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- mtd_blkdevs-24.c	21 May 2003 01:01:33 -0000	1.6
+++ mtd_blkdevs-24.c	21 May 2003 07:53:43 -0000	1.7
@@ -444,11 +444,11 @@
 		grok_partitions(&tr->blkcore_priv->gd, new->devnum,
 				1 << tr->part_bits, new->size);
 	}
-#ifdef CONFIG_DEVFS_FS 
-	{
+#ifdef CONFIG_DEVFS_FS
+	if (!tr->part_bits) {
 		char name[2];
 
-		name[0] = (tr->part_bits?'a':'0')+new->devnum;
+		name[0] = '0' + new->devnum;
 		name[1] = 0;
 
 		new->blkcore_priv = 
@@ -472,7 +472,10 @@
 	}
 
 #ifdef CONFIG_DEVFS_FS
-	devfs_unregister(old->blkcore_priv);
+	if (!tr->part_bits) {
+		devfs_unregister(old->blkcore_priv);
+		old->blkcore_priv = NULL;
+	}
 #endif
 	spin_lock(&tr->blkcore_priv->devs_lock);
 	list_del(&old->list);
@@ -567,7 +570,8 @@
 		return ret;
 	} 
 
-	tr->blkcore_priv->devfs_dir_handle = devfs_mk_dir(NULL, tr->name, NULL);
+	tr->blkcore_priv->devfs_dir_handle = 
+			devfs_mk_dir(NULL, tr->name, NULL);
 
 	blksize_size[tr->major] = tr->blkcore_priv->blksizes;
 	blk_size[tr->major] = tr->blkcore_priv->sizes;
@@ -616,8 +620,6 @@
 		tr->remove_dev(dev);
 	}
 
-	devfs_unregister(tr->blkcore_priv->devfs_dir_handle);
-
 	blksize_size[tr->major] = NULL;
 	blk_size[tr->major] = NULL;
 
@@ -625,6 +627,8 @@
 
 	blk_cleanup_queue(BLK_DEFAULT_QUEUE(tr->major));
 	devfs_unregister_blkdev(tr->major, tr->name);
+
+	devfs_unregister(tr->blkcore_priv->devfs_dir_handle);
 
 	up(&mtd_table_mutex);
 


From dwmw2 at infradead.org  Wed May 21 04:03:44 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:23 2006
Subject: mtd/drivers/mtd mtd_blkdevs-24.c,1.7,1.8
Message-ID: <E19IOZc-0001Z0-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv5991

Modified Files:
	mtd_blkdevs-24.c 
Log Message:
devfs_unregister_partitions on exit

Index: mtd_blkdevs-24.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs-24.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- mtd_blkdevs-24.c	21 May 2003 07:53:43 -0000	1.7
+++ mtd_blkdevs-24.c	21 May 2003 08:03:42 -0000	1.8
@@ -475,6 +475,9 @@
 	if (!tr->part_bits) {
 		devfs_unregister(old->blkcore_priv);
 		old->blkcore_priv = NULL;
+	} else {
+		devfs_register_partitions(&tr->blkcore_priv->gd,
+					  old->devnum << tr->part_bits, 1);
 	}
 #endif
 	spin_lock(&tr->blkcore_priv->devs_lock);
@@ -487,7 +490,7 @@
 		tr->blkcore_priv->part_table[i].nr_sects = 0;
 		tr->blkcore_priv->part_table[i].start_sect = 0;
 	}
-		
+
 	return 0;
 }
 


From dwmw2 at infradead.org  Wed May 21 05:58:16 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:23 2006
Subject: mtd/drivers/mtd mtdcore.c,1.37,1.38
Message-ID: <E19IQMS-000366-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv11887

Modified Files:
	mtdcore.c 
Log Message:
Kill compatmac.h, include init.h


Index: mtdcore.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdcore.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- mtdcore.c	20 May 2003 15:37:41 -0000	1.37
+++ mtdcore.c	21 May 2003 09:58:13 -0000	1.38
@@ -17,7 +17,7 @@
 #include <linux/major.h>
 #include <linux/fs.h>
 #include <linux/ioctl.h>
-#include <linux/mtd/compatmac.h>
+#include <linux/init.h>
 #ifdef CONFIG_PROC_FS
 #include <linux/proc_fs.h>
 #endif


From dwmw2 at infradead.org  Wed May 21 06:39:28 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:23 2006
Subject: mtd/drivers/mtd redboot.c,1.10,1.11
Message-ID: <E19IR0K-0003Hq-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv12615

Modified Files:
	redboot.c 
Log Message:
Add missing init.h


Index: redboot.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/redboot.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- redboot.c	19 May 2003 14:22:41 -0000	1.10
+++ redboot.c	21 May 2003 10:39:26 -0000	1.11
@@ -7,6 +7,7 @@
 
 #include <linux/kernel.h>
 #include <linux/slab.h>
+#include <linux/init.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>


From dwmw2 at infradead.org  Wed May 21 06:49:41 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:23 2006
Subject: mtd/drivers/mtd mtdblock.c,1.60,1.61
Message-ID: <E19IRAD-0003qC-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv14745

Modified Files:
	mtdblock.c 
Log Message:
Add missing fs.h, init.h


Index: mtdblock.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdblock.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- mtdblock.c	20 May 2003 20:39:48 -0000	1.60
+++ mtdblock.c	21 May 2003 10:49:38 -0000	1.61
@@ -11,6 +11,8 @@
 #include <linux/types.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/fs.h>
+#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/mtd/mtd.h>


From dwmw2 at infradead.org  Wed May 21 06:49:50 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:23 2006
Subject: mtd/drivers/mtd ftl.c,1.49,1.50
Message-ID: <E19IRAM-0003qM-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv14771

Modified Files:
	ftl.c 
Log Message:
add missing init.h

Index: ftl.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/ftl.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- ftl.c	20 May 2003 20:40:07 -0000	1.49
+++ ftl.c	21 May 2003 10:49:47 -0000	1.50
@@ -68,7 +68,7 @@
 #include <linux/timer.h>
 #include <linux/major.h>
 #include <linux/fs.h>
-#include <linux/ioctl.h>
+#include <linux/init.h>
 #include <linux/hdreg.h>
 #include <linux/vmalloc.h>
 #include <linux/blkpg.h>


From dwmw2 at infradead.org  Wed May 21 06:50:45 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:23 2006
Subject: mtd/drivers/mtd mtdchar.c,1.53,1.54
Message-ID: <E19IRBF-0003rP-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv14837

Modified Files:
	mtdchar.c 
Log Message:
Clean up devfs ifdefs a little

Index: mtdchar.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdchar.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- mtdchar.c	20 May 2003 21:50:03 -0000	1.53
+++ mtdchar.c	21 May 2003 10:50:43 -0000	1.54
@@ -2,7 +2,6 @@
  * $Id$
  *
  * Character-device access to raw MTD devices.
- * Pure 2.4 version - compatibility cruft removed to mtdchar-compat.c
  *
  */
 
@@ -462,12 +461,12 @@
 
 static struct file_operations mtd_fops = {
 	.owner		= THIS_MODULE,
-	.llseek		= mtd_lseek,	/* lseek */
-	.read		= mtd_read,	/* read */
-	.write		= mtd_write,	/* write */
-	.ioctl		= mtd_ioctl,	/* ioctl */
-	.open		= mtd_open,	/* open */
-	.release	= mtd_close,	/* release */
+	.llseek		= mtd_lseek,
+	.read		= mtd_read,
+	.write		= mtd_write,
+	.ioctl		= mtd_ioctl,
+	.open		= mtd_open,
+	.release	= mtd_close,
 };
 
 
@@ -507,26 +506,18 @@
 
 static int __init init_mtdchar(void)
 {
-#ifdef CONFIG_DEVFS_FS
-	if (devfs_register_chrdev(MTD_CHAR_MAJOR, "mtd", &mtd_fops))
+	if (register_chrdev(MTD_CHAR_MAJOR, "mtd", &mtd_fops))
 	{
 		printk(KERN_NOTICE "Can't allocate major number %d for Memory Technology Devices.\n",
 		       MTD_CHAR_MAJOR);
 		return -EAGAIN;
 	}
 
+#ifdef CONFIG_DEVFS_FS
 	devfs_dir_handle = devfs_mk_dir(NULL, "mtd", NULL);
 
 	register_mtd_user(&notifier);
-#else
-	if (register_chrdev(MTD_CHAR_MAJOR, "mtd", &mtd_fops))
-	{
-		printk(KERN_NOTICE "Can't allocate major number %d for Memory Technology Devices.\n",
-		       MTD_CHAR_MAJOR);
-		return -EAGAIN;
-	}
 #endif
-
 	return 0;
 }
 
@@ -535,10 +526,8 @@
 #ifdef CONFIG_DEVFS_FS
 	unregister_mtd_user(&notifier);
 	devfs_unregister(devfs_dir_handle);
-	devfs_unregister_chrdev(MTD_CHAR_MAJOR, "mtd");
-#else
-	unregister_chrdev(MTD_CHAR_MAJOR, "mtd");
 #endif
+	unregister_chrdev(MTD_CHAR_MAJOR, "mtd");
 }
 
 module_init(init_mtdchar);


From dwmw2 at infradead.org  Wed May 21 06:54:12 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:23 2006
Subject: mtd/drivers/mtd nftlmount.c,1.33,1.34
Message-ID: <E19IREa-0003sT-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv14886

Modified Files:
	nftlmount.c 
Log Message:
#include cleanup


Index: nftlmount.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nftlmount.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- nftlmount.c	18 May 2003 22:29:47 -0000	1.33
+++ nftlmount.c	21 May 2003 10:54:10 -0000	1.34
@@ -21,22 +21,13 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define __NO_VERSION__
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <asm/errno.h>
-#include <asm/io.h>
-#include <asm/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/pci.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-#include <linux/sched.h>
-#include <linux/init.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/nftl.h>
-#include <linux/mtd/compatmac.h>
 
 #define SECTORSIZE 512
 


From dwmw2 at infradead.org  Wed May 21 07:42:10 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:23 2006
Subject: mtd/include/linux/mtd map.h,1.31,1.32
Message-ID: <E19IRz0-0004Vy-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv17345/include/linux/mtd

Modified Files:
	map.h 
Log Message:
Take map_destroy() out of line, fix up module count stuff for 2.5


Index: map.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/map.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- map.h	16 May 2003 18:53:42 -0000	1.31
+++ map.h	21 May 2003 11:42:07 -0000	1.32
@@ -80,24 +80,7 @@
 void unregister_mtd_chip_driver(struct mtd_chip_driver *);
 
 struct mtd_info *do_map_probe(const char *name, struct map_info *map);
-
-
-/*
- * Destroy an MTD device which was created for a map device.
- * Make sure the MTD device is already unregistered before calling this
- */
-static inline void map_destroy(struct mtd_info *mtd)
-{
-	struct map_info *map = mtd->priv;
-
-	if (map->fldrv->destroy)
-		map->fldrv->destroy(mtd);
-#ifdef CONFIG_MODULES
-	if (map->fldrv->module)
-		__MOD_DEC_USE_COUNT(map->fldrv->module);
-#endif
-	kfree(mtd);
-}
+void map_destroy(struct mtd_info *mtd);
 
 #define ENABLE_VPP(map) do { if(map->set_vpp) map->set_vpp(map, 1); } while(0)
 #define DISABLE_VPP(map) do { if(map->set_vpp) map->set_vpp(map, 0); } while(0)


From dwmw2 at infradead.org  Wed May 21 07:42:10 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:23 2006
Subject: mtd/drivers/mtd/chips chipreg.c,1.13,1.14
Message-ID: <E19IRz0-0004Vz-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv17345/drivers/mtd/chips

Modified Files:
	chipreg.c 
Log Message:
Take map_destroy() out of line, fix up module count stuff for 2.5


Index: chipreg.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/chipreg.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- chipreg.c	21 Feb 2002 08:26:58 -0000	1.13
+++ chipreg.c	21 May 2003 11:42:06 -0000	1.14
@@ -9,7 +9,6 @@
 #include <linux/config.h>
 #include <linux/kmod.h>
 #include <linux/spinlock.h>
-#include <linux/mtd/compatmac.h>
 #include <linux/mtd/map.h>
 
 spinlock_t chip_drvs_lock = SPIN_LOCK_UNLOCKED;
@@ -44,10 +43,8 @@
 			break;
 		}
 	}
-	if (ret && !try_inc_mod_count(ret->module)) {
-		/* Eep. Failed. */
+	if (ret && !try_module_get(ret->module))
 		ret = NULL;
-	}
 
 	spin_unlock(&chip_drvs_lock);
 
@@ -71,25 +68,39 @@
 		return NULL;
 
 	ret = drv->probe(map);
-#ifdef CONFIG_MODULES
+
 	/* We decrease the use count here. It may have been a 
 	   probe-only module, which is no longer required from this
 	   point, having given us a handle on (and increased the use
 	   count of) the actual driver code.
 	*/
-	if(drv->module)
-		__MOD_DEC_USE_COUNT(drv->module);
-#endif
+	module_put(drv->module);
 
 	if (ret)
 		return ret;
 	
 	return NULL;
 }
+/*
+ * Destroy an MTD device which was created for a map device.
+ * Make sure the MTD device is already unregistered before calling this
+ */
+void map_destroy(struct mtd_info *mtd)
+{
+	struct map_info *map = mtd->priv;
+
+	if (map->fldrv->destroy)
+		map->fldrv->destroy(mtd);
+
+	module_put(map->fldrv->module);
+
+	kfree(mtd);
+}
 
 EXPORT_SYMBOL(register_mtd_chip_driver);
 EXPORT_SYMBOL(unregister_mtd_chip_driver);
 EXPORT_SYMBOL(do_map_probe);
+EXPORT_SYMBOL(map_destroy);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");


From dwmw2 at infradead.org  Wed May 21 07:45:56 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:23 2006
Subject: mtd/drivers/mtd/chips cfi_cmdset_0001.c,1.117,1.118
 cfi_cmdset_0002.c,1.70,1.71 cfi_cmdset_0020.c,1.2,1.3
Message-ID: <E19IS2e-0004WT-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv17383

Modified Files:
	cfi_cmdset_0001.c cfi_cmdset_0002.c cfi_cmdset_0020.c 
Log Message:
2.5 module counts

Index: cfi_cmdset_0001.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0001.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -r1.117 -r1.118
--- cfi_cmdset_0001.c	14 May 2003 15:05:12 -0000	1.117
+++ cfi_cmdset_0001.c	21 May 2003 11:45:53 -0000	1.118
@@ -288,8 +288,8 @@
 	mtd->resume = cfi_intelext_resume;
 	mtd->flags = MTD_CAP_NORFLASH;
 	map->fldrv = &cfi_intelext_chipdrv;
-	MOD_INC_USE_COUNT;
 	mtd->name = map->name;
+	__module_get(THIS_MODULE);
 	return mtd;
 
  setup_err:

Index: cfi_cmdset_0002.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0002.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- cfi_cmdset_0002.c	14 May 2003 15:05:12 -0000	1.70
+++ cfi_cmdset_0002.c	21 May 2003 11:45:53 -0000	1.71
@@ -272,7 +272,7 @@
 	mtd->flags = MTD_CAP_NORFLASH;
 	map->fldrv = &cfi_amdstd_chipdrv;
 	mtd->name = map->name;
-	MOD_INC_USE_COUNT;
+	__module_get(THIS_MODULE);
 	return mtd;
 
  setup_err:

Index: cfi_cmdset_0020.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0020.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- cfi_cmdset_0020.c	14 May 2003 15:05:13 -0000	1.2
+++ cfi_cmdset_0020.c	21 May 2003 11:45:53 -0000	1.3
@@ -172,9 +172,6 @@
 		cfi->chips[i].erase_time = 1024;
 	}		
 
-	map->fldrv = &cfi_staa_chipdrv;
-	MOD_INC_USE_COUNT;
-	
 	/* Make sure it's in read mode */
 	cfi_send_gen_cmd(0xff, 0x55, base, map, cfi, cfi->device_type, NULL);
 	return cfi_staa_setup(map);
@@ -256,7 +253,7 @@
 	mtd->flags |= MTD_ECC; /* FIXME: Not all STMicro flashes have this */
 	mtd->eccsize = 8; /* FIXME: Should be 0 for STMicro flashes w/out ECC */
 	map->fldrv = &cfi_staa_chipdrv;
-	MOD_INC_USE_COUNT;
+	__module_get(THIS_MODULE);
 	mtd->name = map->name;
 	return mtd;
 }


From dwmw2 at infradead.org  Wed May 21 07:50:39 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:23 2006
Subject: mtd/drivers/mtd/chips jedec.c,1.15,1.16
Message-ID: <E19IS7D-0004Xv-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv17455

Modified Files:
	jedec.c 
Log Message:
Fix includes


Index: jedec.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/jedec.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- jedec.c	14 May 2003 15:05:13 -0000	1.15
+++ jedec.c	21 May 2003 11:50:36 -0000	1.16
@@ -14,7 +14,12 @@
  * $Id$
  */
 
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
 #include <linux/mtd/jedec.h>
+#include <linux/mtd/map.h>
+#include <linux/mtd/mtd.h>
 
 static struct mtd_info *jedec_probe(struct map_info *);
 static int jedec_probe8(struct map_info *map,unsigned long base,


From dwmw2 at infradead.org  Wed May 21 07:51:04 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:24 2006
Subject: mtd/include/linux/mtd jedec.h,1.2,1.3
Message-ID: <E19IS7c-0004Yx-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv17517

Modified Files:
	jedec.h 
Log Message:
include cleanup


Index: jedec.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/jedec.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jedec.h	6 Nov 2001 14:37:36 -0000	1.2
+++ jedec.h	21 May 2003 11:51:01 -0000	1.3
@@ -14,7 +14,6 @@
 #define __LINUX_MTD_JEDEC_H__
 
 #include <linux/types.h>
-#include <linux/mtd/map.h>
 
 #define MAX_JEDEC_CHIPS 16
 


From dwmw2 at infradead.org  Wed May 21 08:45:23 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:24 2006
Subject: mtd/drivers/mtd/maps amd76xrom.c,1.6,1.7 arctic-mtd.c,1.7,1.8
 autcpu12-nvram.c,1.4,1.5 beech-mtd.c,1.6,1.7 cdb89712.c,1.6,1.7
 ceiva.c,1.7,1.8 cfi_flagadm.c,1.10,1.11 cstm_mips_ixx.c,1.8,1.9
 dbox2-flash.c,1.8,1.9 dc21285.c,1.14,1.15 dilnetpc.c,1.11,1.12
 ebony.c,1.6,1.7 edb7312.c,1.7,1.8 epxa10db-flash.c,1.9,1.10
 fortunet.c,1.5,1.6 h720x-flash.c,1.5,1.6 ich2rom.c,1.6,1.7
 impa7.c,1.7,1.8 iq80310.c,1.14,1.15 l440gx.c,1.11,1.12
 lasat.c,1.4,1.5 lubbock-flash.c,1.7,1.8 mbx860.c,1.4,1.5
 netsc520.c,1.8,1.9 nora.c,1.23,1.24 ocelot.c,1.11,1.12
 pb1xxx-flash.c,1.7,1.8 pcmciamtd.c,1.43,1.44 physmap.c,1.26,1.27
 pnc2000.c,1.13,1.14 redwood.c,1.5,1.6 rpxlite.c,1.18,1.19
 sa1100-flash.c,1.34,1.35 sc520cdp.c,1.14,1.15 scb2_flash.c,1.5,1.6
 scx200_docflash.c,1.4,1.5 solutionengine.c,1.9,1.10
 tqm8xxl.c,1.7,1.8 tsunami_flash.c,1.4,1.5
Message-ID: <E19ISyB-0005Fv-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv20201

Modified Files:
	amd76xrom.c arctic-mtd.c autcpu12-nvram.c beech-mtd.c 
	cdb89712.c ceiva.c cfi_flagadm.c cstm_mips_ixx.c dbox2-flash.c 
	dc21285.c dilnetpc.c ebony.c edb7312.c epxa10db-flash.c 
	fortunet.c h720x-flash.c ich2rom.c impa7.c iq80310.c l440gx.c 
	lasat.c lubbock-flash.c mbx860.c netsc520.c nora.c ocelot.c 
	pb1xxx-flash.c pcmciamtd.c physmap.c pnc2000.c redwood.c 
	rpxlite.c sa1100-flash.c sc520cdp.c scb2_flash.c 
	scx200_docflash.c solutionengine.c tqm8xxl.c tsunami_flash.c 
Log Message:
add init.h

Index: amd76xrom.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/amd76xrom.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- amd76xrom.c	20 May 2003 20:59:29 -0000	1.6
+++ amd76xrom.c	21 May 2003 12:45:17 -0000	1.7
@@ -8,6 +8,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: arctic-mtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/arctic-mtd.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- arctic-mtd.c	20 May 2003 20:59:29 -0000	1.7
+++ arctic-mtd.c	21 May 2003 12:45:17 -0000	1.8
@@ -35,6 +35,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/types.h>
+#include <linux/init.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: autcpu12-nvram.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/autcpu12-nvram.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- autcpu12-nvram.c	20 May 2003 20:59:29 -0000	1.4
+++ autcpu12-nvram.c	21 May 2003 12:45:18 -0000	1.5
@@ -24,6 +24,7 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/ioport.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <asm/sizes.h>
 #include <asm/hardware.h>

Index: beech-mtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/beech-mtd.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- beech-mtd.c	20 May 2003 20:59:29 -0000	1.6
+++ beech-mtd.c	21 May 2003 12:45:18 -0000	1.7
@@ -31,6 +31,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/types.h>
+#include <linux/init.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: cdb89712.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/cdb89712.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- cdb89712.c	20 May 2003 20:59:29 -0000	1.6
+++ cdb89712.c	21 May 2003 12:45:18 -0000	1.7
@@ -8,6 +8,7 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/ioport.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <linux/mtd/mtd.h>

Index: ceiva.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ceiva.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ceiva.c	20 May 2003 20:59:29 -0000	1.7
+++ ceiva.c	21 May 2003 12:45:18 -0000	1.8
@@ -19,6 +19,7 @@
 #include <linux/types.h>
 #include <linux/ioport.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: cfi_flagadm.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/cfi_flagadm.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- cfi_flagadm.c	20 May 2003 20:59:29 -0000	1.10
+++ cfi_flagadm.c	21 May 2003 12:45:18 -0000	1.11
@@ -27,6 +27,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: cstm_mips_ixx.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/cstm_mips_ixx.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- cstm_mips_ixx.c	20 May 2003 20:59:29 -0000	1.8
+++ cstm_mips_ixx.c	21 May 2003 12:45:18 -0000	1.9
@@ -33,6 +33,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: dbox2-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dbox2-flash.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- dbox2-flash.c	20 May 2003 20:59:29 -0000	1.8
+++ dbox2-flash.c	21 May 2003 12:45:18 -0000	1.9
@@ -7,6 +7,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: dc21285.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dc21285.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- dc21285.c	20 May 2003 20:59:29 -0000	1.14
+++ dc21285.c	21 May 2003 12:45:18 -0000	1.15
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: dilnetpc.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dilnetpc.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- dilnetpc.c	20 May 2003 20:59:29 -0000	1.11
+++ dilnetpc.c	21 May 2003 12:45:18 -0000	1.12
@@ -29,6 +29,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: ebony.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ebony.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ebony.c	20 May 2003 20:59:29 -0000	1.6
+++ ebony.c	21 May 2003 12:45:18 -0000	1.7
@@ -16,6 +16,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/partitions.h>

Index: edb7312.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/edb7312.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- edb7312.c	20 May 2003 20:59:29 -0000	1.7
+++ edb7312.c	21 May 2003 12:45:18 -0000	1.8
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: epxa10db-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/epxa10db-flash.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- epxa10db-flash.c	20 May 2003 20:59:30 -0000	1.9
+++ epxa10db-flash.c	21 May 2003 12:45:18 -0000	1.10
@@ -26,6 +26,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: fortunet.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/fortunet.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- fortunet.c	20 May 2003 20:59:30 -0000	1.5
+++ fortunet.c	21 May 2003 12:45:18 -0000	1.6
@@ -6,6 +6,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: h720x-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/h720x-flash.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- h720x-flash.c	20 May 2003 20:59:30 -0000	1.5
+++ h720x-flash.c	21 May 2003 12:45:18 -0000	1.6
@@ -10,6 +10,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: ich2rom.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ich2rom.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ich2rom.c	20 May 2003 20:59:30 -0000	1.6
+++ ich2rom.c	21 May 2003 12:45:18 -0000	1.7
@@ -8,6 +8,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: impa7.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/impa7.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- impa7.c	20 May 2003 20:59:30 -0000	1.7
+++ impa7.c	21 May 2003 12:45:18 -0000	1.8
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: iq80310.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/iq80310.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- iq80310.c	20 May 2003 20:59:30 -0000	1.14
+++ iq80310.c	21 May 2003 12:45:19 -0000	1.15
@@ -14,6 +14,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: l440gx.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/l440gx.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- l440gx.c	20 May 2003 20:59:30 -0000	1.11
+++ l440gx.c	21 May 2003 12:45:19 -0000	1.12
@@ -9,6 +9,7 @@
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: lasat.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/lasat.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- lasat.c	20 May 2003 20:59:30 -0000	1.4
+++ lasat.c	21 May 2003 12:45:19 -0000	1.5
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: lubbock-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/lubbock-flash.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- lubbock-flash.c	20 May 2003 20:59:30 -0000	1.7
+++ lubbock-flash.c	21 May 2003 12:45:19 -0000	1.8
@@ -14,6 +14,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: mbx860.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/mbx860.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- mbx860.c	20 May 2003 20:59:30 -0000	1.4
+++ mbx860.c	21 May 2003 12:45:19 -0000	1.5
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: netsc520.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/netsc520.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- netsc520.c	20 May 2003 20:59:30 -0000	1.8
+++ netsc520.c	21 May 2003 12:45:19 -0000	1.9
@@ -27,6 +27,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: nora.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/nora.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- nora.c	20 May 2003 20:59:30 -0000	1.23
+++ nora.c	21 May 2003 12:45:19 -0000	1.24
@@ -7,6 +7,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: ocelot.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ocelot.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ocelot.c	20 May 2003 20:59:30 -0000	1.11
+++ ocelot.c	21 May 2003 12:45:19 -0000	1.12
@@ -7,6 +7,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: pb1xxx-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pb1xxx-flash.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- pb1xxx-flash.c	20 May 2003 20:59:31 -0000	1.7
+++ pb1xxx-flash.c	21 May 2003 12:45:19 -0000	1.8
@@ -10,6 +10,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: pcmciamtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pcmciamtd.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- pcmciamtd.c	20 May 2003 20:59:31 -0000	1.43
+++ pcmciamtd.c	21 May 2003 12:45:19 -0000	1.44
@@ -14,6 +14,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/timer.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <asm/system.h>
 

Index: physmap.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/physmap.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- physmap.c	20 May 2003 20:59:31 -0000	1.26
+++ physmap.c	21 May 2003 12:45:19 -0000	1.27
@@ -7,6 +7,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: pnc2000.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pnc2000.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- pnc2000.c	20 May 2003 20:59:31 -0000	1.13
+++ pnc2000.c	21 May 2003 12:45:19 -0000	1.14
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: redwood.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/redwood.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- redwood.c	20 May 2003 20:59:31 -0000	1.5
+++ redwood.c	21 May 2003 12:45:19 -0000	1.6
@@ -18,6 +18,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: rpxlite.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/rpxlite.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- rpxlite.c	20 May 2003 20:59:31 -0000	1.18
+++ rpxlite.c	21 May 2003 12:45:19 -0000	1.19
@@ -7,6 +7,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: sa1100-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sa1100-flash.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- sa1100-flash.c	20 May 2003 20:59:31 -0000	1.34
+++ sa1100-flash.c	21 May 2003 12:45:19 -0000	1.35
@@ -11,6 +11,7 @@
 #include <linux/types.h>
 #include <linux/ioport.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: sc520cdp.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sc520cdp.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- sc520cdp.c	20 May 2003 20:59:31 -0000	1.14
+++ sc520cdp.c	21 May 2003 12:45:20 -0000	1.15
@@ -29,6 +29,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: scb2_flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/scb2_flash.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- scb2_flash.c	20 May 2003 20:59:32 -0000	1.5
+++ scb2_flash.c	21 May 2003 12:45:20 -0000	1.6
@@ -48,6 +48,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: scx200_docflash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/scx200_docflash.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- scx200_docflash.c	20 May 2003 20:59:32 -0000	1.4
+++ scx200_docflash.c	21 May 2003 12:45:20 -0000	1.5
@@ -11,6 +11,7 @@
 #include <linux/config.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: solutionengine.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/solutionengine.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- solutionengine.c	20 May 2003 20:59:32 -0000	1.9
+++ solutionengine.c	21 May 2003 12:45:20 -0000	1.10
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: tqm8xxl.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/tqm8xxl.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- tqm8xxl.c	20 May 2003 20:59:32 -0000	1.7
+++ tqm8xxl.c	21 May 2003 12:45:20 -0000	1.8
@@ -26,6 +26,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 
 #include <linux/mtd/mtd.h>

Index: tsunami_flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/tsunami_flash.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- tsunami_flash.c	20 May 2003 20:59:32 -0000	1.4
+++ tsunami_flash.c	21 May 2003 12:45:20 -0000	1.5
@@ -6,6 +6,7 @@
  */
 #include <asm/io.h>
 #include <asm/core_tsunami.h>
+#include <linux/init.h>
 #include <linux/mtd/map.h>
 
 #define FLASH_ENABLE_PORT 0x00C00001


From dwmw2 at infradead.org  Wed May 21 08:58:01 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:24 2006
Subject: mtd/drivers/mtd Makefile-2.4,NONE,1.1 Makefile-2.5,NONE,1.1
 defconfig,NONE,1.1 GNUmakefile,1.13,1.14 Makefile,1.72,1.73
Message-ID: <E19ITAP-0005Lz-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv20560

Modified Files:
	GNUmakefile Makefile 
Added Files:
	Makefile-2.4 Makefile-2.5 defconfig 
Log Message:
Update to build in 2.5 too

***** Error reading new file: [Errno 2] No such file or directory: 'Makefile-2.4'
***** Error reading new file: [Errno 2] No such file or directory: 'Makefile-2.5'
***** Error reading new file: [Errno 2] No such file or directory: 'defconfig'
Index: GNUmakefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/GNUmakefile,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- GNUmakefile	14 May 2003 15:05:11 -0000	1.13
+++ GNUmakefile	21 May 2003 12:57:58 -0000	1.14
@@ -4,64 +4,28 @@
 
 ifndef VERSION
 
-# Someone just typed 'make'
-CONFIG_MTD_COMPLEX_MAPPINGS := y
-EXTRA_CFLAGS += -DCONFIG_MTD_COMPLEX_MAPPINGS=1
+# Someone just typed 'make'. Invoke the kernel makefiles properly...
 
 export CONFIG_MTD_COMPLEX_MAPPINGS EXTRA_CFLAGS
 
 modules:
-	make -C $(LINUXDIR) SUBDIRS=`pwd` EXTRA_CFLAGS=-DCONFIG_MTD_COMPLEX_MAPPINGS=1 modules
+	make -C $(LINUXDIR) SUBDIRS=`pwd` modules
+
+simplemap:
+	make -C $(LINUXDIR) SUBDIRS=`pwd` SIMPLEMAP=1 modules
 
 dep:
 	make -C $(LINUXDIR) SUBDIRS=`pwd` dep
 
 clean:
-	rm -f *.o */*.o
+	rm -f `find . -name \*.ko` `find . -name \*.o`
 
 else
 
+# 2.5 explicitly states <subdir>/Makefile rather than using recursive make,
+# so we handle all that in there...
 
-
-ifndef CONFIG_MTD
-
-# We're being invoked outside a normal kernel build. Fake it
-
-# We add to $CC rather than setting EXTRA_CFLAGS because the local 
-# header files _must_ appear before the in-kernel ones. 
-CC += -I$(shell pwd)/../../include
-
-CONFIG_MTD := m
-CONFIG_MTD_PARTITIONS := m
-CONFIG_MTD_REDBOOT_PARTS := m
-CONFIG_MTD_AFS_PARTS := m
-CONFIG_MTD_CHAR := m
-CONFIG_MTD_BLOCK := m
-CONFIG_FTL := m
-CONFIG_NFTL := m
-
-CFLAGS_nftlcore.o := -DCONFIG_NFTL_RW
-CFLAGS_nftlmount.o := -DCONFIG_NFTL_RW
-
-endif
-
-# Normal case - build in-kernel
-
-ifeq ($(VERSION),2)
- ifneq ($(PATCHLEVEL),4)
-  ifneq ($(PATCHLEVEL),5)
-   OLDTOPDIR := $(TOPDIR)
-   TOPDIR := $(shell pwd)
-  endif
- endif
-endif
-
-ifeq ($(VERSION),2)
- ifeq ($(PATCHLEVEL),0)
-   obj-y += initcalls.o
-  endif
-endif
-
+obj := $(shell pwd)
 include Makefile
 
 endif

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/Makefile,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- Makefile	20 May 2003 13:10:03 -0000	1.72
+++ Makefile	21 May 2003 12:57:58 -0000	1.73
@@ -1,76 +1,25 @@
-#
-# Makefile for the memory technology device drivers.
-#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
-#
-# Note 2! The CFLAGS definitions are now inherited from the
-# parent makes..
-#
 # $Id$
 
-export-objs	:= mtdcore.o mtdpart.o redboot.o cmdlinepart.o afs.o mtdconcat.o
+# Munge the kernel build environment to suit our needs....
 
-nftl-objs	:= nftlcore.o nftlmount.o
-mtdblock-objs	:= mtdblock-core.o
+include $(obj)/defconfig
 
-BELOW25		:= $(shell echo $(PATCHLEVEL) | sed s/[1234]/y/)
+# This must be first in the include path, so it goes in $(CC) rather
+# then $(EXTRA_CFLAGS)
 
+CC += -I$(obj)/../../include
+EXTRA_CFLAGS := -g -DMTD_OUT_OF_TREE #-Werror
 
-#                       *** BIG UGLY NOTE ***
-#
-# The shiny new inter_module_xxx has introduced yet another ugly link
-# order dependency, which I'd previously taken great care to avoid.
-# We now have to ensure that the chip drivers are initialised before the
-# map drivers, and that the doc200[01] drivers are initialised before
-# docprobe.
-#
-# We'll hopefully merge the doc200[01] drivers and docprobe back into
-# a single driver some time soon, but the CFI drivers are going to have
-# to stay like that.
-#
-# Urgh.
-# 
-# dwmw2 21/11/0
-
-# Core functionality.
-obj-$(CONFIG_MTD)		+= mtdcore.o
-obj-$(CONFIG_MTD_CONCAT)	+= mtdconcat.o
-obj-$(CONFIG_MTD_PARTITIONS)	+= mtdpart.o
-obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o
-obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o
-obj-$(CONFIG_MTD_AFS_PARTS)	+= afs.o
-
-# 'Users' - code which presents functionality to userspace.
-obj-$(CONFIG_MTD_CHAR)		+= mtdchar.o
-obj-$(CONFIG_MTD_BLOCK)		+= mtdblock.o $(mtd_blkdevs)
-obj-$(CONFIG_MTD_BLOCK_RO)	+= mtdblock_ro.o $(mtd_blkdevs)
-obj-$(CONFIG_FTL)		+= ftl.o $(mtd_blkdevs)
-obj-$(CONFIG_NFTL)		+= nftl.o $(mtd_blkdevs)
-
-ifeq ($(BELOW25),y)
-obj-y           += chips/chipslink.o maps/mapslink.o \
-			devices/devlink.o nand/nandlink.o
-
-O_TARGET	:= mtdlink.o
-
-list-multi	:= nftl.o mtdblock.o
-
-mod-subdirs	:= 
-subdir-y	:= chips maps devices nand
-subdir-m	:= $(subdir-y)
-mtd_blkdevs	+= mtd_blkdevs-24.o
-else
-obj-y           += chips/ maps/ devices/ nand/
-mtd_blkdevs	+= mtd_blkdevs.o
+ifdef SIMPLEMAP
+EXTRA_CFLAGS += -DSIMPLEMAP
 endif
 
--include $(TOPDIR)/Rules.make
-
-# below 2.5 only
-ifeq ($(BELOW25),y)
-nftl.o: $(nftl-objs)
-	$(LD) -r -o $@ $(nftl-objs)
+# We know, but not quite yet...
+CFLAGS_nftlcore.o := -Wno-error
+CFLAGS_nftlmount.o := -Wno-error
 
+ifeq ($(PATCHLEVEL),5)
+include $(obj)/Makefile-2.5
+else
+include $(obj)/Makefile-2.4
 endif


From dwmw2 at infradead.org  Wed May 21 08:58:59 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:24 2006
Subject: mtd/include/linux config.h,NONE,1.1
Message-ID: <E19ITBL-0005NB-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux
In directory phoenix.infradead.org:/tmp/cvs-serv20635

Added Files:
	config.h 
Log Message:
config.h to avoid makefile hackery

***** Error reading new file: [Errno 2] No such file or directory: 'config.h'

From dwmw2 at infradead.org  Wed May 21 09:18:24 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:24 2006
Subject: mtd/drivers/mtd nftlcore.c,1.89,1.90
Message-ID: <E19ITU8-0005R3-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv20874

Modified Files:
	nftlcore.c 
Log Message:
Fix readonly build


Index: nftlcore.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nftlcore.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -r1.89 -r1.90
--- nftlcore.c	18 May 2003 22:29:47 -0000	1.89
+++ nftlcore.c	21 May 2003 13:18:21 -0000	1.90
@@ -737,7 +737,9 @@
 	.part_bits	= NFTL_PARTN_BITS,
 	.ioctl		= nftl_ioctl,
 	.readsect	= nftl_readblock,
+#ifdef CONFIG_NFTL_RW
 	.writesect	= nftl_writeblock,
+#endif
 	.add_mtd	= nftl_add_mtd,
 	.remove_dev	= nftl_remove_dev,
 	.owner		= THIS_MODULE,


From dwmw2 at infradead.org  Wed May 21 11:01:08 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:24 2006
Subject: mtd/include/linux config.h,1.1,1.2
Message-ID: <E19IV5Y-0006sX-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux
In directory phoenix.infradead.org:/tmp/cvs-serv26439

Modified Files:
	config.h 
Log Message:
cfi geometry defines

Index: config.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/config.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- config.h	21 May 2003 12:58:56 -0000	1.1
+++ config.h	21 May 2003 15:01:06 -0000	1.2
@@ -20,6 +20,17 @@
 #define CONFIG_MTD_PHYSMAP_LEN 0x4000000
 #define CONFIG_MTD_PHYSMAP_BUSWIDTH 2
 
+#define CONFIG_MTDRAM_TOTAL_SIZE 4096
+#define CONFIG_MTDRAM_ERASE_SIZE 64
+
+#define CONFIG_MTD_CFI_B4
+#define CONFIG_MTD_CFI_B2
+#define CONFIG_MTD_CFI_B1
+
+#define CONFIG_MTD_CFI_I4
+#define CONFIG_MTD_CFI_I2
+#define CONFIG_MTD_CFI_I1
+
 #endif /* MTD_OUT_OF_TREE */
 
 #endif /* __MTD_CONFIG_H__ */


From dwmw2 at infradead.org  Wed May 21 11:00:34 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:24 2006
Subject: mtd/drivers/mtd/chips Makefile.common,NONE,1.1 GNUmakefile,1.7,1.8
 Makefile,1.11,1.12
Message-ID: <E19IV4W-0006rp-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv26380/chips

Modified Files:
	GNUmakefile Makefile 
Added Files:
	Makefile.common 
Log Message:
Make makefiles work for 2.5 too


***** Error reading new file: [Errno 2] No such file or directory: 'Makefile.common'
Index: GNUmakefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/GNUmakefile,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- GNUmakefile	13 Sep 2002 15:16:10 -0000	1.7
+++ GNUmakefile	21 May 2003 15:00:01 -0000	1.8
@@ -1,38 +1,7 @@
+#
+# Out of tree drivers/mtd/chips/GNUmakefile
+#
 # $Id$
 
-ifndef CONFIG_MTD
-
-# We're being invoked outside a normal kernel build. Fake it
-
-CONFIG_MTD := m
-
-CONFIG_MTD_CFI := m
-CONFIG_MTD_CFI_AMDSTD := m
-CONFIG_MTD_CFI_INTELEXT := m
-CONFIG_MTD_GEN_PROBE := m
-CONFIG_MTD_JEDECPROBE := m
-CONFIG_MTD_INTELPROBE := m
-CONFIG_MTD_RAM := m
-CONFIG_MTD_ROM := m
-CONFIG_MTD_ABSENT := m
-# Deprecated:
-#CONFIG_MTD_JEDEC := m
-#CONFIG_MTD_SHARP := m
-#CONFIG_MTD_AMDSTD := m
-
-endif
-
-# Normal case - build in-kernel
-
-ifeq ($(VERSION),2)
- ifneq ($(PATCHLEVEL),4)
-  ifneq ($(PATCHLEVEL),5)
-   OLDTOPDIR := $(TOPDIR)
-   TOPDIR := $(shell pwd)/..
-  endif
- endif
-endif
-
+obj := $(shell pwd)
 include Makefile
-
-

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/Makefile,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Makefile	20 May 2003 13:10:04 -0000	1.11
+++ Makefile	21 May 2003 15:00:01 -0000	1.12
@@ -1,35 +1,8 @@
 #
-# linux/drivers/chips/Makefile
+# Out of tree drivers/mtd/chips/Makefile
 #
 # $Id$
 
-BELOW25		:= $(shell echo $(PATCHLEVEL) | sed s/[1234]/y/)
+# Munge the kernel build environment to suit our needs....
+include $(mtd)/Makefile.inc
 
-ifeq ($(BELOW25),y)
-O_TARGET	:= chipslink.o
-endif
-
-export-objs	:= chipreg.o gen_probe.o
-
-#                       *** BIG UGLY NOTE ***
-#
-# The removal of get_module_symbol() and replacement with
-# inter_module_register() et al has introduced a link order dependency
-# here where previously there was none.  We now have to ensure that
-# the CFI command set drivers are linked before cfi_probe.o
-
-obj-$(CONFIG_MTD)		+= chipreg.o
-obj-$(CONFIG_MTD_AMDSTD)	+= amd_flash.o 
-obj-$(CONFIG_MTD_CFI)		+= cfi_probe.o
-obj-$(CONFIG_MTD_CFI_STAA)	+= cfi_cmdset_0020.o
-obj-$(CONFIG_MTD_CFI_AMDSTD)	+= cfi_cmdset_0002.o
-obj-$(CONFIG_MTD_CFI_INTELEXT)	+= cfi_cmdset_0001.o
-obj-$(CONFIG_MTD_GEN_PROBE)	+= gen_probe.o
-obj-$(CONFIG_MTD_JEDEC)		+= jedec.o
-obj-$(CONFIG_MTD_JEDECPROBE)	+= jedec_probe.o
-obj-$(CONFIG_MTD_RAM)		+= map_ram.o
-obj-$(CONFIG_MTD_ROM)		+= map_rom.o
-obj-$(CONFIG_MTD_SHARP)		+= sharp.o
-obj-$(CONFIG_MTD_ABSENT)	+= map_absent.o
-
--include $(TOPDIR)/Rules.make


From dwmw2 at infradead.org  Wed May 21 11:00:34 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:24 2006
Subject: mtd/drivers/mtd Makefile.common,NONE,1.1 Makefile.inc,NONE,1.1
 GNUmakefile,1.14,1.15 Makefile,1.73,1.74 defconfig,1.1,1.2
Message-ID: <E19IV4V-0006rk-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv26380

Modified Files:
	GNUmakefile Makefile defconfig 
Added Files:
	Makefile.common Makefile.inc 
Log Message:
Make makefiles work for 2.5 too


***** Error reading new file: [Errno 2] No such file or directory: 'Makefile.common'
***** Error reading new file: [Errno 2] No such file or directory: 'Makefile.inc'
Index: GNUmakefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/GNUmakefile,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- GNUmakefile	21 May 2003 12:57:58 -0000	1.14
+++ GNUmakefile	21 May 2003 15:00:00 -0000	1.15
@@ -6,16 +6,14 @@
 
 # Someone just typed 'make'. Invoke the kernel makefiles properly...
 
-export CONFIG_MTD_COMPLEX_MAPPINGS EXTRA_CFLAGS
-
 modules:
-	make -C $(LINUXDIR) SUBDIRS=`pwd` modules
+	make -C $(LINUXDIR) SUBDIRS=`pwd` mtd=`pwd` modules
 
 simplemap:
-	make -C $(LINUXDIR) SUBDIRS=`pwd` SIMPLEMAP=1 modules
+	make -C $(LINUXDIR) SUBDIRS=`pwd` mtd=`pwd` SIMPLEMAP=1 modules
 
 dep:
-	make -C $(LINUXDIR) SUBDIRS=`pwd` dep
+	make -C $(LINUXDIR) SUBDIRS=`pwd` mtd=`pwd` dep
 
 clean:
 	rm -f `find . -name \*.ko` `find . -name \*.o`

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/Makefile,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- Makefile	21 May 2003 12:57:58 -0000	1.73
+++ Makefile	21 May 2003 15:00:00 -0000	1.74
@@ -1,25 +1,11 @@
+#
+# Out of tree drivers/mtd/Makefile
+#
 # $Id$
 
-# Munge the kernel build environment to suit our needs....
-
-include $(obj)/defconfig
-
-# This must be first in the include path, so it goes in $(CC) rather
-# then $(EXTRA_CFLAGS)
-
-CC += -I$(obj)/../../include
-EXTRA_CFLAGS := -g -DMTD_OUT_OF_TREE #-Werror
-
-ifdef SIMPLEMAP
-EXTRA_CFLAGS += -DSIMPLEMAP
-endif
-
 # We know, but not quite yet...
 CFLAGS_nftlcore.o := -Wno-error
 CFLAGS_nftlmount.o := -Wno-error
 
-ifeq ($(PATCHLEVEL),5)
-include $(obj)/Makefile-2.5
-else
-include $(obj)/Makefile-2.4
-endif
+# Munge the kernel build environment to suit our needs....
+include $(mtd)/Makefile.inc

Index: defconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/defconfig,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- defconfig	21 May 2003 12:57:58 -0000	1.1
+++ defconfig	21 May 2003 15:00:00 -0000	1.2
@@ -1,6 +1,7 @@
 # $Id$
 
 CONFIG_MTD := m
+CONFIG_MTD_CONCAT := m
 CONFIG_MTD_PARTITIONS := m
 CONFIG_MTD_REDBOOT_PARTS := m
 CONFIG_MTD_AFS_PARTS := m
@@ -11,6 +12,7 @@
 CONFIG_MTD_CFI := m
 CONFIG_MTD_CFI_AMDSTD := m
 CONFIG_MTD_CFI_INTELEXT := m
+CONFIG_MTD_CFI_STAA := m
 CONFIG_MTD_GEN_PROBE := m
 CONFIG_MTD_JEDECPROBE := m
 CONFIG_MTD_INTELPROBE := m
@@ -39,7 +41,6 @@
  CONFIG_MTD_OCTAGON := m
  CONFIG_MTD_PCMCIA := m
  CONFIG_MTD_SBC_GXX := m
- CONFIG_MTD_SUN_UFLASH := m
  CONFIG_MTD_VMAX := m
 else
  CONFIG_MTD_COMPLEX_MAPPINGS := n
@@ -47,8 +48,8 @@
  CONFIG_MTD_OCTAGON := n
  CONFIG_MTD_PCMCIA := n
  CONFIG_MTD_SBC_GXX := n
- CONFIG_MTD_SUN_UFLASH := n
  CONFIG_MTD_VMAX := n
 endif
 CONFIG_MTD_NAND := m
 CONFIG_MTD_NAND_ECC := m
+CONFIG_MTD_NAND_IDS := m


From dwmw2 at infradead.org  Wed May 21 11:00:07 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:24 2006
Subject: mtd/drivers/mtd/nand Makefile.common,NONE,1.1 GNUmakefile,1.3,1.4
 Makefile,1.11,1.12
Message-ID: <E19IV4Z-0006s5-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv26380/nand

Modified Files:
	GNUmakefile Makefile 
Added Files:
	Makefile.common 
Log Message:
Make makefiles work for 2.5 too


***** Error reading new file: [Errno 2] No such file or directory: 'Makefile.common'
Index: GNUmakefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/GNUmakefile,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- GNUmakefile	13 Sep 2002 14:38:58 -0000	1.3
+++ GNUmakefile	21 May 2003 15:00:04 -0000	1.4
@@ -1,27 +1,7 @@
+#
+# Out of tree drivers/mtd/nand/GNUmakefile
+#
 # $Id$
 
-ifndef CONFIG_MTD
-
-# We're being invoked outside a normal kernel build. Fake it
-
-CONFIG_MTD_NAND := m
-CONFIG_MTD_NAND_ECC := m
-# CONFIG_MTD_NAND_SPIA := m
-# CONFIG_MTD_NAND_AUTCPU12 := m
-CFLAGS_nand.o := -DCONFIG_MTD_NAND_ECC
-endif
-
-# Normal case - build in-kernel
-
-ifeq ($(VERSION),2)
- ifneq ($(PATCHLEVEL),4)
-  ifneq ($(PATCHLEVEL),5)
-   OLDTOPDIR := $(TOPDIR)
-   TOPDIR := $(shell pwd)/..
-  endif
- endif
-endif
-
+obj := $(shell pwd)
 include Makefile
-
-

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/Makefile,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Makefile	20 May 2003 13:10:05 -0000	1.11
+++ Makefile	21 May 2003 15:00:04 -0000	1.12
@@ -1,23 +1,6 @@
 #
-# linux/drivers/nand/Makefile
+# Out of tree drivers/mtd/nand/Makefile
 #
 # $Id$
 
-BELOW25		:= $(shell echo $(PATCHLEVEL) | sed s/[1234]/y/)
-
-ifeq ($(BELOW25),y)
-O_TARGET			:= nandlink.o
-endif
-
-export-objs			:= nand.o nand_ecc.o nand_ids.o
-
-nandobjs-y			:= nand.o
-
-obj-$(CONFIG_MTD_NAND)		+= $(nandobjs-y) 
-obj-$(CONFIG_MTD_NAND)		+= nand_ecc.o
-obj-$(CONFIG_MTD_NAND_SPIA)	+= spia.o
-obj-$(CONFIG_MTD_NAND_AUTCPU12)	+= autcpu12.o
-obj-$(CONFIG_MTD_NAND_EDB7312)  += edb7312.o
-obj-$(CONFIG_MTD_NAND_IDS)	+= nand_ids.o
-
--include $(TOPDIR)/Rules.make
+include $(mtd)/Makefile.inc


From dwmw2 at infradead.org  Wed May 21 11:00:06 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:25 2006
Subject: mtd/drivers/mtd/maps Makefile.common,NONE,1.1 GNUmakefile,1.11,1.12
 Makefile,1.43,1.44
Message-ID: <E19IV4Y-0006rx-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv26380/maps

Modified Files:
	GNUmakefile Makefile 
Added Files:
	Makefile.common 
Log Message:
Make makefiles work for 2.5 too


***** Error reading new file: [Errno 2] No such file or directory: 'Makefile.common'
Index: GNUmakefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/GNUmakefile,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- GNUmakefile	20 May 2003 20:41:30 -0000	1.11
+++ GNUmakefile	21 May 2003 15:00:03 -0000	1.12
@@ -1,43 +1,7 @@
+#
+# Out of tree drivers/mtd/maps/GNUmakefile
+#
 # $Id$
 
-ifndef CONFIG_MTD
-
-# We're being invoked outside a normal kernel build. Fake it
-# CONFIG_MTD_ARM := m
-CONFIG_MTD_CFI_FLAGADM := m
-# CONFIG_MTD_CSTM_MIPS_IXX := m
-# CONFIG_MTD_DC21285 := m
-# CONFIG_MTD_ELAN_104NC := m
-CONFIG_MTD_IQ80310 := m
-CONFIG_MTD_L440GX := m
-CONFIG_MTD_NORA := m
-# CONFIG_MTD_OCTAGON := m
-CONFIG_MTD_PHYSMAP := m
-CONFIG_MTD_PNC2000 := m
-CONFIG_MTD_RPXLITE := m
-# CONFIG_MTD_SA1100 := m
-# CONFIG_MTD_PCMCIA := m
-# CONFIG_MTD_SBC_GXX := m
-CONFIG_MTD_SC520CDP := m
-CONFIG_MTD_NETSC520 := m
-# CONFIG_MTD_SUN_UFLASH := m
-# CONFIG_MTD_VMAX := m
-CONFIG_MTD_DBOX2 := m
-
-CFLAGS_physmap.o := -DCONFIG_MTD_PHYSMAP_START=0x8000000 -DCONFIG_MTD_PHYSMAP_LEN=0x4000000 -DCONFIG_MTD_PHYSMAP_BUSWIDTH=2
-CFLAGS_cstmmap.o := -DCONFIG_MTD_CSTM_MIPS_IXX_START=0x8000000 -DCONFIG_MTD_CSTM_MIPS_IXX_LEN=0x4000000 -DCONFIG_MTD_CSTM_MIPS_IXX_BUSWIDTH=2
-endif
-
-# Normal case - build in-kernel
-
-ifeq ($(VERSION),2)
- ifneq ($(PATCHLEVEL),4)
-  ifneq ($(PATCHLEVEL),5)
-   OLDTOPDIR := $(TOPDIR)
-   TOPDIR := $(shell pwd)/..
-  endif
- endif
-endif
-
+obj := $(shell pwd)
 include Makefile
-

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Makefile,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- Makefile	20 May 2003 13:10:05 -0000	1.43
+++ Makefile	21 May 2003 15:00:03 -0000	1.44
@@ -1,69 +1,8 @@
 #
-# linux/drivers/maps/Makefile
+# Out of tree drivers/mtd/maps/Makefile
 #
 # $Id$
 
-BELOW25		:= $(shell echo $(PATCHLEVEL) | sed s/[1234]/y/)
+# Munge the kernel build environment to suit our needs....
+include $(mtd)/Makefile.inc
 
-ifeq ($(BELOW25),y)
-O_TARGET	:= mapslink.o
-endif
-
-export-objs := map_funcs.o
-
-ifeq ($(CONFIG_MTD_COMPLEX_MAPPINGS),y)
-obj-$(CONFIG_MTD)		+= map_funcs.o
-endif
-
-# Chip mappings
-obj-$(CONFIG_MTD_CDB89712)	+= cdb89712.o
-obj-$(CONFIG_MTD_ARM_INTEGRATOR)+= integrator-flash.o
-obj-$(CONFIG_MTD_CFI_FLAGADM)	+= cfi_flagadm.o
-obj-$(CONFIG_MTD_CSTM_MIPS_IXX)	+= cstm_mips_ixx.o
-obj-$(CONFIG_MTD_DC21285)	+= dc21285.o
-obj-$(CONFIG_MTD_DILNETPC)	+= dilnetpc.o
-obj-$(CONFIG_MTD_ELAN_104NC)	+= elan-104nc.o
-obj-$(CONFIG_MTD_EPXA10DB)	+= epxa10db-flash.o
-obj-$(CONFIG_MTD_IQ80310)	+= iq80310.o
-obj-$(CONFIG_MTD_L440GX)	+= l440gx.o
-obj-$(CONFIG_MTD_AMD76XROM)	+= amd76xrom.o
-obj-$(CONFIG_MTD_ICH2ROM)	+= ich2rom.o
-obj-$(CONFIG_MTD_TSUNAMI)	+= tsunami_flash.o
-obj-$(CONFIG_MTD_LUBBOCK)	+= lubbock-flash.o
-obj-$(CONFIG_MTD_MBX860)	+= mbx860.o
-obj-$(CONFIG_MTD_CEIVA)		+= ceiva.o
-obj-$(CONFIG_MTD_OCTAGON)	+= octagon-5066.o
-obj-$(CONFIG_MTD_PHYSMAP)	+= physmap.o 
-obj-$(CONFIG_MTD_PNC2000)	+= pnc2000.o
-obj-$(CONFIG_MTD_PCMCIA)	+= pcmciamtd.o
-obj-$(CONFIG_MTD_RPXLITE)	+= rpxlite.o
-obj-$(CONFIG_MTD_TQM8XXL)	+= tqm8xxl.o
-obj-$(CONFIG_MTD_SA1100)	+= sa1100-flash.o
-obj-$(CONFIG_MTD_SBC_GXX)	+= sbc_gxx.o
-obj-$(CONFIG_MTD_SC520CDP)	+= sc520cdp.o
-obj-$(CONFIG_MTD_NETSC520)	+= netsc520.o
-obj-$(CONFIG_MTD_SUN_UFLASH)	+= sun_uflash.o
-obj-$(CONFIG_MTD_VMAX)		+= vmax301.o
-obj-$(CONFIG_MTD_SCx200_DOCFLASH)+= scx200_docflash.o
-obj-$(CONFIG_MTD_DBOX2)		+= dbox2-flash.o
-obj-$(CONFIG_MTD_OCELOT)	+= ocelot.o
-obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o
-obj-$(CONFIG_MTD_PCI)		+= pci.o
-obj-$(CONFIG_MTD_PB1000)	+= pb1xxx-flash.o
-obj-$(CONFIG_MTD_PB1100)	+= pb1xxx-flash.o
-obj-$(CONFIG_MTD_PB1500)	+= pb1xxx-flash.o
-obj-$(CONFIG_MTD_LASAT)		+= lasat.o
-obj-$(CONFIG_MTD_AUTCPU12)	+= autcpu12-nvram.o
-obj-$(CONFIG_MTD_EDB7312)	+= edb7312.o
-obj-$(CONFIG_MTD_IMPA7)		+= impa7.o
-obj-$(CONFIG_MTD_FORTUNET)	+= fortunet.o
-obj-$(CONFIG_MTD_REDWOOD)	+= redwood.o
-obj-$(CONFIG_MTD_UCLINUX)	+= uclinux.o
-obj-$(CONFIG_MTD_NETtel)	+= nettel.o
-obj-$(CONFIG_MTD_SCB2_FLASH)	+= scb2_flash.o
-obj-$(CONFIG_MTD_EBONY)		+= ebony.o
-obj-$(CONFIG_MTD_BEECH)		+= beech-mtd.o
-obj-$(CONFIG_MTD_ARCTIC)	+= arctic-mtd.o
-obj-$(CONFIG_MTD_H720X)		+= h720x-flash.o
-
--include $(TOPDIR)/Rules.make


From dwmw2 at infradead.org  Wed May 21 11:00:05 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:25 2006
Subject: mtd/drivers/mtd/devices Makefile.common,NONE,1.1
 GNUmakefile,1.5,1.6 Makefile,1.7,1.8
Message-ID: <E19IV4X-0006rt-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/devices
In directory phoenix.infradead.org:/tmp/cvs-serv26380/devices

Modified Files:
	GNUmakefile Makefile 
Added Files:
	Makefile.common 
Log Message:
Make makefiles work for 2.5 too


***** Error reading new file: [Errno 2] No such file or directory: 'Makefile.common'
Index: GNUmakefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/GNUmakefile,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- GNUmakefile	16 May 2003 16:02:57 -0000	1.5
+++ GNUmakefile	21 May 2003 15:00:02 -0000	1.6
@@ -1,32 +1,7 @@
+#
+# Out of tree drivers/mtd/devices/GNUmakefile
+#
 # $Id$
 
-ifndef CONFIG_MTD
-
-# We're being invoked outside a normal kernel build. Fake it
-
-CONFIG_MTD_DOC1000 := m
-CONFIG_MTD_DOC2000 := m
-CONFIG_MTD_DOC2001 := m
-CONFIG_MTD_DOCPROBE := m
-CONFIG_MTD_SLRAM := m
-CONFIG_MTD_PMC551 := $(CONFIG_PCI)
-CONFIG_MTD_MTDRAM := m
-
-CFLAGS_mtdram.o := -DCONFIG_MTDRAM_TOTAL_SIZE=4096 -DCONFIG_MTDRAM_ERASE_SIZE=128
-
-endif
-
-# Normal case - build in-kernel
-
-ifeq ($(VERSION),2)
- ifneq ($(PATCHLEVEL),4)
-  ifneq ($(PATCHLEVEL),5)
-   OLDTOPDIR := $(TOPDIR)
-   TOPDIR := $(shell pwd)/..
-  endif
- endif
-endif
-
+obj := $(shell pwd)
 include Makefile
-
-

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/Makefile,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Makefile	20 May 2003 13:10:04 -0000	1.7
+++ Makefile	21 May 2003 15:00:02 -0000	1.8
@@ -1,30 +1,15 @@
 #
-# linux/drivers/devices/Makefile
+# Out of tree drivers/mtd/devices/Makefile
 #
 # $Id$
 
-BELOW25		:= $(shell echo $(PATCHLEVEL) | sed s/[1234]/y/)
+# We know, but not quite yet...
+CFLAGS_doc2000.o := -Wno-error
+CFLAGS_doc2001.o := -Wno-error
 
-ifeq ($(BELOW25),y)
-O_TARGET	:= devlink.o
-endif
+# This wants replacing with a map driver and nobody still has one anyway
+CFLAGS_doc1000.o := -Wno-error
 
-#                       *** BIG UGLY NOTE ***
-#
-# The removal of get_module_symbol() and replacement with
-# inter_module_register() et al has introduced a link order dependency
-# here where previously there was none.  We now have to ensure that
-# doc200[01].o are linked before docprobe.o
-
-obj-$(CONFIG_MTD_DOC1000)	+= doc1000.o
-obj-$(CONFIG_MTD_DOC2000)	+= doc2000.o
-obj-$(CONFIG_MTD_DOC2001)	+= doc2001.o
-obj-$(CONFIG_MTD_DOCPROBE)	+= docprobe.o docecc.o
-obj-$(CONFIG_MTD_SLRAM)		+= slram.o
-obj-$(CONFIG_MTD_PMC551)	+= pmc551.o
-obj-$(CONFIG_MTD_MS02NV)	+= ms02-nv.o
-obj-$(CONFIG_MTD_MTDRAM)	+= mtdram.o
-obj-$(CONFIG_MTD_LART)		+= lart.o
-obj-$(CONFIG_MTD_BLKMTD)	+= blkmtd.o
+# Munge the kernel build environment to suit our needs....
+include $(mtd)/Makefile.inc
 
--include $(TOPDIR)/Rules.make


From dwmw2 at infradead.org  Wed May 21 11:12:04 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:25 2006
Subject: mtd/drivers/mtd/maps sbc_gxx.c,1.24,1.25
Message-ID: <E19IVG8-0006wY-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv26688/drivers/mtd/maps

Modified Files:
	sbc_gxx.c 
Log Message:
remove check_region

Index: sbc_gxx.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sbc_gxx.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- sbc_gxx.c	20 May 2003 20:59:31 -0000	1.24
+++ sbc_gxx.c	21 May 2003 15:12:01 -0000	1.25
@@ -235,12 +235,6 @@
 
 int __init init_sbc_gxx(void)
 {
-	if (check_region(PAGE_IO,PAGE_IO_SIZE) != 0) {
-		printk( KERN_ERR"%s: IO ports 0x%x-0x%x in use\n",
-			sbc_gxx_map.name,
-			PAGE_IO, PAGE_IO+PAGE_IO_SIZE-1 );
-		return -EAGAIN;
-	}
   	iomapadr = (unsigned long)ioremap(WINDOW_START, WINDOW_LENGTH);
 	if (!iomapadr) {
 		printk( KERN_ERR"%s: failed to ioremap memory region\n",
@@ -248,7 +242,14 @@
 		return -EIO;
 	}
 	
-	request_region( PAGE_IO, PAGE_IO_SIZE, "SBC-GXx flash" );
+	if (request_region( PAGE_IO, PAGE_IO_SIZE, "SBC-GXx flash")) {
+		printk( KERN_ERR"%s: IO ports 0x%x-0x%x in use\n",
+			sbc_gxx_map.name,
+			PAGE_IO, PAGE_IO+PAGE_IO_SIZE-1 );
+		iounmap((void *)iomapadr);
+		return -EAGAIN;
+	}
+		
 	
 	printk( KERN_INFO"%s: IO:0x%x-0x%x MEM:0x%x-0x%x\n",
 		sbc_gxx_map.name,


From dwmw2 at infradead.org  Wed May 21 12:12:53 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:25 2006
Subject: mtd/drivers/mtd Rules.make,1.3,NONE
Message-ID: <E19IWCz-0007pu-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv30104

Removed Files:
	Rules.make 
Log Message:
Remove Rules.make

--- Rules.make DELETED ---


From dwmw2 at infradead.org  Wed May 21 11:15:40 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:25 2006
Subject: mtd/drivers/mtd/chips cfi_cmdset_0001.c,1.118,1.119
 cfi_cmdset_0002.c,1.71,1.72 cfi_cmdset_0020.c,1.3,1.4
 chipreg.c,1.14,1.15 gen_probe.c,1.10,1.11 jedec.c,1.16,1.17
 jedec_probe.c,1.26,1.27 map_absent.c,1.2,1.3 map_ram.c,1.15,1.16
 map_rom.c,1.18,1.19
Message-ID: <E19IVJ7-0006ya-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv26797/drivers/mtd/chips

Modified Files:
	cfi_cmdset_0001.c cfi_cmdset_0002.c cfi_cmdset_0020.c 
	chipreg.c gen_probe.c jedec.c jedec_probe.c map_absent.c 
	map_ram.c map_rom.c 
Log Message:
include cleanups

Index: cfi_cmdset_0001.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0001.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -r1.118 -r1.119
--- cfi_cmdset_0001.c	21 May 2003 11:45:53 -0000	1.118
+++ cfi_cmdset_0001.c	21 May 2003 15:15:04 -0000	1.119
@@ -29,6 +29,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/mtd/map.h>
+#include <linux/mtd/mtd.h>
 #include <linux/mtd/cfi.h>
 #include <linux/mtd/compatmac.h>
 

Index: cfi_cmdset_0002.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0002.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- cfi_cmdset_0002.c	21 May 2003 11:45:53 -0000	1.71
+++ cfi_cmdset_0002.c	21 May 2003 15:15:04 -0000	1.72
@@ -24,7 +24,9 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/mtd/map.h>
+#include <linux/mtd/mtd.h>
 #include <linux/mtd/cfi.h>
+#include <linux/mtd/compatmac.h>
 
 #define AMD_BOOTLOC_BUG
 

Index: cfi_cmdset_0020.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0020.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- cfi_cmdset_0020.c	21 May 2003 11:45:53 -0000	1.3
+++ cfi_cmdset_0020.c	21 May 2003 15:15:05 -0000	1.4
@@ -25,11 +25,13 @@
 #include <asm/byteorder.h>
 
 #include <linux/errno.h>
+#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/cfi.h>
+#include <linux/mtd/mtd.h>
 #include <linux/mtd/compatmac.h>
 
 
@@ -1433,13 +1435,13 @@
 
 static char im_name[]="cfi_cmdset_0020";
 
-mod_init_t cfi_staa_init(void)
+int __init cfi_staa_init(void)
 {
 	inter_module_register(im_name, THIS_MODULE, &cfi_cmdset_0020);
 	return 0;
 }
 
-mod_exit_t cfi_staa_exit(void)
+static void __exit cfi_staa_exit(void)
 {
 	inter_module_unregister(im_name);
 }

Index: chipreg.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/chipreg.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- chipreg.c	21 May 2003 11:42:06 -0000	1.14
+++ chipreg.c	21 May 2003 15:15:05 -0000	1.15
@@ -7,9 +7,13 @@
 
 #include <linux/kernel.h>
 #include <linux/config.h>
+#include <linux/module.h>
 #include <linux/kmod.h>
 #include <linux/spinlock.h>
+#include <linux/slab.h>
 #include <linux/mtd/map.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/compatmac.h>
 
 spinlock_t chip_drvs_lock = SPIN_LOCK_UNLOCKED;
 static LIST_HEAD(chip_drvs_list);

Index: gen_probe.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/gen_probe.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- gen_probe.c	31 Jan 2003 13:35:07 -0000	1.10
+++ gen_probe.c	21 May 2003 15:15:05 -0000	1.11
@@ -6,9 +6,12 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/module.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/cfi.h>
+#include <linux/mtd/mtd.h>
 #include <linux/mtd/gen_probe.h>
 
 static struct mtd_info *check_cmd_set(struct map_info *, int);

Index: jedec.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/jedec.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- jedec.c	21 May 2003 11:50:36 -0000	1.16
+++ jedec.c	21 May 2003 15:15:05 -0000	1.17
@@ -20,6 +20,7 @@
 #include <linux/mtd/jedec.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/mtd.h>
+#include <linux/mtd/compatmac.h>
 
 static struct mtd_info *jedec_probe(struct map_info *);
 static int jedec_probe8(struct map_info *map,unsigned long base,
@@ -234,7 +235,7 @@
    MTD->priv = map;
    map->fldrv_priv = priv;
    map->fldrv = &jedec_chipdrv;
-   MOD_INC_USE_COUNT;
+   __module_get(THIS_MODULE);
    return MTD;
 }
 

Index: jedec_probe.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/jedec_probe.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- jedec_probe.c	6 May 2003 21:34:41 -0000	1.26
+++ jedec_probe.c	21 May 2003 15:15:05 -0000	1.27
@@ -16,6 +16,7 @@
 #include <linux/slab.h>
 #include <linux/interrupt.h>
 
+#include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/cfi.h>
 #include <linux/mtd/gen_probe.h>

Index: map_absent.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/map_absent.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- map_absent.c	2 Oct 2001 15:05:12 -0000	1.2
+++ map_absent.c	21 May 2003 15:15:05 -0000	1.3
@@ -23,9 +23,10 @@
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
-
+#include <linux/init.h>
+#include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
-
+#include <linux/mtd/compatmac.h>
 
 static int map_absent_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
 static int map_absent_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
@@ -65,7 +66,7 @@
 	mtd->flags 	= 0;
 	mtd->erasesize = PAGE_SIZE;
 
-	MOD_INC_USE_COUNT;
+	__module_get(THIS_MODULE);
 	return mtd;
 }
 

Index: map_ram.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/map_ram.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- map_ram.c	14 May 2003 15:05:13 -0000	1.15
+++ map_ram.c	21 May 2003 15:15:05 -0000	1.16
@@ -11,8 +11,10 @@
 #include <asm/byteorder.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
-
+#include <linux/init.h>
+#include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
+#include <linux/mtd/compatmac.h>
 
 
 static int mapram_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
@@ -74,7 +76,7 @@
  	while(mtd->size & (mtd->erasesize - 1))
 		mtd->erasesize >>= 1;
 
-	MOD_INC_USE_COUNT;
+	__module_get(THIS_MODULE);
 	return mtd;
 }
 

Index: map_rom.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/map_rom.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- map_rom.c	14 May 2003 15:05:13 -0000	1.18
+++ map_rom.c	21 May 2003 15:15:05 -0000	1.19
@@ -12,8 +12,10 @@
 #include <asm/byteorder.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
-
+#include <linux/init.h>
+#include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
+#include <linux/mtd/compatmac.h>
 
 static int maprom_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
 static int maprom_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
@@ -49,7 +51,7 @@
  	while(mtd->size & (mtd->erasesize - 1))
 		mtd->erasesize >>= 1;
 
-	MOD_INC_USE_COUNT;
+	__module_get(THIS_MODULE);
 	return mtd;
 }
 


From dwmw2 at infradead.org  Wed May 21 11:15:36 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:25 2006
Subject: mtd/drivers/mtd mtd_blkdevs-24.c,1.8,1.9 mtdcore.c,1.38,1.39
 mtdpart.c,1.38,1.39 Makefile-2.4,1.1,NONE Makefile-2.5,1.1,NONE
 initcalls.c,1.3,NONE
Message-ID: <E19IVJ4-0006yR-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv26797/drivers/mtd

Modified Files:
	mtd_blkdevs-24.c mtdcore.c mtdpart.c 
Removed Files:
	Makefile-2.4 Makefile-2.5 initcalls.c 
Log Message:
include cleanups

Index: mtd_blkdevs-24.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs-24.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- mtd_blkdevs-24.c	21 May 2003 08:03:42 -0000	1.8
+++ mtd_blkdevs-24.c	21 May 2003 15:15:03 -0000	1.9
@@ -122,11 +122,17 @@
 	   actually want to deal with signals. We can't just call 
 	   exit_sighand() since that'll cause an oops when we finally
 	   do exit. */
+#if 0
 	spin_lock_irq(&current->sigmask_lock);
 	sigfillset(&current->blocked);
 	recalc_sigpending(current);
 	spin_unlock_irq(&current->sigmask_lock);
-
+#else
+	spin_lock_irq(&current->sighand->siglock);
+	sigfillset(&current->blocked);
+	recalc_sigpending();
+	spin_unlock_irq(&current->sighand->siglock);
+#endif
 	daemonize();
 
 	while (!tr->blkcore_priv->exiting) {

Index: mtdcore.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdcore.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- mtdcore.c	21 May 2003 09:58:13 -0000	1.38
+++ mtdcore.c	21 May 2003 15:15:03 -0000	1.39
@@ -18,6 +18,7 @@
 #include <linux/fs.h>
 #include <linux/ioctl.h>
 #include <linux/init.h>
+#include <linux/mtd/compatmac.h>
 #ifdef CONFIG_PROC_FS
 #include <linux/proc_fs.h>
 #endif

Index: mtdpart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdpart.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- mtdpart.c	17 May 2003 00:26:39 -0000	1.38
+++ mtdpart.c	21 May 2003 15:15:03 -0000	1.39
@@ -20,7 +20,7 @@
 #include <linux/kmod.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
-
+#include <linux/mtd/compatmac.h>
 
 /* Our partition linked list */
 static LIST_HEAD(mtd_partitions);

--- Makefile-2.4 DELETED ---

--- Makefile-2.5 DELETED ---

--- initcalls.c DELETED ---


From dwmw2 at infradead.org  Wed May 21 11:15:35 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:25 2006
Subject: mtd/include/linux/mtd map.h,1.32,1.33 nand.h,1.24,1.25
Message-ID: <E19IVJ3-0006yN-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv26797/include/linux/mtd

Modified Files:
	map.h nand.h 
Log Message:
include cleanups

Index: map.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/map.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- map.h	21 May 2003 11:42:07 -0000	1.32
+++ map.h	21 May 2003 15:15:02 -0000	1.33
@@ -7,8 +7,7 @@
 
 #include <linux/config.h>
 #include <linux/types.h>
-#include <linux/mtd/mtd.h>
-#include <linux/slab.h>
+#include <linux/list.h>
 #include <asm/io.h>
 
 /* The map stuff is very simple. You fill in your struct map_info with

Index: nand.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/nand.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- nand.h	20 Apr 2003 07:28:48 -0000	1.24
+++ nand.h	21 May 2003 15:15:02 -0000	1.25
@@ -49,7 +49,10 @@
 #define __LINUX_MTD_NAND_H
 
 #include <linux/config.h>
+#include <linux/wait.h>
+#include <linux/spinlock.h>
 
+struct mtd_info;
 /*
  * Searches for a NAND device
  */


From dwmw2 at infradead.org  Wed May 21 11:15:11 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:25 2006
Subject: mtd/drivers/mtd/devices docecc.c,1.4,1.5 docprobe.c,1.34,1.35
 mtdram.c,1.31,1.32
Message-ID: <E19IVJ8-0006ye-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/devices
In directory phoenix.infradead.org:/tmp/cvs-serv26797/drivers/mtd/devices

Modified Files:
	docecc.c docprobe.c mtdram.c 
Log Message:
include cleanups

Index: docecc.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/docecc.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- docecc.c	2 Oct 2001 15:05:13 -0000	1.4
+++ docecc.c	21 May 2003 15:15:06 -0000	1.5
@@ -519,6 +519,8 @@
     return nb_errors;
 }
 
+EXPORT_SYMBOL_GPL(doc_decode_ecc);
+
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Fabrice Bellard <fabrice.bellard@netgem.com>");
 MODULE_DESCRIPTION("ECC code for correcting errors detected by DiskOnChip 2000 and Millennium ECC hardware");

Index: docprobe.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/docprobe.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- docprobe.c	15 May 2003 23:14:13 -0000	1.34
+++ docprobe.c	21 May 2003 15:15:06 -0000	1.35
@@ -47,18 +47,15 @@
 #include <linux/module.h>
 #include <asm/errno.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/pci.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-#include <linux/sched.h>
 #include <linux/init.h>
 #include <linux/types.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/doc2000.h>
+#include <linux/mtd/compatmac.h>
 
 /* Where to look for the devices? */
 #ifndef CONFIG_MTD_DOCPROBE_ADDRESS
@@ -276,11 +273,7 @@
 	   found, so the user knows we at least tried. */
 	if (!docfound)
 		printk(KERN_INFO "No recognised DiskOnChip devices found\n");
-	/* So it looks like we've been used and we get unloaded */
-	MOD_INC_USE_COUNT;
-	MOD_DEC_USE_COUNT;
-	return 0;
-	
+	return -EAGAIN;
 }
 
 module_init(init_doc);

Index: mtdram.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/mtdram.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- mtdram.c	20 May 2003 21:03:07 -0000	1.31
+++ mtdram.c	21 May 2003 15:15:07 -0000	1.32
@@ -13,6 +13,8 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/ioport.h>
+#include <linux/vmalloc.h>
+#include <linux/init.h>
 #include <linux/mtd/compatmac.h>
 #include <linux/mtd/mtd.h>
 


From dwmw2 at infradead.org  Wed May 21 11:15:11 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:25 2006
Subject: mtd/drivers/mtd/nand nand_ids.c,1.3,1.4
Message-ID: <E19IVJ9-0006ys-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv26797/drivers/mtd/nand

Modified Files:
	nand_ids.c 
Log Message:
include cleanups

Index: nand_ids.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_ids.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- nand_ids.c	8 May 2003 08:06:58 -0000	1.3
+++ nand_ids.c	21 May 2003 15:15:08 -0000	1.4
@@ -12,7 +12,6 @@
  *
  */
 #include <linux/module.h>
-#include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 
 /*


From dwmw2 at infradead.org  Wed May 21 11:14:33 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:26 2006
Subject: mtd/include/linux/mtd compatmac.h,1.54,1.55
Message-ID: <E19IVIX-0006y2-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv26780/include/linux/mtd

Modified Files:
	compatmac.h 
Log Message:
Remove compat crap for ancient kernels

Index: compatmac.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/compatmac.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- compatmac.h	17 May 2003 03:34:28 -0000	1.54
+++ compatmac.h	21 May 2003 15:14:30 -0000	1.55
@@ -1,7 +1,4 @@
-
 /*
- * mtd/include/compatmac.h
- *
  * $Id$
  *
  * Extensions and omissions from the normal 'linux/compatmac.h'
@@ -9,479 +6,16 @@
  * becomes fully-featured.
  */
 
-
-/* First, include the parts which the kernel is good enough to provide 
- * to us 
- */
-   
 #ifndef __LINUX_MTD_COMPATMAC_H__
 #define __LINUX_MTD_COMPATMAC_H__
 
-#include <linux/config.h>
-#include <linux/module.h>
-#ifndef LINUX_VERSION_CODE
 #include <linux/version.h>
-#endif
-
-#ifndef VERSION_CODE
-#  define VERSION_CODE(vers,rel,seq) ( ((vers)<<16) | ((rel)<<8) | (seq) )
-#endif
-#ifndef KERNEL_VERSION
-#  define KERNEL_VERSION(a,b,c) VERSION_CODE(a,b,c)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,0,0)
-#  error "This kernel is too old: not supported by this file"
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
-#include <linux/types.h> /* used later in this header */
-
-#define memcpy_fromio(a,b,c)    memcpy((a),(void *)(b),(c))
-#define memcpy_toio(a,b,c)      memcpy((void *)(a),(b),(c))
-
-typedef struct wait_queue * wait_queue_head_t;
-
-#define DECLARE_WAITQUEUE(x,y) struct wait_queue x = {y,NULL}
-#define DECLARE_WAIT_QUEUE_HEAD(x) struct wait_queue *x = NULL
-#define init_waitqueue_head init_waitqueue
-#define DECLARE_MUTEX(x) struct semaphore x = MUTEX
-#define DECLARE_MUTEX_LOCKED(x) struct semaphore x = MUTEX_LOCKED
-
-/* from sysdep-2.1.h */
-#  include <asm/segment.h>
-#  define access_ok(t,a,sz)           (verify_area((t),(a),(sz)) ? 0 : 1)
-#  define verify_area_20              verify_area
-#  define copy_to_user(t,f,n)         (memcpy_tofs(t,f,n), 0)
-#  define __copy_to_user(t,f,n)       copy_to_user((t),(f),(n))
-#  define copy_to_user_ret(t,f,n,r)   copy_to_user((t),(f),(n))
-#  define copy_from_user(t,f,n)       (memcpy_fromfs((t),(f),(n)), 0)
-#  define __copy_from_user(t,f,n)     copy_from_user((t),(f),(n))
-#  define copy_from_user_ret(t,f,n,r) copy_from_user((t),(f),(n))
-//xxx #  define PUT_USER(val,add)           (put_user((val),(add)), 0)
-#  define Put_user(val,add)           (put_user((val),(add)), 0)
-#  define __PUT_USER(val,add)         PUT_USER((val),(add))
-#  define PUT_USER_RET(val,add,ret)   PUT_USER((val),(add))
-#  define GET_USER(dest,add)          ((dest)=get_user((add)), 0)
-#  define __GET_USER(dest,add)        GET_USER((dest),(add))
-#  define GET_USER_RET(dest,add,ret)  GET_USER((dest),(add))
-
-#define ioremap(offset,size) vremap(offset,size)
-#define iounmap(adr)	/* */
-
-#define EXPORT_SYMBOL(s) /* */
-#define EXPORT_SYMBOL_NOVERS(s) /* */
-
-/* 2.1.10 and 2.1.43 introduced new functions. They are worth using */
-
-#if LINUX_VERSION_CODE < VERSION_CODE(2,1,10)
-
-#  include <asm/byteorder.h>
-#  ifdef __LITTLE_ENDIAN
-#    define cpu_to_le16(x) (x)
-#    define cpu_to_le32(x) (x)
-#    define cpu_to_be16(x) htons((x))
-#    define cpu_to_be32(x) htonl((x))
-#  else
-#    define cpu_to_be16(x) (x)
-#    define cpu_to_be32(x) (x)
-     extern inline __u16 cpu_to_le16(__u16 x) { return (x<<8) | (x>>8);}
-     extern inline __u32 cpu_to_le32(__u32 x) { return((x>>24) |
-             ((x>>8)&0xff00) | ((x<<8)&0xff0000) | (x<<24));}
-#  endif
-
-#  define le16_to_cpu(x)  cpu_to_le16(x)
-#  define le32_to_cpu(x)  cpu_to_le32(x)
-#  define be16_to_cpu(x)  cpu_to_be16(x)
-#  define be32_to_cpu(x)  cpu_to_be32(x)
-
-#endif
-
-#if LINUX_VERSION_CODE < VERSION_CODE(2,1,43)
-#  define cpu_to_le16p(addr) (cpu_to_le16(*(addr)))
-#  define cpu_to_le32p(addr) (cpu_to_le32(*(addr)))
-#  define cpu_to_be16p(addr) (cpu_to_be16(*(addr)))
-#  define cpu_to_be32p(addr) (cpu_to_be32(*(addr)))
-
-   extern inline void cpu_to_le16s(__u16 *a) {*a = cpu_to_le16(*a);}
-   extern inline void cpu_to_le32s(__u16 *a) {*a = cpu_to_le32(*a);}
-   extern inline void cpu_to_be16s(__u16 *a) {*a = cpu_to_be16(*a);}
-   extern inline void cpu_to_be32s(__u16 *a) {*a = cpu_to_be32(*a);}
-
-#  define le16_to_cpup(x) cpu_to_le16p(x)
-#  define le32_to_cpup(x) cpu_to_le32p(x)
-#  define be16_to_cpup(x) cpu_to_be16p(x)
-#  define be32_to_cpup(x) cpu_to_be32p(x)
-
-#  define le16_to_cpus(x) cpu_to_le16s(x)
-#  define le32_to_cpus(x) cpu_to_le32s(x)
-#  define be16_to_cpus(x) cpu_to_be16s(x)
-#  define be32_to_cpus(x) cpu_to_be32s(x)
-#endif
-
-// from 2.2, linux/types.h
-#ifndef __BIT_TYPES_DEFINED__
-#define __BIT_TYPES_DEFINED__
-
-typedef         __u8            u_int8_t;
-typedef         __s8            int8_t;
-typedef         __u16           u_int16_t;
-typedef         __s16           int16_t;
-typedef         __u32           u_int32_t;
-typedef         __s32           int32_t;
-
-#endif /* !(__BIT_TYPES_DEFINED__) */
-
-#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
-  typedef struct { } spinlock_t;
-  #define SPIN_LOCK_UNLOCKED (spinlock_t) { }
-#else
-  typedef struct { int gcc_is_buggy; } spinlock_t;
-  #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
-#endif
-
-#define spin_lock_init(lock)    do { } while(0)
-#define spin_lock(lock)         (void)(lock) /* Not "unused variable". */
-#define spin_trylock(lock)      (1)
-#define spin_unlock_wait(lock)  do { } while(0)
-#define spin_unlock(lock)       do { } while(0)
-#define spin_lock_irq(lock)     cli()
-#define spin_unlock_irq(lock)   sti()
-
-#define spin_lock_irqsave(lock, flags) \
-        do { save_flags(flags); cli(); } while (0)
-#define spin_unlock_irqrestore(lock, flags) \
-        restore_flags(flags)
-
-// Doesn't work when tqueue.h is included. 
-// #define queue_task                   queue_task_irq_off
-#define tty_flip_buffer_push(tty)    queue_task_irq_off(&tty->flip.tqueue, &tq_timer)
-#define signal_pending(current)      (current->signal & ~current->blocked)
-#define schedule_timeout(to)         do {current->timeout = jiffies + (to);schedule ();} while (0)
-#define time_after(t1,t2)            (((long)t1-t2) > 0)
-
-#else
-  #include <linux/compatmac.h>
-#endif  // LINUX_VERSION_CODE < 0x020100
-
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
-#include <linux/vmalloc.h>
-#endif
-
-/* Modularization issues */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,18)
-#  define __USE_OLD_SYMTAB__
-#  define EXPORT_NO_SYMBOLS register_symtab(NULL);
-#  define REGISTER_SYMTAB(tab) register_symtab(tab)
-#else
-#  define REGISTER_SYMTAB(tab) /* nothing */
-#endif
-
-#ifdef __USE_OLD_SYMTAB__
-#  define __MODULE_STRING(s)         /* nothing */
-#  define MODULE_PARM(v,t)           /* nothing */
-#  define MODULE_PARM_DESC(v,t)      /* nothing */
-#  define MODULE_AUTHOR(n)           /* nothing */
-#  define MODULE_DESCRIPTION(d)      /* nothing */
-#  define MODULE_SUPPORTED_DEVICE(n) /* nothing */
-#endif
-
-/*
- * "select" changed in 2.1.23. The implementation is twin, but this
- * header is new
- */
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,22)
-#  include <linux/poll.h>
-#else
-#  define __USE_OLD_SELECT__
-#endif
-
-/* Other change in the fops are solved using pseudo-types */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
-#  define lseek_t      long long
-#  define lseek_off_t  long long
-#else
-#  define lseek_t      int
-#  define lseek_off_t  off_t
-#endif
-
-/* changed the prototype of read/write */
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) || defined(__alpha__)
-# define count_t unsigned long
-# define read_write_t long
-#else
-# define count_t int
-# define read_write_t int
-#endif
-
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,31)
-# define release_t void
-#  define release_return(x) return
-#else
-#  define release_t int
-#  define release_return(x) return (x)
-#endif
-
-#if LINUX_VERSION_CODE < 0x20300
-#define __exit
-#endif
-#if LINUX_VERSION_CODE < 0x20200
-#define __init
-#else
-#include <linux/init.h>
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)
-#define init_MUTEX(x) do {*(x) = MUTEX;} while (0)
-#define init_MUTEX_LOCKED(x) do {*(x) = MUTEX_LOCKED;} while (0)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
-#define RQFUNC_ARG void
-#define blkdev_dequeue_request(req) do {CURRENT = req->next;} while (0)
-#else
-#define RQFUNC_ARG request_queue_t *q
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,32)
-#define blk_cleanup_queue(nr) do {blk_dev[nr].request_fn = 0;} while(0)
-#define BLK_DEFAULT_QUEUE(nr) (blk_dev[nr].request_fn)
-#define blk_init_queue(q, rq) do {q = rq;} while(0)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)
-#ifdef CONFIG_MODULES
-#define __MOD_INC_USE_COUNT(mod)                                        \
-        (atomic_inc(&(mod)->uc.usecount), (mod)->flags |= MOD_VISITED|MOD_USED_ONCE)
-#define __MOD_DEC_USE_COUNT(mod)                                        \
-        (atomic_dec(&(mod)->uc.usecount), (mod)->flags |= MOD_VISITED)
-#else
-#define __MOD_INC_USE_COUNT(mod)
-#define __MOD_DEC_USE_COUNT(mod)
-#endif
-#endif
-
-
-#ifndef HAVE_INTER_MODULE
-static inline void *inter_module_get(char *x) {return NULL;}
-static inline void *inter_module_get_request(char *x, char *y) {return NULL;}
-static inline void inter_module_put(const char *x) {}
-static inline void inter_module_register(const char *x, struct module *y, const void *z) {}
-static inline void inter_module_unregister(const char *x) {}
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)
-
-#define DECLARE_WAIT_QUEUE_HEAD(x) struct wait_queue *x = NULL
-#define init_waitqueue_head init_waitqueue
-
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
-
-static inline int try_inc_mod_count(struct module *mod)
-{
-#ifdef CONFIG_MODULES
-	if (mod)
-		__MOD_INC_USE_COUNT(mod);
-#endif
-	return 1;
-}
-#endif
-
-
-/* Yes, I'm aware that it's a fairly ugly hack.
-   Until the __constant_* macros appear in Linus' own kernels, this is
-   the way it has to be done.
- DW 19/1/00
- */
-
-#include <asm/byteorder.h>
-
-#ifndef __constant_cpu_to_le16
-
-#ifdef __BIG_ENDIAN
-#define __constant_cpu_to_le64(x) ___swab64((x))
-#define __constant_le64_to_cpu(x) ___swab64((x))
-#define __constant_cpu_to_le32(x) ___swab32((x))
-#define __constant_le32_to_cpu(x) ___swab32((x))
-#define __constant_cpu_to_le16(x) ___swab16((x))
-#define __constant_le16_to_cpu(x) ___swab16((x))
-#define __constant_cpu_to_be64(x) ((__u64)(x))
-#define __constant_be64_to_cpu(x) ((__u64)(x))
-#define __constant_cpu_to_be32(x) ((__u32)(x))
-#define __constant_be32_to_cpu(x) ((__u32)(x))
-#define __constant_cpu_to_be16(x) ((__u16)(x))
-#define __constant_be16_to_cpu(x) ((__u16)(x))
-#else
-#ifdef __LITTLE_ENDIAN
-#define __constant_cpu_to_le64(x) ((__u64)(x))
-#define __constant_le64_to_cpu(x) ((__u64)(x))
-#define __constant_cpu_to_le32(x) ((__u32)(x))
-#define __constant_le32_to_cpu(x) ((__u32)(x))
-#define __constant_cpu_to_le16(x) ((__u16)(x))
-#define __constant_le16_to_cpu(x) ((__u16)(x))
-#define __constant_cpu_to_be64(x) ___swab64((x))
-#define __constant_be64_to_cpu(x) ___swab64((x))
-#define __constant_cpu_to_be32(x) ___swab32((x))
-#define __constant_be32_to_cpu(x) ___swab32((x))
-#define __constant_cpu_to_be16(x) ___swab16((x))
-#define __constant_be16_to_cpu(x) ___swab16((x))
-#else
-#error No (recognised) endianness defined (unless it,s PDP)
-#endif /* __LITTLE_ENDIAN */
-#endif /* __BIG_ENDIAN */
-
-#endif /* ifndef __constant_cpu_to_le16 */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
-  #define mod_init_t int  __init
-  #define mod_exit_t void  
-#else
-  #define mod_init_t static int __init
-  #define mod_exit_t static void __exit
-#endif
-
-#ifndef THIS_MODULE
-#ifdef MODULE
-#define THIS_MODULE (&__this_module)
-#else
-#define THIS_MODULE (NULL)
-#endif
-#endif
-
-#if LINUX_VERSION_CODE < 0x20300
-#include <linux/interrupt.h>
-#define spin_lock_bh(lock) do {start_bh_atomic();spin_lock(lock);}while(0)
-#define spin_unlock_bh(lock) do {spin_unlock(lock);end_bh_atomic();}while(0)
-#else
-#include <asm/softirq.h>
-#include <linux/spinlock.h>
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)
-#define set_current_state(state_value)                        \
-        do { current->state = (state_value); } while (0)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0) 
-static inline int invalidate_device(kdev_t dev, int do_sync) {
-
-	if (do_sync)
-		fsync_dev(dev);
-	
-	invalidate_buffers(dev);
-	return 0;
-}
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,4,5)
-static inline int invalidate_device(kdev_t dev, int do_sync) {
-	struct super_block *sb = get_super(dev);
-	int res = 0;
-
-	if (do_sync)
-		fsync_dev(dev);
-	
-	if (sb)
-		res = invalidate_inodes(sb);
-
-	invalidate_buffers(dev);
-	return res;
-}
-#endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10)
-#undef min
-#undef max
-#undef min_t
-#undef max_t
-/*
- * min()/max() macros that also do
- * strict type-checking.. See the
- * "unnecessary" pointer comparison.
- */
-#define min(x,y) ({ \
-        const typeof(x) _x = (x);       \
-        const typeof(y) _y = (y);       \
-        (void) (&_x == &_y);            \
-        _x < _y ? _x : _y; })
-
-#define max(x,y) ({ \
-        const typeof(x) _x = (x);       \
-        const typeof(y) _y = (y);       \
-        (void) (&_x == &_y);            \
-        _x > _y ? _x : _y; })
-
-/*
- * ..and if you can't take the strict
- * types, you can specify one yourself.
- *
- * Or not use min/max at all, of course.
- */
-#define min_t(type,x,y) \
-        ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
-#define max_t(type,x,y) \
-        ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,7)
-struct completion {
-	struct semaphore s;
-};
-
-#define complete(c) up(&(c)->s)
-#define wait_for_completion(c) down(&(c)->s)
-#define init_completion(c) init_MUTEX_LOCKED(&(c)->s);
-
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,9)
-/* This came later */
-#define complete_and_exit(c, r) do { complete(c); do_exit(r); } while(0)
+#error "This kernel is too old: not supported by this file"
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,9) || \
-    (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10) && !defined(__rh_config_h__))
-
-#include <linux/genhd.h>
-
-static inline void add_gendisk(struct gendisk *gp)
-{
-	gp->next = gendisk_head;
-	gendisk_head = gp;
-}
-
-static inline void del_gendisk(struct gendisk *gp)
-{
-	struct gendisk *gd, **gdp;
-
-	for (gdp = &gendisk_head; *gdp; gdp = &((*gdp)->next))
-		if (*gdp == gp) {
-			gd = *gdp; *gdp = gd->next;
-			break;
-		}
-}
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18) && defined(MODULE)
-
-#define module_init(func)		\
-mod_init_t init_module(void) {		\
-	return func();			\
-}
-
-#define module_exit(func)		\
-mod_exit_t cleanup_module(void) {	\
-	return func();			\
-}
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,9) || \
-    (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10) && !defined(__rh_config_h__))
-#define MODULE_LICENSE(x) /* */
-#endif
+	/* O(1) scheduler stuff. */
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,5) && !defined(__rh_config_h__)
 #include <linux/sched.h>
@@ -491,92 +25,33 @@
 }
 #undef recalc_sigpending
 #define recalc_sigpending() __recalc_sigpending ()
-#endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,5)
-#define parent_ino(d) ((d)->d_parent->d_inode->i_ino)
-#endif
+#define set_user_nice(tsk, n) do { (tsk)->nice = n; } while(0)
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,3)
-#define need_resched() (current->need_resched)
-#define cond_resched() do { int oldstate; if need_resched() { oldstate = current->state ; set_current_state(TASK_RUNNING); schedule(); set_current_state(oldstate); } } while(0)
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)
+
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20)
+
 #ifndef yield
 #define yield() do { set_current_state(TASK_RUNNING); schedule(); } while(0)
 #endif
+
 #ifndef minor
 #define major(d) (MAJOR(to_kdev_t(d)))
 #define minor(d) (MINOR(to_kdev_t(d)))
 #endif
+
 #ifndef mk_kdev
 #define mk_kdev(ma,mi) MKDEV(ma,mi)
 #define kdev_t_to_nr(x)	(x)
 #endif
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-	/* Is this right? */
-#define set_user_nice(tsk, n) do { (tsk)->priority = 20-(n); } while(0) 
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) && !defined(RED_HAT_LINUX_KERNEL)
-#define set_user_nice(tsk, n) do { (tsk)->nice = n; } while(0)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,21) && !defined(__rh_config_h__)
-#define rq_data_dir(x)	((x)->cmd)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-
-#define IS_REQ_CMD(req) (1)
-
-#define QUEUE_LOCK(q) (&io_request_lock)
-
-#define BLK_INIT_QUEUE(q, req, lock) blk_init_queue((q), (req)) 
-
-#else /* > 2.5.0 */
-
-#define IS_REQ_CMD(req) ((req)->flags & REQ_CMD)
-
-#define QUEUE_LOCK(q) ((q)->queue_lock)
-
-#define BLK_INIT_QUEUE(q, req, lock) blk_init_queue((q), (req), (lock)) 
-
-#endif
-
-/* Removed cos it broke stuff. Where is this required anyway? 
- * #ifndef QUEUE_EMPTY
- * #define QUEUE_EMPTY  (!CURRENT)
- * #endif
- */
-#if LINUX_VERSION_CODE < 0x20300
-#define QUEUE_PLUGGED (blk_dev[MAJOR_NR].plug_tq.sync)
-#elif LINUX_VERSION_CODE < 0x20500 //FIXME (Si)
-#define QUEUE_PLUGGED (blk_dev[MAJOR_NR].request_queue.plugged)
-#else
-#define QUEUE_PLUGGED (blk_queue_plugged(QUEUE))
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,14)
-#define BLK_INC_USE_COUNT MOD_INC_USE_COUNT
-#define BLK_DEC_USE_COUNT MOD_DEC_USE_COUNT
-#else
-#define BLK_INC_USE_COUNT do {} while(0)
-#define BLK_DEC_USE_COUNT do {} while(0)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,12)
-#define PageUptodate(x) Page_Uptodate(x)
-#endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,48)
-#define get_seconds() CURRENT_TIME
-#endif
+#define need_resched() (current->need_resched)
+#define cond_resched() do { if need_resched() { yield(); } } while(0)
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,53)
-#define generic_file_readonly_mmap generic_file_mmap
-#endif
+#endif /* < 2.4.20 */
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61)
 static inline void __daemonize_modvers(void)
@@ -597,11 +72,33 @@
 #define dequeue_signal __dequeue_signal25
 #endif
 
+	/* Module bits */
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,60)
-#define try_module_get(m) ({ ({if (m) __MOD_INC_USE_COUNT((struct module *)(m));}),1; })
-#define __module_get(m) ({ ({if (m) __MOD_INC_USE_COUNT((struct module *)(m));}),1; })
+#define try_module_get(m) try_inc_mod_count(m)
+#define __module_get(m) do { if (!try_inc_mod_count(m)) BUG(); } while(0)
 #define module_put(m) do { if (m) __MOD_DEC_USE_COUNT((struct module *)(m)); } while(0)
 #define set_module_owner(x) do { x->owner = THIS_MODULE; } while(0)
 #endif
+
+
+	/* Random filesystem stuff, only for JFFS2 really */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,5)
+#define parent_ino(d) ((d)->d_parent->d_inode->i_ino)
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,12)
+#define PageUptodate(x) Page_Uptodate(x)
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,48)
+#define get_seconds() CURRENT_TIME
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,53)
+#define generic_file_readonly_mmap generic_file_mmap
+#endif
+
 
 #endif /* __LINUX_MTD_COMPATMAC_H__ */


From dwmw2 at infradead.org  Wed May 21 11:15:11 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:26 2006
Subject: mtd/drivers/mtd/maps elan-104nc.c,1.16,1.17 iq80310.c,1.15,1.16
 map_funcs.c,1.1,1.2 octagon-5066.c,1.23,1.24 pcmciamtd.c,1.44,1.45
 tsunami_flash.c,1.5,1.6 vmax301.c,1.27,1.28
Message-ID: <E19IVJ9-0006yj-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv26797/drivers/mtd/maps

Modified Files:
	elan-104nc.c iq80310.c map_funcs.c octagon-5066.c pcmciamtd.c 
	tsunami_flash.c vmax301.c 
Log Message:
include cleanups

Index: elan-104nc.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/elan-104nc.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- elan-104nc.c	20 May 2003 20:59:29 -0000	1.16
+++ elan-104nc.c	21 May 2003 15:15:07 -0000	1.17
@@ -40,6 +40,7 @@
 #include <asm/io.h>
 
 #include <linux/mtd/map.h>
+#include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 
 #define WINDOW_START 0xb0000

Index: iq80310.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/iq80310.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- iq80310.c	21 May 2003 12:45:19 -0000	1.15
+++ iq80310.c	21 May 2003 15:15:07 -0000	1.16
@@ -15,6 +15,7 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>

Index: map_funcs.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/map_funcs.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- map_funcs.c	14 May 2003 15:05:15 -0000	1.1
+++ map_funcs.c	21 May 2003 15:15:07 -0000	1.2
@@ -5,9 +5,14 @@
  * is enabled.
  */
 
-#include <linux/mtd/map.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/config.h>
+#include <linux/types.h>
+#include <linux/string.h>
 #include <asm/io.h>
+
+#include <linux/mtd/map.h>
 
 static u8 simple_map_read8(struct map_info *map, unsigned long ofs)
 {

Index: octagon-5066.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/octagon-5066.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- octagon-5066.c	20 May 2003 20:59:31 -0000	1.23
+++ octagon-5066.c	21 May 2003 15:15:07 -0000	1.24
@@ -31,6 +31,7 @@
 #include <asm/io.h>
 
 #include <linux/mtd/map.h>
+#include <linux/mtd/mtd.h>
 
 #define WINDOW_START 0xe8000
 #define WINDOW_LENGTH 0x8000

Index: pcmciamtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pcmciamtd.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- pcmciamtd.c	21 May 2003 12:45:19 -0000	1.44
+++ pcmciamtd.c	21 May 2003 15:15:07 -0000	1.45
@@ -25,6 +25,7 @@
 #include <pcmcia/ds.h>
 
 #include <linux/mtd/map.h>
+#include <linux/mtd/mtd.h>
 
 #ifdef CONFIG_MTD_DEBUG
 static int debug = CONFIG_MTD_DEBUG_VERBOSE;

Index: tsunami_flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/tsunami_flash.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- tsunami_flash.c	21 May 2003 12:45:20 -0000	1.5
+++ tsunami_flash.c	21 May 2003 15:15:08 -0000	1.6
@@ -8,6 +8,7 @@
 #include <asm/core_tsunami.h>
 #include <linux/init.h>
 #include <linux/mtd/map.h>
+#include <linux/mtd/mtd.h>
 
 #define FLASH_ENABLE_PORT 0x00C00001
 #define FLASH_ENABLE_BYTE 0x01

Index: vmax301.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/vmax301.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- vmax301.c	20 May 2003 20:59:32 -0000	1.27
+++ vmax301.c	21 May 2003 15:15:08 -0000	1.28
@@ -24,6 +24,7 @@
 #include <asm/io.h>
 
 #include <linux/mtd/map.h>
+#include <linux/mtd/mtd.h>
 
 
 #define WINDOW_START 0xd8000


From dwmw2 at infradead.org  Thu May 22 14:01:05 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:26 2006
Subject: mtd/fs/jffs2 gc.c,1.102,1.103
Message-ID: <E19IuNF-0001R1-00@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv5490

Modified Files:
	gc.c 
Log Message:
Remove unnecessary second ic.


Index: gc.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/gc.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -r1.102 -r1.103
--- gc.c	29 Apr 2003 09:52:58 -0000	1.102
+++ gc.c	22 May 2003 18:01:02 -0000	1.103
@@ -122,8 +122,6 @@
 		return -EINTR;
 
 	for (;;) {
-		struct jffs2_inode_cache *ic;
-
 		spin_lock(&c->erase_completion_lock);
 		if (!c->unchecked_size)
 			break;


From dwmw2 at infradead.org  Fri May 23 07:25:05 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:26 2006
Subject: mtd/include/linux/mtd nftl.h,1.12,1.13
Message-ID: <E19JAfZ-0005mG-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv22206/include/linux/mtd

Modified Files:
	nftl.h 
Log Message:
remove unused nr_sects

Index: nftl.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/nftl.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- nftl.h	20 May 2003 15:36:29 -0000	1.12
+++ nftl.h	23 May 2003 11:25:02 -0000	1.13
@@ -95,7 +95,6 @@
 	__u16 lastEUN;                  /* should be suppressed */
 	__u16 numfreeEUNs;
 	__u16 LastFreeEUN; 		/* To speed up finding a free EUN */
-	__u32 nr_sects;
 	int head,sect,cyl;
 	__u16 *EUNtable; 		/* [numvunits]: First EUN for each virtual unit  */
 	__u16 *ReplUnitTable; 		/* [numEUNs]: ReplUnitNumber for each */
@@ -112,7 +111,7 @@
 #endif
 
 #define MAX_NFTLS 16
-#define MAX_SECTORS_PER_UNIT 32
+#define MAX_SECTORS_PER_UNIT 64
 #define NFTL_PARTN_BITS 4
 
 #endif /* __KERNEL__ */


From dwmw2 at infradead.org  Fri May 23 07:28:48 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:26 2006
Subject: mtd/drivers/mtd/devices doc2001plus.c,NONE,1.4
Message-ID: <E19JAjA-0005mm-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/devices
In directory phoenix.infradead.org:/tmp/cvs-serv22235/drivers/mtd/devices

Added Files:
      Tag: 1.4
	doc2001plus.c 
Log Message:
New DiskOnChip Millennium Plus driver from SnapGear


***** Error reading new file: [Errno 2] No such file or directory: 'doc2001plus.c'

From dwmw2 at infradead.org  Fri May 23 07:29:36 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:26 2006
Subject: mtd/include/linux/mtd doc2000.h,1.15,1.16
Message-ID: <E19JAjw-0005nJ-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv22251/include/linux/mtd

Modified Files:
	doc2000.h 
Log Message:
Updates for new DiskOnChip Millennium Plus driver.


Index: doc2000.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/doc2000.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- doc2000.h	19 Sep 2001 00:22:15 -0000	1.15
+++ doc2000.h	23 May 2003 11:29:33 -0000	1.16
@@ -38,6 +38,35 @@
 #define DoC_Mil_CDSN_IO 	0x0800
 #define DoC_2k_CDSN_IO 		0x1800
 
+#define DoC_Mplus_NOP			0x1002
+#define DoC_Mplus_AliasResolution	0x1004
+#define DoC_Mplus_DOCControl		0x1006
+#define DoC_Mplus_AccessStatus		0x1008
+#define DoC_Mplus_DeviceSelect		0x1008
+#define DoC_Mplus_Configuration		0x100a
+#define DoC_Mplus_OutputControl		0x1002
+#define DoC_Mplus_FlashControl		0x1020
+#define DoC_Mplus_FlashSelect 		0x1022
+#define DoC_Mplus_FlashCmd		0x1024
+#define DoC_Mplus_FlashAddress		0x1026
+#define DoC_Mplus_FlashData0		0x1028
+#define DoC_Mplus_FlashData1		0x1029
+#define DoC_Mplus_ReadPipeInit		0x102a
+#define DoC_Mplus_LastDataRead		0x102c
+#define DoC_Mplus_LastDataRead1		0x102d
+#define DoC_Mplus_WritePipeTerm 	0x102e
+#define DoC_Mplus_ECCSyndrome0		0x1040
+#define DoC_Mplus_ECCSyndrome1		0x1041
+#define DoC_Mplus_ECCSyndrome2		0x1042
+#define DoC_Mplus_ECCSyndrome3		0x1043
+#define DoC_Mplus_ECCSyndrome4		0x1044
+#define DoC_Mplus_ECCSyndrome5		0x1045
+#define DoC_Mplus_ECCConf 		0x1046
+#define DoC_Mplus_Toggle		0x1046
+#define DoC_Mplus_DownloadStatus	0x1074
+#define DoC_Mplus_CtrlConfirm		0x1076
+#define DoC_Mplus_Power			0x1fff
+
 /* How to access the device? 
  * On ARM, it'll be mmap'd directly with 32-bit wide accesses. 
  * On PPC, it's mmap'd and 16-bit wide.
@@ -71,13 +100,20 @@
 #define DOC_MODE_RESERVED1 	2
 #define DOC_MODE_RESERVED2 	3
 
-#define DOC_MODE_MDWREN 	4
 #define DOC_MODE_CLR_ERR 	0x80
+#define	DOC_MODE_RST_LAT	0x10
+#define	DOC_MODE_BDECT		0x08
+#define DOC_MODE_MDWREN 	0x04
 
 #define DOC_ChipID_Doc2k 	0x20
 #define DOC_ChipID_DocMil 	0x30
+#define DOC_ChipID_DocMilPlus32	0x40
+#define DOC_ChipID_DocMilPlus16	0x41
 
 #define CDSN_CTRL_FR_B 		0x80
+#define CDSN_CTRL_FR_B0		0x40
+#define CDSN_CTRL_FR_B1		0x80
+
 #define CDSN_CTRL_ECC_IO 	0x20
 #define CDSN_CTRL_FLASH_IO 	0x10
 #define CDSN_CTRL_WP 		0x08
@@ -93,6 +129,10 @@
 #define DOC_ECC_RESV 		0x02
 #define DOC_ECC_IGNORE		0x01
 
+#define DOC_FLASH_CE		0x80
+#define DOC_FLASH_WP		0x40
+#define DOC_FLASH_BANK		0x02
+
 /* We have to also set the reserved bit 1 for enable */
 #define DOC_ECC_EN (DOC_ECC__EN | DOC_ECC_RESV)
 #define DOC_ECC_DIS (DOC_ECC_RESV)
@@ -110,6 +150,9 @@
 #define MAX_FLOORS_MIL 4
 #define MAX_CHIPS_MIL 1
 
+#define MAX_FLOORS_MPLUS 1
+#define MAX_CHIPS_MPLUS 1
+
 #define ADDR_COLUMN 1
 #define ADDR_PAGE 2
 #define ADDR_COLUMN_PAGE 3
@@ -126,6 +169,7 @@
 	int chipshift;
 	char page256;
 	char pageadrlen;
+	char interleave; /* Internal interleaving - Millennium Plus style */
 	unsigned long erasesize;
 	
 	int curfloor;


From dwmw2 at infradead.org  Fri May 23 07:29:37 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:26 2006
Subject: mtd/drivers/mtd/nand Config.in,1.11,1.12
Message-ID: <E19JAjx-0005nU-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv22251/drivers/mtd/nand

Modified Files:
	Config.in 
Log Message:
Updates for new DiskOnChip Millennium Plus driver.


Index: Config.in
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/Config.in,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Config.in	1 Dec 2002 13:23:05 -0000	1.11
+++ Config.in	23 May 2003 11:29:34 -0000	1.12
@@ -23,14 +23,12 @@
    dep_tristate '  NAND Flash device on EDP7312 board' CONFIG_MTD_NAND_EDB7312 $CONFIG_MTD_NAND
 fi
 
-if [ "$CONFIG_MTD_DOC2001" = "y" -o "$CONFIG_MTD_DOC2000" = "y" -o "$CONFIG_MTD_NAND" = "y" ]; then
+if [ "$CONFIG_MTD_DOC2001PLUS" = "y" -o "$CONFIG_MTD_DOC2001" = "y" -o "$CONFIG_MTD_DOC2000" = "y" -o "$CONFIG_MTD_NAND" = "y" ]; then
    define_bool CONFIG_MTD_NAND_IDS y
-fi
-
-if [ "$CONFIG_MTD_NAND_IDS" != "y" ]; then
-if [ "$CONFIG_MTD_DOC2001" = "m" -o "$CONFIG_MTD_DOC2000" = "m" -o "$CONFIG_MTD_NAND" = "m" ]; then
-   define_bool CONFIG_MTD_NAND_IDS m
-fi
+else
+  if [ "$CONFIG_MTD_DOC2001PLUS" = "m" -o "$CONFIG_MTD_DOC2001" = "m" -o "$CONFIG_MTD_DOC2000" = "m" -o "$CONFIG_MTD_NAND" = "m" ]; then
+     define_bool CONFIG_MTD_NAND_IDS m
+  fi
 fi
 
 endmenu


From dwmw2 at infradead.org  Fri May 23 07:29:37 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:26 2006
Subject: mtd/drivers/mtd/devices Config.in,1.9,1.10 Kconfig,1.1,1.2
 Makefile.common,1.1,1.2 docprobe.c,1.35,1.36
Message-ID: <E19JAjx-0005nO-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/devices
In directory phoenix.infradead.org:/tmp/cvs-serv22251/drivers/mtd/devices

Modified Files:
	Config.in Kconfig Makefile.common docprobe.c 
Log Message:
Updates for new DiskOnChip Millennium Plus driver.


Index: Config.in
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/Config.in,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Config.in	10 Feb 2003 12:28:13 -0000	1.9
+++ Config.in	23 May 2003 11:29:34 -0000	1.10
@@ -31,10 +31,11 @@
    dep_tristate '  M-Systems Disk-On-Chip 1000' CONFIG_MTD_DOC1000 $CONFIG_MTD
    dep_tristate '  M-Systems Disk-On-Chip 2000 and Millennium' CONFIG_MTD_DOC2000 $CONFIG_MTD
    dep_tristate '  M-Systems Disk-On-Chip Millennium-only alternative driver (see help)' CONFIG_MTD_DOC2001 $CONFIG_MTD
-   if [ "$CONFIG_MTD_DOC2001" = "y" -o "$CONFIG_MTD_DOC2000" = "y" ]; then
+   dep_tristate '  M-Systems Disk-On-Chip Millennium Plus driver (see help)' CONFIG_MTD_DOC2001PLUS $CONFIG_MTD
+   if [ "$CONFIG_MTD_DOC2001PLUS" = "y" -o "$CONFIG_MTD_DOC2001" = "y" -o "$CONFIG_MTD_DOC2000" = "y" ]; then
       define_bool CONFIG_MTD_DOCPROBE y
    else
-      if [ "$CONFIG_MTD_DOC2001" = "m" -o "$CONFIG_MTD_DOC2000" = "m" ]; then
+      if [ "$CONFIG_MTD_DOC2001PLUS" = "m" -o "$CONFIG_MTD_DOC2001" = "m" -o "$CONFIG_MTD_DOC2000" = "m" ]; then
 	 define_bool CONFIG_MTD_DOCPROBE m
       else
 	 define_bool CONFIG_MTD_DOCPROBE n

Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/Kconfig,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Kconfig	26 Nov 2002 22:30:06 -0000	1.1
+++ Kconfig	23 May 2003 11:29:34 -0000	1.2
@@ -148,10 +148,26 @@
 	  emulate a block device by using a kind of file system on the flash
 	  chips.
 
+config MTD_DOC2001PLUS
+	tristate "M-Systems Disk-On-Chip Millennium-only alternative driver (see help)"
+	depends on MTD
+	---help---
+	  This provides an alternative MTD device driver for the M-Systems 
+	  DiskOnChip Millennium devices.  Use this if you have problems with
+	  the combined DiskOnChip 2000 and Millennium driver above.  To get
+	  the DiskOnChip probe code to load and use this driver instead of
+	  the other one, you will need to undefine DOC_SINGLE_DRIVER near
+	  the beginning of <file:drivers/mtd/devices/docprobe.c>.
+
+	  If you use this device, you probably also want to enable the NFTL
+	  'NAND Flash Translation Layer' option below, which is used to
+	  emulate a block device by using a kind of file system on the flash
+	  chips.
+
 config MTD_DOCPROBE
 	tristate
-	default m if MTD_DOC2001!=y && MTD_DOC2000!=y && (MTD_DOC2001=m || MTD_DOC2000=m)
-	default y if MTD_DOC2001=y || MTD_DOC2000=y
+	default m if MTD_DOC2001!=y && MTD_DOC2000!=y && MTD_DOC2001PLUS!=y && (MTD_DOC2001=m || MTD_DOC2000=m || MOD_DOC2001PLUS=m)
+	default y if MTD_DOC2001=y || MTD_DOC2000=y || MTD_DOC2001PLUS=y
 	help
 	  This isn't a real config option, it's derived.
 

Index: Makefile.common
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/Makefile.common,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile.common	21 May 2003 15:00:02 -0000	1.1
+++ Makefile.common	23 May 2003 11:29:34 -0000	1.2
@@ -18,6 +18,7 @@
 obj-$(CONFIG_MTD_DOC1000)	+= doc1000.o
 obj-$(CONFIG_MTD_DOC2000)	+= doc2000.o
 obj-$(CONFIG_MTD_DOC2001)	+= doc2001.o
+obj-$(CONFIG_MTD_DOC2001PLUS)	+= doc2001plus.o
 obj-$(CONFIG_MTD_DOCPROBE)	+= docprobe.o docecc.o
 obj-$(CONFIG_MTD_SLRAM)		+= slram.o
 obj-$(CONFIG_MTD_PMC551)	+= pmc551.o

Index: docprobe.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/docprobe.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- docprobe.c	21 May 2003 15:15:06 -0000	1.35
+++ docprobe.c	23 May 2003 11:29:34 -0000	1.36
@@ -31,14 +31,12 @@
 /* DOC_SINGLE_DRIVER:
    Millennium driver has been merged into DOC2000 driver.
 
-   The newly-merged driver doesn't appear to work for writing. It's the
-   same with the DiskOnChip 2000 and the Millennium. If you have a 
-   Millennium and you want write support to work, remove the definition
-   of DOC_SINGLE_DRIVER below to use the old doc2001-specific driver.
-
-   Otherwise, it's left on in the hope that it'll annoy someone with
-   a Millennium enough that they go through and work out what the 
-   difference is :)
+   The old Millennium-only driver has been retained just in case there
+   are problems with the new code. If the combined driver doesn't work
+   for you, you can try the old one by undefining DOC_SINGLE_DRIVER 
+   below and also enabling it in your configuration. If this fixes the
+   problems, please send a report to the MTD mailing list at 
+   <linux-mtd@lists.infradead.org>.
 */
 #define DOC_SINGLE_DRIVER
 
@@ -92,14 +90,14 @@
 ##else
 #warning Unknown architecture for DiskOnChip. No default probe locations defined
 #endif
-	0 };
+	0xffffffff };
 
 /* doccheck: Probe a given memory window to see if there's a DiskOnChip present */
 
 static inline int __init doccheck(unsigned long potential, unsigned long physadr)
 {
 	unsigned long window=potential;
-	unsigned char tmp, ChipID;
+	unsigned char tmp, tmpb, tmpc, ChipID;
 #ifndef DOC_PASSIVE_PROBE
 	unsigned char tmp2;
 #endif
@@ -142,19 +140,65 @@
 	switch (ChipID) {
 	case DOC_ChipID_Doc2k:
 		/* Check the TOGGLE bit in the ECC register */
-		tmp = ReadDOC(window, 2k_ECCStatus) & DOC_TOGGLE_BIT;
-		if ((ReadDOC(window, 2k_ECCStatus) & DOC_TOGGLE_BIT) != tmp)
+		tmp  = ReadDOC(window, 2k_ECCStatus) & DOC_TOGGLE_BIT;
+		tmpb = ReadDOC(window, 2k_ECCStatus) & DOC_TOGGLE_BIT;
+		tmpc = ReadDOC(window, 2k_ECCStatus) & DOC_TOGGLE_BIT;
+		if (tmp != tmpb && tmp == tmpc)
 				return ChipID;
 		break;
 		
 	case DOC_ChipID_DocMil:
 		/* Check the TOGGLE bit in the ECC register */
-		tmp = ReadDOC(window, ECCConf) & DOC_TOGGLE_BIT;
-		if ((ReadDOC(window, ECCConf) & DOC_TOGGLE_BIT) != tmp)
+		tmp  = ReadDOC(window, ECCConf) & DOC_TOGGLE_BIT;
+		tmpb = ReadDOC(window, ECCConf) & DOC_TOGGLE_BIT;
+		tmpc = ReadDOC(window, ECCConf) & DOC_TOGGLE_BIT;
+		if (tmp != tmpb && tmp == tmpc)
 				return ChipID;
 		break;
 		
+	case DOC_ChipID_DocMilPlus16:
+	case DOC_ChipID_DocMilPlus32:
+	case 0:
+		/* Possible Millennium+, need to do more checks */
+#ifndef DOC_PASSIVE_PROBE
+		/* Possibly release from power down mode */
+		for (tmp = 0; (tmp < 4); tmp++)
+			ReadDOC(window, Mplus_Power);
+
+		/* Reset the DiskOnChip ASIC */
+		tmp = DOC_MODE_RESET | DOC_MODE_MDWREN | DOC_MODE_RST_LAT |
+			DOC_MODE_BDECT;
+		WriteDOC(tmp, window, Mplus_DOCControl);
+		WriteDOC(~tmp, window, Mplus_CtrlConfirm);
+	
+		mdelay(1);
+		/* Enable the DiskOnChip ASIC */
+		tmp = DOC_MODE_NORMAL | DOC_MODE_MDWREN | DOC_MODE_RST_LAT |
+			DOC_MODE_BDECT;
+		WriteDOC(tmp, window, Mplus_DOCControl);
+		WriteDOC(~tmp, window, Mplus_CtrlConfirm);
+		mdelay(1);
+#endif /* !DOC_PASSIVE_PROBE */	
+
+		ChipID = ReadDOC(window, ChipID);
+
+		switch (ChipID) {
+		case DOC_ChipID_DocMilPlus16:
+		case DOC_ChipID_DocMilPlus32:
+			/* Check the TOGGLE bit in the toggle register */
+			tmp  = ReadDOC(window, Mplus_Toggle) & DOC_TOGGLE_BIT;
+			tmpb = ReadDOC(window, Mplus_Toggle) & DOC_TOGGLE_BIT;
+			tmpc = ReadDOC(window, Mplus_Toggle) & DOC_TOGGLE_BIT;
+			if (tmp != tmpb && tmp == tmpc)
+					return ChipID;
+			break;
+		default:
+			break;
+		}
+		/* FALL TRHU */
+
 	default:
+
 #ifndef CONFIG_MTD_DOCPROBE_55AA
 		printk(KERN_WARNING "Possible DiskOnChip with unknown ChipID %2.2X found at 0x%lx\n",
 		       ChipID, physadr);
@@ -234,6 +278,13 @@
 			im_modname = "doc2001";
 #endif /* DOC_SINGLE_DRIVER */
 			break;
+
+		case DOC_ChipID_DocMilPlus16:
+		case DOC_ChipID_DocMilPlus32:
+			name="MillenniumPlus";
+			im_funcname = "DoCMilPlus_init";
+			im_modname = "doc2001plus";
+			break;
 		}
 
 		if (im_funcname)
@@ -265,7 +316,7 @@
 		printk(KERN_INFO "Using configured DiskOnChip probe address 0x%lx\n", doc_config_location);
 		DoC_Probe(doc_config_location);
 	} else {
-		for (i=0; doc_locations[i]; i++) {
+		for (i=0; (doc_locations[i] != 0xffffffff); i++) {
 			DoC_Probe(doc_locations[i]);
 		}
 	}


From dwmw2 at infradead.org  Fri May 23 07:31:49 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:26 2006
Subject: mtd/drivers/mtd nftlcore.c,1.90,1.91
Message-ID: <E19JAm5-0005oY-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv22341/drivers/mtd

Modified Files:
	nftlcore.c 
Log Message:
cleanups inspired by inftl

Index: nftlcore.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nftlcore.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -r1.90 -r1.91
--- nftlcore.c	21 May 2003 13:18:21 -0000	1.90
+++ nftlcore.c	23 May 2003 11:31:46 -0000	1.91
@@ -46,12 +46,12 @@
 	if (mtd->ecctype != MTD_ECC_RS_DiskOnChip)
 		return;
 
-	DEBUG(MTD_DEBUG_LEVEL1, "nftl_add_mtd for %s\n", mtd->name);
+	DEBUG(MTD_DEBUG_LEVEL1, "NFTL: add_mtd for %s\n", mtd->name);
 
 	nftl = kmalloc(sizeof(struct NFTLrecord), GFP_KERNEL);
 
 	if (!nftl) {
-		printk(KERN_WARNING "Out of memory for NFTL data structures\n");
+		printk(KERN_WARNING "NFTL: out of memory for data structures\n");
 		return;
 	}
 	memset(nftl, 0, sizeof(*nftl));
@@ -62,7 +62,7 @@
 	nftl->mbd.tr = tr;
 
         if (NFTL_mount(nftl) < 0) {
-		printk(KERN_WARNING "Could not mount NFTL device\n");
+		printk(KERN_WARNING "NFTL: could not mount device\n");
 		kfree(nftl);
 		return;
         }
@@ -92,11 +92,13 @@
 		  Oh no we don't have 
 		   mbd.size == heads * cylinders * sectors
 		*/
-		printk(KERN_WARNING "Cannot calculate an NFTL geometry to "
-		       "precisely match size of 0x%lx.\n", nftl->mbd.size);
-		printk(KERN_WARNING "Using C:%d H:%d S:%d (== 0x%lx sects)\n", 
-		       nftl->cylinders, nftl->heads , nftl->sectors, 
-		       (long)nftl->cylinders * (long)nftl->heads * (long)nftl->sectors );
+		printk(KERN_WARNING "NFTL: cannot calculate a geometry to "
+		       "match size of 0x%lx.\n", nftl->mbd.size);
+		printk(KERN_WARNING "NFTL: using C:%d H:%d S:%d "
+			"(== 0x%lx sects)\n",
+			nftl->cylinders, nftl->heads , nftl->sectors, 
+			(long)nftl->cylinders * (long)nftl->heads *
+			(long)nftl->sectors );
 	}
 
 	if (add_mtd_blktrans_dev) {
@@ -108,16 +110,15 @@
 		return;
 	}
 #ifdef PSYCHO_DEBUG
-	printk("Found new NFTL nftl%c\n", nftl->mbd.devnum + 'a');
+	printk(KERN_INFO "NFTL: Found new nftl%c\n", nftl->mbd.devnum + 'a');
 #endif
-	return;
 }
 
 static void nftl_remove_dev(struct mtd_blktrans_dev *dev)
 {
 	struct NFTLrecord *nftl = (void *)dev;
 
-	DEBUG(MTD_DEBUG_LEVEL1, "nftl_remove_dev %d\n", dev->devnum);
+	DEBUG(MTD_DEBUG_LEVEL1, "NFTL: remove_dev (i=%d)\n", dev->devnum);
 
 	del_mtd_blktrans_dev(dev);
 	if (nftl->ReplUnitTable)


From dwmw2 at infradead.org  Fri May 23 07:34:57 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:26 2006
Subject: mtd/drivers/mtd inftlcore.c,NONE,1.8
Message-ID: <E19JAp7-0005qA-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv22449

Added Files:
      Tag: 1.8
	inftlcore.c 
Log Message:
New INFTL code from SnapGear

***** Error reading new file: [Errno 2] No such file or directory: 'inftlcore.c'

From dwmw2 at infradead.org  Fri May 23 07:35:09 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:26 2006
Subject: mtd/drivers/mtd inftlmount.c,NONE,1.9
Message-ID: <E19JApJ-0005qK-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv22459

Added Files:
      Tag: 1.9
	inftlmount.c 
Log Message:
New INFTL code from SnapGear

***** Error reading new file: [Errno 2] No such file or directory: 'inftlmount.c'

From dwmw2 at infradead.org  Fri May 23 07:35:37 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:26 2006
Subject: mtd/include/linux/mtd inftl.h,NONE,1.3
Message-ID: <E19JApl-0005qc-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv22477

Added Files:
      Tag: 1.3
	inftl.h 
Log Message:
New INFTL code from SnapGear

***** Error reading new file: [Errno 2] No such file or directory: 'inftl.h'

From dwmw2 at infradead.org  Fri May 23 07:38:32 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:27 2006
Subject: 
 mtd/drivers/mtd Config.in,1.74,1.75 Kconfig,1.1,1.2 Makefile.common,1.1,1.2
Message-ID: <E19JAsa-0005rf-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv22538/drivers/mtd

Modified Files:
	Config.in Kconfig Makefile.common 
Log Message:
Makefile and config bits for INFTL

Index: Config.in
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/Config.in,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- Config.in	23 Apr 2002 13:52:14 -0000	1.74
+++ Config.in	23 May 2003 11:38:29 -0000	1.75
@@ -30,6 +30,7 @@
    if [ "$CONFIG_NFTL" = "y" -o "$CONFIG_NFTL" = "m" ]; then
       bool '    Write support for NFTL (BETA)' CONFIG_NFTL_RW
    fi
+   dep_tristate '  INFTL (Inverse NAND Flash Translation Layer) support' CONFIG_INFTL $CONFIG_MTD
 
    source drivers/mtd/chips/Config.in
 

Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/Kconfig,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Kconfig	26 Nov 2002 22:29:08 -0000	1.1
+++ Kconfig	23 May 2003 11:38:29 -0000	1.2
@@ -207,6 +207,23 @@
 	  <linux-mtd@lists.infradead.org> if you want to help to make it more
 	  reliable.
 
+config INFTL
+	tristate "INFTL (Inverse NAND Flash Translation Layer) support"
+	depends on MTD
+	---help---
+	  This provides support for the Inverse NAND Flash Translation 
+	  Layer which is used on M-Systems' newer DiskOnChip devices. It
+	  uses a kind of pseudo-file system on a flash device to emulate
+	  a block device with 512-byte sectors, on top of which you put
+	  a 'normal' file system.
+
+	  You may find that the algorithms used in this code are patented
+	  unless you live in the Free World where software patents aren't
+	  legal - in the USA you are only permitted to use this on DiskOnChip
+	  hardware, although under the terms of the GPL you're obviously
+	  permitted to copy, modify and distribute the code as you wish. Just
+	  not use it.
+
 source "drivers/mtd/chips/Kconfig"
 
 source "drivers/mtd/maps/Kconfig"

Index: Makefile.common
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/Makefile.common,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile.common	21 May 2003 15:00:00 -0000	1.1
+++ Makefile.common	23 May 2003 11:38:29 -0000	1.2
@@ -33,8 +33,10 @@
 obj-$(CONFIG_MTD_BLOCK_RO)	+= mtdblock_ro.o mtd_blkdevs.o
 obj-$(CONFIG_FTL)		+= ftl.o mtd_blkdevs.o
 obj-$(CONFIG_NFTL)		+= nftl.o mtd_blkdevs.o
+obj-$(CONFIG_INFTL)		+= inftl.o mtd_blkdevs.o
 
 nftl-objs		:= nftlcore.o nftlmount.o
+inftl-objs		:= inftlcore.o inftlmount.o
 
 ifeq ($(PATCHLEVEL),4)
 
@@ -48,7 +50,7 @@
 
 O_TARGET	:= mtdlink.o
 
-list-multi	:= nftl.o mtd_blkdevs.o
+list-multi	:= nftl.o inftl.o mtd_blkdevs.o
 
 mod-subdirs	:= 
 subdir-y	:= chips maps devices nand
@@ -58,6 +60,9 @@
 
 nftl.o: $(nftl-objs)
 	$(LD) -r -o $@ $(nftl-objs)
+
+inftl.o: $(inftl-objs)
+	$(LD) -r -o $@ $(inftl-objs)
 
 mtd_blkdevs.o: $(mtd_blkdevs-objs)
 	$(LD) -r -o $@ $(mtd_blkdevs-objs)


From dwmw2 at infradead.org  Fri May 23 07:38:49 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:27 2006
Subject: mtd/drivers/mtd defconfig,1.2,1.3
Message-ID: <E19JAsr-0005rq-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv22552/drivers/mtd

Modified Files:
	defconfig 
Log Message:
defaults for doc2001plus and inftl

Index: defconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/defconfig,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- defconfig	21 May 2003 15:00:00 -0000	1.2
+++ defconfig	23 May 2003 11:38:47 -0000	1.3
@@ -9,6 +9,7 @@
 CONFIG_MTD_BLOCK := m
 CONFIG_FTL := m
 CONFIG_NFTL := m
+CONFIG_INFTL := m
 CONFIG_MTD_CFI := m
 CONFIG_MTD_CFI_AMDSTD := m
 CONFIG_MTD_CFI_INTELEXT := m
@@ -22,6 +23,7 @@
 CONFIG_MTD_DOC1000 := m
 CONFIG_MTD_DOC2000 := m
 CONFIG_MTD_DOC2001 := m
+CONFIG_MTD_DOC2001PLUS := m
 CONFIG_MTD_DOCPROBE := m
 CONFIG_MTD_SLRAM := m
 CONFIG_MTD_PMC551 := $(CONFIG_PCI)


From dwmw2 at infradead.org  Fri May 23 07:41:50 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:27 2006
Subject: mtd/drivers/mtd nftlcore.c,1.91,1.92 inftlcore.c,1.8,1.9
Message-ID: <E19JAvm-0006Kr-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv24245

Modified Files:
	nftlcore.c inftlcore.c 
Log Message:
Ignore BLKFLSBUF

Index: nftlcore.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nftlcore.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -r1.91 -r1.92
--- nftlcore.c	23 May 2003 11:31:46 -0000	1.91
+++ nftlcore.c	23 May 2003 11:41:47 -0000	1.92
@@ -716,9 +716,6 @@
 		return copy_to_user((void *)arg, &g, sizeof g) ? -EFAULT : 0;
 	}
 
-	case BLKFLSBUF:
-		return 0;
-
 	default:
 		return -ENOTTY;
 	}

Index: inftlcore.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/inftlcore.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- inftlcore.c	23 May 2003 11:34:55 -0000	1.8
+++ inftlcore.c	23 May 2003 11:41:47 -0000	1.9
@@ -853,9 +853,6 @@
 		return copy_to_user((void *)arg, &g, sizeof g) ? -EFAULT : 0;
 	}
 
-	case BLKFLSBUF:
-		return 0;
-
 	default:
 		return -ENOTTY;
 	}


From dwmw2 at infradead.org  Fri May 23 08:23:30 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:27 2006
Subject: mtd/drivers/mtd/chips cfi_cmdset_0001.c,1.119,1.120
 cfi_cmdset_0002.c,1.72,1.73 cfi_cmdset_0020.c,1.4,1.5
Message-ID: <E19JBa6-0006XX-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv25136

Modified Files:
	cfi_cmdset_0001.c cfi_cmdset_0002.c cfi_cmdset_0020.c 
Log Message:
include init.h

Index: cfi_cmdset_0001.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0001.c,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -r1.119 -r1.120
--- cfi_cmdset_0001.c	21 May 2003 15:15:04 -0000	1.119
+++ cfi_cmdset_0001.c	23 May 2003 12:23:26 -0000	1.120
@@ -21,6 +21,7 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <asm/byteorder.h>
 

Index: cfi_cmdset_0002.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0002.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- cfi_cmdset_0002.c	21 May 2003 15:15:04 -0000	1.72
+++ cfi_cmdset_0002.c	23 May 2003 12:23:27 -0000	1.73
@@ -16,6 +16,7 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <asm/byteorder.h>
 

Index: cfi_cmdset_0020.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0020.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- cfi_cmdset_0020.c	21 May 2003 15:15:05 -0000	1.4
+++ cfi_cmdset_0020.c	23 May 2003 12:23:27 -0000	1.5
@@ -21,6 +21,7 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <asm/byteorder.h>
 


From dwmw2 at infradead.org  Fri May 23 08:30:07 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:27 2006
Subject: mtd/drivers/mtd/chips cfi_probe.c,1.69,1.70
Message-ID: <E19JBgV-0006Yr-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv25218

Modified Files:
	cfi_probe.c 
Log Message:
Include init.h


Index: cfi_probe.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_probe.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- cfi_probe.c	11 May 2002 22:13:03 -0000	1.69
+++ cfi_probe.c	23 May 2003 12:30:04 -0000	1.70
@@ -8,6 +8,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <asm/io.h>
 #include <asm/byteorder.h>
 #include <linux/errno.h>


From dwmw2 at infradead.org  Fri May 23 08:31:23 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:27 2006
Subject: mtd/drivers/mtd/maps Kconfig,1.7,1.8 Config.in,1.49,1.50
Message-ID: <E19JBhj-0006ZF-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv25243

Modified Files:
	Kconfig Config.in 
Log Message:
Fix CONFIG_MBX dependency

Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Kconfig,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Kconfig	14 May 2003 15:05:14 -0000	1.7
+++ Kconfig	23 May 2003 12:31:20 -0000	1.8
@@ -184,7 +184,7 @@
 
 config MTD_MBX860
 	tristate "System flash on MBX860 board"
-	depends on MTD_CFI && PPC32 && 8xx && MBX860
+	depends on MTD_CFI && PPC32 && 8xx && MBX
 	help
 	  This enables access routines for the flash chips on the Motorola
 	  MBX860 board. If you have one of these boards and would like

Index: Config.in
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Config.in,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- Config.in	17 May 2003 00:00:51 -0000	1.49
+++ Config.in	23 May 2003 12:31:21 -0000	1.50
@@ -48,7 +48,7 @@
     if [ "$CONFIG_RPXLITE" = "y" -o "$CONFIG_RPXCLASSIC" = "y" ]; then
       dep_tristate '  CFI Flash device mapped on RPX Lite or CLLF' CONFIG_MTD_RPXLITE $CONFIG_MTD_CFI
     fi
-    if [ "$CONFIG_MBX860" = "y" ]; then
+    if [ "$CONFIG_MBX" = "y" ]; then
       dep_tristate '  System flash on MBX860 board' CONFIG_MTD_MBX860 $CONFIG_MTD_CFI
     fi
     dep_tristate '  CFI Flash device mapped on D-Box2' CONFIG_MTD_DBOX2 $CONFIG_MTD_CFI


From dwmw2 at infradead.org  Sun May 25 06:08:39 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:27 2006
Subject: mtd/drivers/mtd mtdchar-compat.c,1.3,NONE
Message-ID: <E19JsQh-0001vI-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv7374

Removed Files:
	mtdchar-compat.c 
Log Message:
Remove 2.2 compat mtdchar

--- mtdchar-compat.c DELETED ---


From dwmw2 at infradead.org  Mon May 26 04:50:39 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:27 2006
Subject: mtd/drivers/mtd/maps sbc_gxx.c,1.25,1.26
Message-ID: <E19KDgl-0005LA-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv20509

Modified Files:
	sbc_gxx.c 
Log Message:
Correct check for request_region success


Index: sbc_gxx.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sbc_gxx.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- sbc_gxx.c	21 May 2003 15:12:01 -0000	1.25
+++ sbc_gxx.c	26 May 2003 08:50:36 -0000	1.26
@@ -242,7 +242,7 @@
 		return -EIO;
 	}
 	
-	if (request_region( PAGE_IO, PAGE_IO_SIZE, "SBC-GXx flash")) {
+	if (!request_region( PAGE_IO, PAGE_IO_SIZE, "SBC-GXx flash")) {
 		printk( KERN_ERR"%s: IO ports 0x%x-0x%x in use\n",
 			sbc_gxx_map.name,
 			PAGE_IO, PAGE_IO+PAGE_IO_SIZE-1 );


From dwmw2 at infradead.org  Mon May 26 05:15:22 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:27 2006
Subject: mtd/fs/jffs2 compr_zlib.c,1.22,1.23
Message-ID: <E19KE4g-0005OB-00@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv20696

Modified Files:
	compr_zlib.c 
Log Message:
Fix includes


Index: compr_zlib.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/compr_zlib.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- compr_zlib.c	12 Jan 2003 13:21:28 -0000	1.22
+++ compr_zlib.c	26 May 2003 09:15:19 -0000	1.23
@@ -17,7 +17,8 @@
 
 #include <linux/config.h>
 #include <linux/kernel.h>
-#include <linux/mtd/compatmac.h> /* for min() */
+#include <linux/vmalloc.h>
+#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/zlib.h>
 #include <linux/zutil.h>


From dwmw2 at infradead.org  Mon May 26 05:25:15 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:27 2006
Subject: mtd/drivers/mtd/chips cfi_cmdset_0001.c,1.120,1.121
Message-ID: <E19KEEF-0005PZ-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv20780

Modified Files:
	cfi_cmdset_0001.c 
Log Message:
Include compatmac.h before cfi.h since the latter uses cond_resched().
Now the compatmac.h is less intrusive, p'raps we could make cfi.h
include it itself, but for compat crap I'm not too worried about headers
including stuff on which they depend. It's not an issue for non-ancient
kernels anyway.


Index: cfi_cmdset_0001.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0001.c,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -r1.120 -r1.121
--- cfi_cmdset_0001.c	23 May 2003 12:23:26 -0000	1.120
+++ cfi_cmdset_0001.c	26 May 2003 09:25:12 -0000	1.121
@@ -31,8 +31,8 @@
 #include <linux/interrupt.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/mtd.h>
-#include <linux/mtd/cfi.h>
 #include <linux/mtd/compatmac.h>
+#include <linux/mtd/cfi.h>
 
 // debugging, turns off buffer write mode if set to 1
 #define FORCE_WORD_WRITE 0


From dwmw2 at infradead.org  Mon May 26 05:39:05 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:27 2006
Subject: mtd/fs/jffs2 Makefile,1.37,1.38
Message-ID: <E19KERd-0005RY-00@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv20922

Modified Files:
	Makefile 
Log Message:
include Rules.make

Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/Makefile,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- Makefile	14 May 2003 20:26:30 -0000	1.37
+++ Makefile	26 May 2003 09:39:02 -0000	1.38
@@ -35,5 +35,6 @@
 ifeq ($(BELOW25),y)
 obj-y := $(jffs2-objs)
 O_TARGET := jffs2.o
+include $(TOPDIR)/Rules.make
 endif
 


From dwmw2 at infradead.org  Mon May 26 05:50:41 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:27 2006
Subject: mtd/fs/jffs2 background.c,1.37,1.38 dir.c,1.75,1.76 file.c,1.84,1.85
Message-ID: <E19KEcr-0005VU-00@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv21166

Modified Files:
	background.c dir.c file.c 
Log Message:
Remove compatmac.h

Index: background.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/background.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- background.c	17 May 2003 01:08:50 -0000	1.37
+++ background.c	26 May 2003 09:50:38 -0000	1.38
@@ -17,7 +17,7 @@
 #include <linux/jffs2.h>
 #include <linux/mtd/mtd.h>
 #include <linux/completion.h>
-#include <linux/mtd/compatmac.h> /* recalc_sigpending() */
+#include <linux/sched.h>
 #include <linux/unistd.h>
 #include "nodelist.h"
 

Index: dir.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/dir.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- dir.c	29 Apr 2003 09:52:58 -0000	1.75
+++ dir.c	26 May 2003 09:50:38 -0000	1.76
@@ -16,7 +16,6 @@
 #include <linux/sched.h>
 #include <linux/fs.h>
 #include <linux/crc32.h>
-#include <linux/mtd/compatmac.h> /* For completion */
 #include <linux/jffs2.h>
 #include <linux/jffs2_fs_i.h>
 #include <linux/jffs2_fs_sb.h>

Index: file.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/file.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -r1.84 -r1.85
--- file.c	23 Jan 2003 11:11:06 -0000	1.84
+++ file.c	26 May 2003 09:50:38 -0000	1.85
@@ -12,7 +12,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/mtd/compatmac.h> /* for min() */
 #include <linux/slab.h>
 #include <linux/fs.h>
 #include <linux/time.h>


From dwmw2 at infradead.org  Mon May 26 07:16:47 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:27 2006
Subject: mtd/drivers/mtd mtd_blkdevs-24.c,1.9,1.10
Message-ID: <E19KFyB-0005h7-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv21870

Modified Files:
	mtd_blkdevs-24.c 
Log Message:
Fix __MOD_DEC_USE_COUNT(NULL) oops.
Revert to proper 2.4 signal locking stuff, not O(1) scheduler version.


Index: mtd_blkdevs-24.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs-24.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- mtd_blkdevs-24.c	21 May 2003 15:15:03 -0000	1.9
+++ mtd_blkdevs-24.c	26 May 2003 11:16:44 -0000	1.10
@@ -122,7 +122,7 @@
 	   actually want to deal with signals. We can't just call 
 	   exit_sighand() since that'll cause an oops when we finally
 	   do exit. */
-#if 0
+#if 1
 	spin_lock_irq(&current->sigmask_lock);
 	sigfillset(&current->blocked);
 	recalc_sigpending(current);
@@ -241,9 +241,11 @@
 	ret = 0;
 	if (tr->open && (ret = tr->open(dev, i, f))) {
 		dev->mtd->usecount--;
-		__MOD_DEC_USE_COUNT(dev->mtd->owner);
+		if (dev->mtd->owner)
+			__MOD_DEC_USE_COUNT(dev->mtd->owner);
 	out_tr:
-		__MOD_DEC_USE_COUNT(tr->owner);
+		if (tr->owner)
+			__MOD_DEC_USE_COUNT(tr->owner);
 	}
  out:
 	up(&mtd_table_mutex);
@@ -279,8 +281,10 @@
 
 	if (!ret) {
 		dev->mtd->usecount--;
-		__MOD_DEC_USE_COUNT(dev->mtd->owner);
-		__MOD_DEC_USE_COUNT(tr->owner);
+		if (dev->mtd->owner)
+			__MOD_DEC_USE_COUNT(dev->mtd->owner);
+		if (tr->owner)
+			__MOD_DEC_USE_COUNT(tr->owner);
 	}
 	
 	up(&mtd_table_mutex);


From dwmw2 at infradead.org  Tue May 27 05:14:13 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:27 2006
Subject: mtd/patches patchin.sh,1.13,1.14
Message-ID: <E19KaX7-0001NR-00@phoenix.infradead.org>

Update of /home/cvs/mtd/patches
In directory phoenix.infradead.org:/tmp/cvs-serv5291

Modified Files:
	patchin.sh 
Log Message:
Link Makefile.common into kernel tree, not Makefile.


Index: patchin.sh
===================================================================
RCS file: /home/cvs/mtd/patches/patchin.sh,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- patchin.sh	25 Mar 2003 10:11:17 -0000	1.13
+++ patchin.sh	27 May 2003 09:14:10 -0000	1.14
@@ -19,10 +19,11 @@
 # Maybe some sed/awk experts would make it better, but I'm not
 # one of them. Feel free to make it better
 # 
-# Thomas (tgxl@linutronix.de)
+# Thomas (tglx@linutronix.de)
 #
 # $Id$
 #
+# 27-05-2003 dwmw2 Link Makefile to Makefile.common since we moved them around
 # 02-10-2003 tglx replaced grep -m by head -n 1, as older grep versions don't support -m	
 # 03-08-2003 tglx -c option for copying files to kernel tree instead of linking
 #		  moved file selection to variables
@@ -75,8 +76,13 @@
 	FILES=`ls $PATCH_FILES 2>/dev/null`
 	for FILE in $FILES 
 	do
+		if [ "$FILE" = "Makefile" ]; then
+		    SRCFILE=Makefile.common
+		else
+		    SRCFILE=$FILE
+		fi
 		rm -f $LINUXDIR/$DIR/$FILE 2>/dev/null
-		$LNCP $TOPDIR/$DIR/$FILE $LINUXDIR/$DIR
+		$LNCP $TOPDIR/$DIR/$SRCFILE $LINUXDIR/$DIR/$FILE
 	done
 	cd $LINUXDIR
 done	
@@ -162,7 +168,7 @@
 
 if [ "$ANSWER" != "y" ]
 then
-	echo Patching Kernel canceled
+	echo Patching Kernel cancelled
 	exit 1;
 fi
 
@@ -173,7 +179,7 @@
 
 cd $LINUXDIR
 
-# make directories, if neccecary
+# make directories, if necessary
 # remove existing files/links and link/copy the new ones
 echo "Patching MTD"
 PATCH_DIRS=$MTD_DIRS


From dwmw2 at infradead.org  Tue May 27 05:34:44 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:28 2006
Subject: mtd/fs/jffs2 Makefile.common,NONE,1.1 Makefile,1.38,1.39
 GNUmakefile,1.7,1.8
Message-ID: <E19Kaqy-0001UE-00@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv5712

Modified Files:
	Makefile GNUmakefile 
Added Files:
	Makefile.common 
Log Message:
Makefile cleanups

***** Error reading new file: [Errno 2] No such file or directory: 'Makefile.common'
Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/Makefile,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- Makefile	26 May 2003 09:39:02 -0000	1.38
+++ Makefile	27 May 2003 09:34:41 -0000	1.39
@@ -1,40 +1,18 @@
 #
-# Makefile for the linux Journalling Flash FileSystem (JFFS) routines.
+# Out of tree fs/jffs2/Makefile
 #
 # $Id$
-#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
-#
-# Note 2! The CFLAGS definitions are now in the main makefile...
-
-
-obj-$(CONFIG_JFFS2_FS) := jffs2.o
-
-COMPR_OBJS	:= compr.o compr_rubin.o compr_rtime.o compr_zlib.o
-JFFS2_OBJS	:= dir.o file.o ioctl.o nodelist.o malloc.o \
-	read.o nodemgmt.o readinode.o write.o scan.o gc.o \
-	symlink.o build.o erase.o background.o fs.o writev.o
-
-BELOW25		:= $(shell echo $(PATCHLEVEL) | sed s/[1234]/y/)
-
-ifeq ($(BELOW25),y)
-LINUX_OBJS	:= super-v24.o crc32.o rbtree.o
-else
-LINUX_OBJS	:= super.o
-endif
 
-NAND_OBJS-$(CONFIG_JFFS2_FS_NAND)	:= wbuf.o
+include $(mtd)/defconfig
 
-jffs2-objs := $(COMPR_OBJS) $(JFFS2_OBJS) $(VERS_OBJS) $(NAND_OBJS-y) \
-	$(LINUX_OBJS)
+# This must be first in the include path, so it goes in $(CC) rather
+# then $(EXTRA_CFLAGS)
 
+CC += -I$(mtd)/../../include
+EXTRA_CFLAGS := -g -DMTD_OUT_OF_TREE -Werror
 
-# 2.4 build compatibility
-ifeq ($(BELOW25),y)
-obj-y := $(jffs2-objs)
-O_TARGET := jffs2.o
-include $(TOPDIR)/Rules.make
+ifdef NONAND
+EXTRA_CFLAGS += -DNONAND
 endif
 
+include $(obj)/Makefile.common

Index: GNUmakefile
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/GNUmakefile,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- GNUmakefile	14 May 2003 20:26:30 -0000	1.7
+++ GNUmakefile	27 May 2003 09:34:41 -0000	1.8
@@ -1,49 +1,29 @@
-# GNUmakefile for JFFS2 build outside kernel tree
 # $Id$
 
 LINUXDIR=/lib/modules/$(shell uname -r)/build
 
 ifndef VERSION
-# Someone just typed 'make' in this directory.
-# Invoke a kernel build process, with only this dir in SUBDIRS.
+
+# Someone just typed 'make'. Invoke the kernel makefiles properly...
 
 modules:
-	$(MAKE) -C $(LINUXDIR) CONFIG_JFFS2_FS_NAND=y SUBDIRS=`pwd` modules
+	make -C $(LINUXDIR) SUBDIRS=`pwd` mtd=`pwd` modules
 
 nonand:
-	make -C $(LINUXDIR) SUBDIRS=`pwd` modules
+	make -C $(LINUXDIR) SUBDIRS=`pwd` mtd=`pwd` NONAND=1 modules
 
 dep:
-	make -C $(LINUXDIR) SUBDIRS=`pwd` dep
+	make -C $(LINUXDIR) SUBDIRS=`pwd` mtd=`pwd` dep
 
 clean:
-	rm -f *.o
+	rm -f `find . -name \*.ko` `find . -name \*.o`
 
 else
 
-ifndef CONFIG_JFFS2_FS
-# Invoked from a kernel build tree, but CONFIG_JFFS2_FS isn't set. 
-# That means we must have got here from the hack above - pretend
-# CONFIG_JFFS2_FS _was_ set so that we actually build it, and also
-# pull in the local MTD include files in case they're also newer than
-# the ones in the kernel tree. And turn on debugging. 
-
-CC += -I$(shell pwd)/../../include
-
-CONFIG_JFFS2_FS := m
-EXTRA_CFLAGS += -DCONFIG_JFFS2_FS_DEBUG=1 -g -Werror
-
-ifeq ($(CONFIG_JFFS2_FS_NAND),y)
-EXTRA_CFLAGS += -DCONFIG_JFFS2_FS_NAND=1
-endif
-endif
-
-# Check whether we've put the JFFS2 stuff in the superblock and inode unions
-OUT_OF_KERNEL_CFLAGS := $(shell grep -q jffs2 $(TOPDIR)/include/linux/fs.h || echo "-DJFFS2_OUT_OF_KERNEL")
-EXTRA_CFLAGS += $(OUT_OF_KERNEL_CFLAGS)
-
+# 2.5 explicitly states <subdir>/Makefile rather than using recursive make,
+# so we handle all that in there...
 
+obj := $(shell pwd)
 include Makefile
--include $(TOPDIR)/Rules.make
 
 endif


From dwmw2 at infradead.org  Tue May 27 05:35:24 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:28 2006
Subject: mtd/fs/jffs2 defconfig,NONE,1.1
Message-ID: <E19Karc-0001Ud-00@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv5733/fs/jffs2

Added Files:
	defconfig 
Log Message:
include bits for jffs2

***** Error reading new file: [Errno 2] No such file or directory: 'defconfig'

From dwmw2 at infradead.org  Tue May 27 05:35:24 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:28 2006
Subject: mtd/include/linux config.h,1.2,1.3
Message-ID: <E19Karc-0001Uc-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux
In directory phoenix.infradead.org:/tmp/cvs-serv5733/include/linux

Modified Files:
	config.h 
Log Message:
include bits for jffs2

Index: config.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/config.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- config.h	21 May 2003 15:01:06 -0000	1.2
+++ config.h	27 May 2003 09:35:21 -0000	1.3
@@ -31,6 +31,10 @@
 #define CONFIG_MTD_CFI_I2
 #define CONFIG_MTD_CFI_I1
 
+#ifndef NONAND
+#define CONFIG_JFFS2_FS_NAND 1
+#endif
+
 #endif /* MTD_OUT_OF_TREE */
 
 #endif /* __MTD_CONFIG_H__ */


From dwmw2 at infradead.org  Tue May 27 08:54:17 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:28 2006
Subject: mtd/drivers/mtd/chips cfi_cmdset_0001.c,1.121,1.122
Message-ID: <E19Kdy5-0002JT-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv8888

Modified Files:
	cfi_cmdset_0001.c 
Log Message:
Fix suspend

Index: cfi_cmdset_0001.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0001.c,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -r1.121 -r1.122
--- cfi_cmdset_0001.c	26 May 2003 09:25:12 -0000	1.121
+++ cfi_cmdset_0001.c	27 May 2003 12:54:14 -0000	1.122
@@ -1599,6 +1599,7 @@
 				 * with the chip now anyway.
 				 */
 			}
+			break;
 		default:
 			ret = -EAGAIN;
 		case FL_PM_SUSPENDED:


From dwmw2 at infradead.org  Tue May 27 18:33:58 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:28 2006
Subject: mtd/fs/jffs2 super.c,1.77,1.78
Message-ID: <E19Kn14-0004Y8-00@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv17478

Modified Files:
	super.c 
Log Message:
mark jffs2_inode_info slab as reclaimable

Index: super.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/super.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- super.c	22 Jan 2003 14:39:18 -0000	1.77
+++ super.c	27 May 2003 22:33:55 -0000	1.78
@@ -298,7 +298,7 @@
 
 	jffs2_inode_cachep = kmem_cache_create("jffs2_i",
 					     sizeof(struct jffs2_inode_info),
-					     0, SLAB_HWCACHE_ALIGN,
+					     0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
 					     jffs2_i_init_once, NULL);
 	if (!jffs2_inode_cachep) {
 		printk(KERN_ERR "JFFS2 error: Failed to initialise inode cache\n");


From dwmw2 at infradead.org  Tue May 27 18:35:45 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:28 2006
Subject: mtd/fs/jffs2 super.c,1.78,1.79
Message-ID: <E19Kn2n-0004YR-00@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv17505

Modified Files:
	super.c 
Log Message:
mark jffs2_inode_info slab as reclaimable

Index: super.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/super.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- super.c	27 May 2003 22:33:55 -0000	1.78
+++ super.c	27 May 2003 22:35:42 -0000	1.79
@@ -101,7 +101,7 @@
 }
 
 static struct super_block *jffs2_get_sb_mtd(struct file_system_type *fs_type,
-					      int flags, char *dev_name, 
+					      int flags, const char *dev_name, 
 					      void *data, struct mtd_info *mtd)
 {
 	struct super_block *sb;
@@ -153,7 +153,7 @@
 }
 
 static struct super_block *jffs2_get_sb_mtdnr(struct file_system_type *fs_type,
-					      int flags, char *dev_name, 
+					      int flags, const char *dev_name, 
 					      void *data, int mtdnr)
 {
 	struct mtd_info *mtd;
@@ -168,7 +168,8 @@
 }
 
 static struct super_block *jffs2_get_sb(struct file_system_type *fs_type,
-					int flags, char *dev_name, void *data)
+					int flags, const char *dev_name,
+					void *data)
 {
 	int err;
 	struct nameidata nd;


From dwmw2 at infradead.org  Wed May 28 06:00:47 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:28 2006
Subject: mtd/drivers/mtd GNUmakefile,1.15,1.16
Message-ID: <E19Kxjj-0007FR-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv27842

Modified Files:
	GNUmakefile 
Log Message:
Add extra removals to 'clean' target, add veryclean target


Index: GNUmakefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/GNUmakefile,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- GNUmakefile	21 May 2003 15:00:00 -0000	1.15
+++ GNUmakefile	28 May 2003 10:00:43 -0000	1.16
@@ -16,8 +16,13 @@
 	make -C $(LINUXDIR) SUBDIRS=`pwd` mtd=`pwd` dep
 
 clean:
-	rm -f `find . -name \*.ko` `find . -name \*.o`
+	rm -f `find . -name \*.o -o -name \*.mod.c -o -name \*.ko`
 
+veryclean:
+	for a in `find . -type f  -a \! -path \*/CVS/\*` ; do  \
+		grep -q ^/`basename $$a`/ `dirname $$a`/CVS/Entries ||  \
+			rm -v $$a ; \
+	done 
 else
 
 # 2.5 explicitly states <subdir>/Makefile rather than using recursive make,


From dwmw2 at infradead.org  Wed May 28 06:04:26 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:28 2006
Subject: mtd/drivers/mtd/nand Kconfig,1.3,1.4
Message-ID: <E19KxnG-0007I0-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv28001

Modified Files:
	Kconfig 
Log Message:
Add NAND_IDS for DiskOnChip Millennium Plus.


Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/Kconfig,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Kconfig	1 Dec 2002 13:23:05 -0000	1.3
+++ Kconfig	28 May 2003 10:04:23 -0000	1.4
@@ -44,8 +44,8 @@
 
 config MTD_NAND_IDS
 	tristate
-	default y if MTD_NAND = y || MTD_DOC2000 = y || MTD_DOC2001 = y
-	default m if MTD_NAND = m || MTD_DOC2000 = m || MTD_DOC2001 = m
+	default y if MTD_NAND = y || MTD_DOC2000 = y || MTD_DOC2001 = y || MTD_DOC2001PLUS = y
+	default m if MTD_NAND = m || MTD_DOC2000 = m || MTD_DOC2001 = m || MTD_DOC2001PLUS = m
 	
 endmenu
 


From dwmw2 at infradead.org  Wed May 28 06:07:15 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:28 2006
Subject: mtd/drivers/mtd/maps nora.c,1.24,NONE
Message-ID: <E19Kxpz-0007J2-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv28083

Removed Files:
	nora.c 
Log Message:
Kill nora.c

--- nora.c DELETED ---


From dwmw2 at infradead.org  Wed May 28 06:48:44 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:28 2006
Subject: mtd/drivers/mtd/maps Makefile.common,1.1,1.2 Config.in,1.50,1.51
 Kconfig,1.8,1.9
Message-ID: <E19KyU8-0007Ys-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv29064

Modified Files:
	Makefile.common Config.in Kconfig 
Log Message:
config update for 2.5

Index: Makefile.common
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Makefile.common,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile.common	21 May 2003 15:00:03 -0000	1.1
+++ Makefile.common	28 May 2003 10:48:41 -0000	1.2
@@ -47,9 +47,7 @@
 obj-$(CONFIG_MTD_OCELOT)	+= ocelot.o
 obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o
 obj-$(CONFIG_MTD_PCI)		+= pci.o
-obj-$(CONFIG_MTD_PB1000)	+= pb1xxx-flash.o
-obj-$(CONFIG_MTD_PB1100)	+= pb1xxx-flash.o
-obj-$(CONFIG_MTD_PB1500)	+= pb1xxx-flash.o
+obj-$(CONFIG_MTD_PB1XXX)	+= pb1xxx-flash.o
 obj-$(CONFIG_MTD_LASAT)		+= lasat.o
 obj-$(CONFIG_MTD_AUTCPU12)	+= autcpu12-nvram.o
 obj-$(CONFIG_MTD_EDB7312)	+= edb7312.o

Index: Config.in
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Config.in,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- Config.in	23 May 2003 12:31:21 -0000	1.50
+++ Config.in	28 May 2003 10:48:41 -0000	1.51
@@ -29,7 +29,6 @@
    if [ "$CONFIG_MTD_DILNETPC" = "y" -o "$CONFIG_MTD_DILNETPC" = "m" ]; then
      hex '    Size of boot partition' CONFIG_MTD_DILNETPC_BOOTSIZE 0x80000
    fi
-   dep_tristate '  JEDEC Flash device mapped on Mixcom piggyback card' CONFIG_MTD_MIXMEM $CONFIG_MTD_JEDEC
    dep_tristate '  JEDEC Flash device mapped on Octagon 5066 SBC' CONFIG_MTD_OCTAGON $CONFIG_MTD_JEDEC $CONFIG_MTD_COMPLEX_MAPPINGS
    dep_tristate '  JEDEC Flash device mapped on Tempustech VMAX SBC301' CONFIG_MTD_VMAX $CONFIG_MTD_JEDEC $CONFIG_MTD_COMPLEX_MAPPINGS
    dep_tristate '  Flash device mapped with DOCCS on NatSemi SCx200' CONFIG_MTD_SCx200_DOCFLASH $CONFIG_MTD_CFI
@@ -68,14 +67,12 @@
   fi
 fi
 
-if [ "$CONFIG_MIPS" = "y" ]; then
-   dep_tristate '  Pb1000 MTD support' CONFIG_MTD_PB1000 $CONFIG_MIPS_PB1000
-   dep_tristate '  Pb1500 MTD support' CONFIG_MTD_PB1500 $CONFIG_MIPS_PB1500
-   dep_tristate '  Pb1100 MTD support' CONFIG_MTD_PB1100 $CONFIG_MIPS_PB1100
-   if [ "$CONFIG_MTD_PB1500" = "y" -o "$CONFIG_MTD_PB1500" = "m" \
-	-o "$CONFIG_MTD_PB1100" = "y" -o "$CONFIG_MTD_PB1100" = "m" ]; then
-      bool '  Pb[15]00 boot flash device' CONFIG_MTD_PB1500_BOOT 
-      bool '  Pb[15]00 user flash device (2nd 32MiB bank)' CONFIG_MTD_PB1500_USER
+if [ "$CONFIG_MIPS_PB1000" = "y" -o  "$CONFIG_MIPS_PB1100" = "y" -o 
+	"$CONFIG_MIPS_PB1500" = "y" ]; then
+   tristate '  Pb1x00 MTD support' CONFIG_MTD_PB1XXX
+   if [ "$CONFIG_MIPS_PB1500" = "y" -o "$CONFIG_MIPS_PB1100" = "m" ]; then
+      bool '  Pb1x00 boot flash device' CONFIG_MTD_PB1500_BOOT 
+      bool '  Pb1x00 user flash device (2nd 32MiB bank)' CONFIG_MTD_PB1500_USER
    fi
    dep_tristate '  Flash chip mapping on ITE QED-4N-S01B, Globespan IVR or custom board' CONFIG_MTD_CSTM_MIPS_IXX $CONFIG_MTD_CFI $CONFIG_MTD_JEDEC $CONFIG_MTD_PARTITIONS 
    if [ "$CONFIG_MTD_CSTM_MIPS_IXX" = "y" -o "$CONFIG_MTD_CSTM_MIPS_IXX" = "m" ]; then

Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Kconfig,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Kconfig	23 May 2003 12:31:20 -0000	1.8
+++ Kconfig	28 May 2003 10:48:41 -0000	1.9
@@ -113,17 +113,6 @@
 	  This provides a driver for the on-board flash of the Intel
 	  'Lubbock' XScale evaluation board.
 
-config MTD_MIXMEM
-	tristate "JEDEC Flash device mapped on Mixcom piggyback card"
-	depends on X86 && MTD_JEDEC
-	help
-	  This supports the paging arrangement for access to flash chips
-	  on the MixCOM piggyback card, allowing the flash chip drivers
-	  to get on with their job of driving the flash chips without
-	  having to know about the paging. If you have one of these boards,
-	  you probably want to enable this mapping driver. More info is at
-	  <http://www.itc.hu/>.
-
 config MTD_OCTAGON
 	tristate "JEDEC Flash device mapped on Octagon 5066 SBC"
 	depends on X86 && MTD_JEDEC && MTD_COMPLEX_MAPPINGS
@@ -153,9 +142,93 @@
 
 	  If compiled as a module, it will be called scx200_docflash.o.
 
+config MTD_AMD76XROM
+	tristate "BIOS flash chip on AMD76x southbridge"
+	depends on X86 && MTD_JEDECPROBE
+	help
+	  Support for treating the BIOS flash chip on AMD76x motherboards
+	  as an MTD device - with this you can reprogram your BIOS.
+
+	  BE VERY CAREFUL.
+
+config MTD_ICH2ROM
+	tristate "BIOS flash chip on Intel Hub Controller 2"
+	depends on X86 && MTD_JEDECPROBE && MTD_COMPLEX_MAPPINGS
+	help
+	  Support for treating the BIOS flash chip on ICH2 motherboards
+	  as an MTD device - with this you can reprogram your BIOS.
+
+	  BE VERY CAREFUL.
+
+config MTD_SCB2_FLASH
+	tristate "BIOS flash chip on Intel SCB2 boards"
+	depends on X86 && MTD_JEDECPROBE
+	help
+	  Support for treating the BIOS flash chip on Intel SCB2 boards
+	  as an MTD device - with this you can reprogram your BIOS.
+
+	  BE VERY CAREFUL.
+
+config MTD_TSUNAMI
+	tristate "Flash chips on Tsunami TIG bus"
+	depends on ALPHA_TSUNAMI && MTD_COMPLEX_MAPPINGS
+	help
+	  Support for the flash chip on Tsunami TIG bus.
+
+config MTD_LASAT
+	tristate "Flash chips on LASAT board"
+	depends on LASAT && MTD_CFI
+	help
+	  Support for the flash chips on the Lasat 100 and 200 boards.
+
+config MTD_NETtel
+	tristate "CFI flash device on SnapGear/SecureEdge"
+	depends on X86 && MTD_PARTITIONS && MTD_JEDECPROBE
+	help
+	  Support for flash chips on NETtel/SecureEdge/SnapGear boards.
+
+config MTD_PB1XXX
+	tristate "Flash devices on Alchemy PB1xxx boards"
+	depends on MIPS && ( MIPS_PB1000 || MIPS_PB1100 || MIPS_PB1500 )
+	help
+	  Flash memory access on Alchemy Pb1000/Pb1100/Pb1500 boards
+
+config MTD_PB1XXX_BOOT
+	bool "PB1x00 boot flash device"
+	depends on MTD_PB1XXX && ( MIPS_PB1100 || MIPS_PB1500 )
+	help
+	  Use the first of the two 32MiB flash banks on Pb1100/Pb1500 board.
+	  You can say 'Y' to both this and 'MTD_PB1XXX_USER' below, to use
+	  both banks.
+
+config MTD_PB1XXX_USER
+	bool "PB1x00 user flash device"
+	depends on MTD_PB1XXX && ( MIPS_PB1100 || MIPS_PB1500 )
+	default y if MTD_PB1XX_BOOT = n
+	help
+	  Use the second of the two 32MiB flash banks on Pb1100/Pb1500 board.
+	  You can say 'Y' to both this and 'MTD_PB1XXX_BOOT' above, to use
+	  both banks.
+
+config MTD_DILNETPC
+	tristate "CFI Flash device mapped on DIL/Net PC"
+	depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT
+	help
+	  MTD map driver for SSV DIL/Net PC Boards "DNP" and "ADNP".
+	  For details, see http://www.ssv-embedded.de/ssv/pc104/p169.htm
+ 	  and http://www.ssv-embedded.de/ssv/pc104/p170.htm
+
+config MTD_DILNETPC_BOOTSIZE
+	hex "Size of DIL/Net PC flash boot partition"
+	depends on MTD_DILNETPC
+	default "0x80000"
+	help
+	  The amount of space taken up by the kernel or Etherboot
+	  on the DIL/Net PC flash chips.
+
 config MTD_L440GX
 	tristate "BIOS flash chip on Intel L440GX boards"
-	depends on X86 && MTD_JEDEC
+	depends on X86 && MTD_JEDECPROBE
 	help
 	  Support for treating the BIOS flash chip on Intel L440GX motherboards
 	  as an MTD device - with this you can reprogram your BIOS.
@@ -229,9 +302,17 @@
 	  Ebony board. If you have one of these boards and would like to
 	  use the flash chips on it, say 'Y'.
 
+config MTD_REDWOOD
+	tristate "CFI Flash devices mapped on IBM Redwood"
+	depends on MTD_CFI && PPC32 && 4xx && 40x && ( REDWOOD_4 || REDWOOD_5 || REDWOOD_6 )
+	help
+	  This enables access routines for the flash chips on the IBM
+	  Redwood board. If you have one of these boards and would like to
+	  use the flash chips on it, say 'Y'.
+
 config MTD_CSTM_MIPS_IXX
 	tristate "Flash chip mapping on ITE QED-4N-S01B, Globespan IVR or custom board"
-	depends on MIPS && MTD_CFI && MTD_JEDEC && MTD_PARTITIONS
+	depends on MIPS && MTD_CFI && MTD_JEDECPROBE && MTD_PARTITIONS
 	help
 	  This provides a mapping driver for the Integrated Tecnology
 	  Express, Inc (ITE) QED-4N-S01B eval board and the Globespan IVR


From dwmw2 at infradead.org  Wed May 28 06:54:26 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:28 2006
Subject: mtd/drivers/mtd/devices Config.in,1.10,1.11 Kconfig,1.2,1.3
 Makefile.common,1.2,1.3 doc1000.c,1.17,NONE
Message-ID: <E19KyZe-0007aT-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/devices
In directory phoenix.infradead.org:/tmp/cvs-serv29163

Modified Files:
	Config.in Kconfig Makefile.common 
Removed Files:
	doc1000.c 
Log Message:
config updates for 2.5, remove doc1000

Index: Config.in
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/Config.in,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Config.in	23 May 2003 11:29:34 -0000	1.10
+++ Config.in	28 May 2003 10:54:23 -0000	1.11
@@ -28,7 +28,6 @@
 dep_tristate '  MTD emulation using block device' CONFIG_MTD_BLKMTD $CONFIG_MTD
 
 comment 'Disk-On-Chip Device Drivers'
-   dep_tristate '  M-Systems Disk-On-Chip 1000' CONFIG_MTD_DOC1000 $CONFIG_MTD
    dep_tristate '  M-Systems Disk-On-Chip 2000 and Millennium' CONFIG_MTD_DOC2000 $CONFIG_MTD
    dep_tristate '  M-Systems Disk-On-Chip Millennium-only alternative driver (see help)' CONFIG_MTD_DOC2001 $CONFIG_MTD
    dep_tristate '  M-Systems Disk-On-Chip Millennium Plus driver (see help)' CONFIG_MTD_DOC2001PLUS $CONFIG_MTD

Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/Kconfig,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Kconfig	23 May 2003 11:29:34 -0000	1.2
+++ Kconfig	28 May 2003 10:54:23 -0000	1.3
@@ -38,6 +38,12 @@
 	  is only really useful if you are developing on this driver or
 	  suspect a possible hardware or driver bug.  If unsure say N.
 
+config MTD_MS02NV
+	tristate "DEC MS02-NV NVRAM module support"
+	depends on CONFIG_DECSTATION
+	help
+	  Support for NVRAM module on DECstation.
+
 config MTD_SLRAM
 	tristate "Uncached system RAM"
 	depends on MTD
@@ -108,13 +114,6 @@
 
 comment "Disk-On-Chip Device Drivers"
 
-config MTD_DOC1000
-	tristate "M-Systems Disk-On-Chip 1000"
-	depends on MTD
-	help
-	  This provides an MTD device driver for the M-Systems DiskOnChip
-	  1000 devices, which are obsolete so you probably want to say 'N'.
-
 config MTD_DOC2000
 	tristate "M-Systems Disk-On-Chip 2000 and Millennium"
 	depends on MTD
@@ -216,7 +215,7 @@
 	  continue with probing if it is absent.  The signature will always be
 	  present for a DiskOnChip 2000 or a normal DiskOnChip Millennium.
 	  Only if you have overwritten the first block of a DiskOnChip
-	  Millennium will it be  absent.  Enable this option if you are using
+	  Millennium will it be absent.  Enable this option if you are using
 	  LinuxBIOS or if you need to recover a DiskOnChip Millennium on which
 	  you have managed to wipe the first block.
 

Index: Makefile.common
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/Makefile.common,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Makefile.common	23 May 2003 11:29:34 -0000	1.2
+++ Makefile.common	28 May 2003 10:54:23 -0000	1.3
@@ -15,7 +15,6 @@
 # here where previously there was none.  We now have to ensure that
 # doc200[01].o are linked before docprobe.o
 
-obj-$(CONFIG_MTD_DOC1000)	+= doc1000.o
 obj-$(CONFIG_MTD_DOC2000)	+= doc2000.o
 obj-$(CONFIG_MTD_DOC2001)	+= doc2001.o
 obj-$(CONFIG_MTD_DOC2001PLUS)	+= doc2001plus.o

--- doc1000.c DELETED ---


From dwmw2 at infradead.org  Wed May 28 06:54:57 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:28 2006
Subject: mtd/drivers/mtd defconfig,1.3,1.4
Message-ID: <E19Kya9-0007ag-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv29176

Modified Files:
	defconfig 
Log Message:
Remove doc1000


Index: defconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/defconfig,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- defconfig	23 May 2003 11:38:47 -0000	1.3
+++ defconfig	28 May 2003 10:54:55 -0000	1.4
@@ -20,7 +20,6 @@
 CONFIG_MTD_RAM := m
 CONFIG_MTD_ROM := m
 CONFIG_MTD_ABSENT := m
-CONFIG_MTD_DOC1000 := m
 CONFIG_MTD_DOC2000 := m
 CONFIG_MTD_DOC2001 := m
 CONFIG_MTD_DOC2001PLUS := m


From dwmw2 at infradead.org  Wed May 28 06:59:09 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:29 2006
Subject: mtd/drivers/mtd/chips Kconfig,1.1,1.2
Message-ID: <E19KyeD-0007bM-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv29218

Modified Files:
	Kconfig 
Log Message:
config updates

Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/Kconfig,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Kconfig	26 Nov 2002 22:29:33 -0000	1.1
+++ Kconfig	28 May 2003 10:59:06 -0000	1.2
@@ -15,7 +15,6 @@
 	  option. Visit <http://www.amd.com/products/nvd/overview/cfi.html>
 	  for more information on CFI.
 
-#dep_tristate '  Detect non-CFI Intel-compatible flash chips' CONFIG_MTD_INTELPROBE $CONFIG_MTD
 config MTD_JEDECPROBE
 	tristate "Detect non-CFI AMD/JEDEC-compatible flash chips"
 	depends on MTD
@@ -145,7 +144,15 @@
 	  The Common Flash Interface defines a number of different command
 	  sets which a CFI-compliant chip may claim to implement. This code
 	  provides support for one of those command sets, used on chips 
-	  chips including the AMD Am29LV320.
+	  including the AMD Am29LV320.
+
+config MTD_CFI_STAA
+	tristate "Support for ST (Advanced Architecture) flash chips"
+	depends on MTD_GEN_PROBE
+	help
+	  The Common Flash Interface defines a number of different command
+	  sets which a CFI-compliant chip may claim to implement. This code
+	  provides support for one of those command sets.
 
 config MTD_RAM
 	tristate "Support for RAM chips in bus mapping"
@@ -177,10 +184,10 @@
 	help
 	  This option does not enable any code directly, but will allow you to
 	  select some other chip drivers which are now considered obsolete,
-	  because the generic CONFIG_JEDEC_PROBE code above should now detect
+	  because the generic CONFIG_JEDECPROBE code above should now detect
 	  the chips which are supported by these drivers, and allow the generic
 	  CFI-compatible drivers to drive the chips. Say 'N' here unless you have
-	  already tried the CONFIG_JEDEC_PROBE method and reported its failure
+	  already tried the CONFIG_JEDECPROBE method and reported its failure
 	  to the MTD mailing list at <linux-mtd@lists.infradead.org>
 
 config MTD_AMDSTD
@@ -209,8 +216,7 @@
 	  programming flash.  It is commonly used in older AMD chips.  It is
 	  only called JEDEC because the JEDEC association
 	  <http://www.jedec.org/> distributes the identification codes for the
-	  chips. WARNING!!!! This code does not compile and is incomplete as
-	  are the specific JEDEC devices drivers.
+	  chips.
 
 endmenu
 


From dwmw2 at infradead.org  Wed May 28 07:02:26 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:29 2006
Subject: mtd/drivers/mtd Kconfig,1.2,1.3
Message-ID: <E19KyhO-0007bx-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv29255

Modified Files:
	Kconfig 
Log Message:
Be less nasty about NFTL write support

Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/Kconfig,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Kconfig	23 May 2003 11:38:29 -0000	1.2
+++ Kconfig	28 May 2003 11:02:23 -0000	1.3
@@ -199,13 +199,11 @@
 	  not use it.
 
 config NFTL_RW
-	bool "Write support for NFTL (BETA)"
+	bool "Write support for NFTL"
 	depends on NFTL
 	help
-	  If you're lucky, this will actually work. Don't whinge if it
-	  doesn't.  Send mail to the MTD mailing list
-	  <linux-mtd@lists.infradead.org> if you want to help to make it more
-	  reliable.
+	  Support for writing to the NAND Flash Translation Layer, as used
+	  on the DiskOnChip.
 
 config INFTL
 	tristate "INFTL (Inverse NAND Flash Translation Layer) support"


From dwmw2 at infradead.org  Wed May 28 07:34:46 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:29 2006
Subject: mtd/drivers/mtd/maps Kconfig,1.9,1.10
Message-ID: <E19KzCg-0007hr-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv29621/maps

Modified Files:
	Kconfig 
Log Message:
remove .o from module name

Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Kconfig,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Kconfig	28 May 2003 10:48:41 -0000	1.9
+++ Kconfig	28 May 2003 11:34:44 -0000	1.10
@@ -140,7 +140,7 @@
 
 	  If you don't know what to do here, say N.
 
-	  If compiled as a module, it will be called scx200_docflash.o.
+	  If compiled as a module, it will be called scx200_docflash.
 
 config MTD_AMD76XROM
 	tristate "BIOS flash chip on AMD76x southbridge"


From dwmw2 at infradead.org  Wed May 28 07:38:57 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:29 2006
Subject: mtd/drivers/mtd/nand Makefile.common,1.1,1.2
Message-ID: <E19KzGj-0007iv-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv29687

Modified Files:
	Makefile.common 
Log Message:
Clean up nand_ecc.o rule


Index: Makefile.common
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/Makefile.common,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile.common	21 May 2003 15:00:04 -0000	1.1
+++ Makefile.common	28 May 2003 11:38:54 -0000	1.2
@@ -8,10 +8,7 @@
 export-objs			:= nand.o nand_ecc.o nand_ids.o
 endif
 
-nandobjs-y			:= nand.o
-
-obj-$(CONFIG_MTD_NAND)		+= $(nandobjs-y) 
-obj-$(CONFIG_MTD_NAND)		+= nand_ecc.o
+obj-$(CONFIG_MTD_NAND)		+= nand.o nand_ecc.o
 obj-$(CONFIG_MTD_NAND_SPIA)	+= spia.o
 obj-$(CONFIG_MTD_NAND_AUTCPU12)	+= autcpu12.o
 obj-$(CONFIG_MTD_NAND_EDB7312)  += edb7312.o


From dwmw2 at infradead.org  Wed May 28 08:40:41 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:29 2006
Subject: mtd/drivers/mtd/maps h720x-flash.c,1.6,1.7
Message-ID: <E19L0ET-0007wr-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv30534

Modified Files:
	h720x-flash.c 
Log Message:
Include slab.h and errno.h


Index: h720x-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/h720x-flash.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- h720x-flash.c	21 May 2003 12:45:18 -0000	1.6
+++ h720x-flash.c	28 May 2003 12:40:38 -0000	1.7
@@ -11,11 +11,12 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/slab.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/partitions.h>
-
 #include <asm/hardware.h>
 #include <asm/io.h>
 


From dwmw2 at infradead.org  Wed May 28 08:42:25 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:29 2006
Subject: mtd/include/linux/mtd map.h,1.33,1.34
Message-ID: <E19L0G9-00082V-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv30884

Modified Files:
	map.h 
Log Message:
Include system.h for mb()


Index: map.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/map.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- map.h	21 May 2003 15:15:02 -0000	1.33
+++ map.h	28 May 2003 12:42:22 -0000	1.34
@@ -8,6 +8,7 @@
 #include <linux/config.h>
 #include <linux/types.h>
 #include <linux/list.h>
+#include <asm/system.h>
 #include <asm/io.h>
 
 /* The map stuff is very simple. You fill in your struct map_info with


From dwmw2 at infradead.org  Wed May 28 08:50:54 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:29 2006
Subject: mtd/drivers/mtd/maps pcmciamtd.c,1.45,1.46
Message-ID: <E19L0OM-00083n-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv30964

Modified Files:
	pcmciamtd.c 
Log Message:
Merge changes from 2.5

Index: pcmciamtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pcmciamtd.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- pcmciamtd.c	21 May 2003 15:15:07 -0000	1.45
+++ pcmciamtd.c	28 May 2003 12:50:51 -0000	1.46
@@ -43,9 +43,9 @@
 static const int debug = 0;
 #endif
 
-#define err(format, arg...) printk(KERN_ERR "pcmciamtd: " format "\n" , ## arg)
-#define info(format, arg...) printk(KERN_INFO "pcmciamtd: " format "\n" , ## arg)
-#define warn(format, arg...) printk(KERN_WARNING "pcmciamtd: " format "\n" , ## arg)
+#define err(format, arg...) printk(KERN_ERR __FILE__ ": " format "\n" , ## arg)
+#define info(format, arg...) printk(KERN_INFO __FILE__ ": " format "\n" , ## arg)
+#define warn(format, arg...) printk(KERN_WARNING __FILE__ ": " format "\n" , ## arg)
 
 
 #define DRIVER_DESC	"PCMCIA Flash memory card driver"
@@ -55,20 +55,21 @@
 #define MAX_PCMCIA_ADDR	0x4000000
 
 struct pcmciamtd_dev {
+	struct list_head list;
 	dev_link_t	link;		/* PCMCIA link */
-	dev_node_t	node;		/* device node */
 	caddr_t		win_base;	/* ioremapped address of PCMCIA window */
 	unsigned int	win_size;	/* size of window */
+	unsigned int	cardsize;	/* size of whole card */
 	unsigned int	offset;		/* offset into card the window currently points at */
 	struct map_info	pcmcia_map;
 	struct mtd_info	*mtd_info;
-	int		vpp;
+	u8		vpp;
 	char		mtd_name[sizeof(struct cistpl_vers_1_t)];
 };
 
 
 static dev_info_t dev_info = "pcmciamtd";
-static dev_link_t *dev_list;
+static LIST_HEAD(dev_list);
 
 /* Module parameters */
 
@@ -107,18 +108,7 @@
 MODULE_PARM_DESC(mem_type, "Set Memory type (0=Flash, 1=RAM, 2=ROM, default=0)");
 
 
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69)
-static inline void cs_error(client_handle_t handle, int func, int ret)
-{
-	error_info_t err = { func, ret };
-	CardServices(ReportError, handle, &err);
-}
-#endif
-
-
 /* read/write{8,16} copy_{from,to} routines with window remapping to access whole card */
-
 static caddr_t remap_window(struct map_info *map, unsigned long to)
 {
 	struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
@@ -126,11 +116,6 @@
 	memreq_t mrq;
 	int ret;
 
-	if(!(dev->link.state & DEV_PRESENT)) {
-		DEBUG(1, "device removed state = 0x%4.4X", dev->link.state);
-		return 0;
-	}
-
 	mrq.CardOffset = to & ~(dev->win_size-1);
 	if(mrq.CardOffset != dev->offset) {
 		DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x",
@@ -253,16 +238,11 @@
 
 /* read/write{8,16} copy_{from,to} routines with direct access */
 
-#define DEV_REMOVED(x)  (!(*(u_int *)x->map_priv_1 & DEV_PRESENT))
-
 static u8 pcmcia_read8(struct map_info *map, unsigned long ofs)
 {
 	caddr_t win_base = (caddr_t)map->map_priv_2;
 	u8 d;
 
-	if(DEV_REMOVED(map))
-		return 0;
-
 	d = readb(win_base + ofs);
 	DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%02x", ofs, win_base + ofs, d);
 	return d;
@@ -274,9 +254,6 @@
 	caddr_t win_base = (caddr_t)map->map_priv_2;
 	u16 d;
 
-	if(DEV_REMOVED(map))
-		return 0;
-
 	d = readw(win_base + ofs);
 	DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%04x", ofs, win_base + ofs, d);
 	return d;
@@ -287,9 +264,6 @@
 {
 	caddr_t win_base = (caddr_t)map->map_priv_2;
 
-	if(DEV_REMOVED(map))
-		return;
-
 	DEBUG(3, "to = %p from = %lu len = %u", to, from, len);
 	memcpy_fromio(to, win_base + from, len);
 }
@@ -299,9 +273,6 @@
 {
 	caddr_t win_base = (caddr_t)map->map_priv_2;
 
-	if(DEV_REMOVED(map))
-		return;
-
 	DEBUG(3, "adr = 0x%08lx (%p)  data = 0x%02x", adr, win_base + adr, d);
 	writeb(d, win_base + adr);
 }
@@ -311,9 +282,6 @@
 {
 	caddr_t win_base = (caddr_t)map->map_priv_2;
 
-	if(DEV_REMOVED(map))
-		return;
-
 	DEBUG(3, "adr = 0x%08lx (%p)  data = 0x%04x", adr, win_base + adr, d);
 	writew(d, win_base + adr);
 }
@@ -323,9 +291,6 @@
 {
 	caddr_t win_base = (caddr_t)map->map_priv_2;
 
-	if(DEV_REMOVED(map))
-		return;
-
 	DEBUG(3, "to = %lu from = %p len = %u", to, from, len);
 	memcpy_toio(win_base + to, from, len);
 }
@@ -358,18 +323,40 @@
 static void pcmciamtd_release(u_long arg)
 {
 	dev_link_t *link = (dev_link_t *)arg;
-	struct pcmciamtd_dev *dev = link->priv;
+	struct pcmciamtd_dev *dev = NULL;
+	int ret;
+	struct list_head *temp1, *temp2;
 
 	DEBUG(3, "link = 0x%p", link);
+	/* Find device in list */
+	list_for_each_safe(temp1, temp2, &dev_list) {
+		dev = list_entry(temp1, struct pcmciamtd_dev, list);
+		if(link == &dev->link)
+			break;
+	}
+	if(link != &dev->link) {
+		DEBUG(1, "Cant find %p in dev_list", link);
+		return;
+	}
 
-	if (link->win) {
-		if(dev->win_base) {
-			iounmap(dev->win_base);
-			dev->win_base = NULL;
+	if(dev) {
+		if(dev->mtd_info) {
+			del_mtd_device(dev->mtd_info);
+			dev->mtd_info = NULL;
+			MOD_DEC_USE_COUNT;
+		}
+		if (link->win) {
+			if(dev->win_base) {
+				iounmap(dev->win_base);
+				dev->win_base = NULL;
+			}
+			CardServices(ReleaseWindow, link->win);
 		}
-		CardServices(ReleaseWindow, link->win);
+		ret = CardServices(ReleaseConfiguration, link->handle);
+		if(ret != CS_SUCCESS)
+			cs_error(link->handle, ReleaseConfiguration, ret);
+			
 	}
-	CardServices(ReleaseConfiguration, link->handle);
 	link->state &= ~DEV_CONFIG;
 }
 
@@ -478,6 +465,7 @@
 	if(force_size) {
 		dev->pcmcia_map.size = force_size << 20;
 		DEBUG(2, "size forced to %dM", force_size);
+
 	}
 
 	if(buswidth) {
@@ -592,8 +580,9 @@
 	}
 	DEBUG(1, "mapped window dev = %p req.base = 0x%lx base = %p size = 0x%x",
 	      dev, req.Base, dev->win_base, req.Size);
-
+	dev->cardsize = 0;
 	dev->offset = 0;
+
 	dev->pcmcia_map.map_priv_1 = (unsigned long)dev;
 	dev->pcmcia_map.map_priv_2 = (unsigned long)link->win;
 
@@ -625,6 +614,9 @@
 		cs_error(link->handle, RequestConfiguration, ret);
 	}
 
+	link->dev = NULL;
+	link->state &= ~DEV_CONFIG_PENDING;
+
 	if(mem_type == 1) {
 		mtd = do_map_probe("map_ram", &dev->pcmcia_map);
 	} else if(mem_type == 2) {
@@ -648,6 +640,7 @@
 
 	dev->mtd_info = mtd;
 	mtd->owner = THIS_MODULE;
+	dev->cardsize = mtd->size;
 
 	if(new_name) {
 		int size = 0;
@@ -656,19 +649,19 @@
 		   size */
 		if(mtd->size < 1048576) { /* <1MB in size, show size in K */
 			size = mtd->size >> 10;
-			unit = 'K';
+			unit = 'K'; 
 		} else {
 			size = mtd->size >> 20;
 			unit = 'M';
 		}
-		snprintf(dev->mtd_name, sizeof(dev->mtd_name), "%d%cB %s", size, unit, "PCMCIA Memory card");
+		sprintf(mtd->name, "%d%cB %s", size, unit, "PCMCIA Memory card");
 	}
 
 	/* If the memory found is fits completely into the mapped PCMCIA window,
 	   use the faster non-remapping read/write functions */
-	if(mtd->size <= dev->win_size) {
+	if(dev->cardsize <= dev->win_size) {
 		DEBUG(1, "Using non remapping memory functions");
-		dev->pcmcia_map.map_priv_1 = (unsigned long)&(dev->link.state);
+
 		dev->pcmcia_map.map_priv_2 = (unsigned long)dev->win_base;
 		dev->pcmcia_map.read8 = pcmcia_read8;
 		dev->pcmcia_map.read16 = pcmcia_read16;
@@ -678,17 +671,16 @@
 		dev->pcmcia_map.copy_to = pcmcia_copy_to;
 	}
 
+	MOD_INC_USE_COUNT;
 	if(add_mtd_device(mtd)) {
-		map_destroy(mtd);
 		dev->mtd_info = NULL;
+		MOD_DEC_USE_COUNT;
 		err("Couldnt register MTD device");
 		pcmciamtd_release((u_long)link);
 		return;
 	}
-	snprintf(dev->node.dev_name, sizeof(dev->node.dev_name), "mtd%d", mtd->index);
-	info("mtd%d: %s", mtd->index, mtd->name);
-	link->state &= ~DEV_CONFIG_PENDING;
-	link->dev = &dev->node;
+	DEBUG(1, "mtd added @ %p mtd->priv = %p", mtd, mtd->priv);
+
 	return;
 
  cs_failed:
@@ -715,14 +707,8 @@
 	case CS_EVENT_CARD_REMOVAL:
 		DEBUG(2, "EVENT_CARD_REMOVAL");
 		link->state &= ~DEV_PRESENT;
-		if (link->state & DEV_CONFIG) {
-			struct pcmciamtd_dev *dev = link->priv;
-			if(dev->mtd_info) {
-				del_mtd_device(dev->mtd_info);
-				info("mtd%d: Removed", dev->mtd_info->index);
-			}
+		if (link->state & DEV_CONFIG)
 			mod_timer(&link->release, jiffies + HZ/20);
-		}
 		break;
 	case CS_EVENT_CARD_INSERTION:
 		DEBUG(2, "EVENT_CARD_INSERTION");
@@ -760,23 +746,47 @@
 
 static void pcmciamtd_detach(dev_link_t *link)
 {
+	int ret;
+	struct pcmciamtd_dev *dev = NULL;
+	struct list_head *temp1, *temp2;
+
 	DEBUG(3, "link=0x%p", link);
 
+	/* Find device in list */
+	list_for_each_safe(temp1, temp2, &dev_list) {
+		dev = list_entry(temp1, struct pcmciamtd_dev, list);
+		if(link == &dev->link)
+			break;
+	}
+	if(link != &dev->link) {
+		DEBUG(1, "Cant find %p in dev_list", link);
+		return;
+	}
+	
 	del_timer(&link->release);
 
-	if(link->state & DEV_CONFIG) {
-		pcmciamtd_release((u_long)link);
+	if(!dev) {
+		DEBUG(3, "dev is NULL");
+		return;
+	}
+
+	if (link->state & DEV_CONFIG) {
+		//pcmciamtd_release((u_long)link);
+		DEBUG(3, "DEV_CONFIG set");
+		link->state |= DEV_STALE_LINK;
+		return;
 	}
 
 	if (link->handle) {
-		int ret;
 		DEBUG(2, "Deregistering with card services");
 		ret = CardServices(DeregisterClient, link->handle);
 		if (ret != CS_SUCCESS)
 			cs_error(link->handle, DeregisterClient, ret);
 	}
-
-	link->state |= DEV_STALE_LINK;
+	DEBUG(3, "Freeing dev (%p)", dev);
+	list_del(&dev->list);
+	link->priv = NULL;
+	kfree(dev);
 }
 
 
@@ -798,18 +808,15 @@
 	DEBUG(1, "dev=0x%p", dev);
 
 	memset(dev, 0, sizeof(*dev));
-	link = &dev->link;
-	link->priv = dev;
+	link = &dev->link; link->priv = dev;
 
-	init_timer(&link->release);
 	link->release.function = &pcmciamtd_release;
 	link->release.data = (u_long)link;
 
 	link->conf.Attributes = 0;
 	link->conf.IntType = INT_MEMORY;
 
-	link->next = dev_list;
-	dev_list = link;
+	list_add(&dev->list, &dev_list);
 
 	/* Register with Card Services */
 	client_reg.dev_info = &dev_info;
@@ -828,23 +835,11 @@
 		pcmciamtd_detach(link);
 		return NULL;
 	}
-	DEBUG(2, "link = %p", link);
+
 	return link;
 }
 
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,68)
-static struct pcmcia_driver pcmciamtd_driver = {
-	.drv		= {
-		.name	= "pcmciamtd"
-	},
-	.attach		= pcmciamtd_attach,
-	.detach		= pcmciamtd_detach,
-	.owner		= THIS_MODULE
-};
-#endif
-
-
 static int __init init_pcmciamtd(void)
 {
 	servinfo_t serv;
@@ -868,51 +863,22 @@
 		info("bad mem_type (%d), using default", mem_type);
 		mem_type = 0;
 	}
-
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,68)
-	return pcmcia_register_driver(&pcmciamtd_driver);
-#else
 	register_pccard_driver(&dev_info, &pcmciamtd_attach, &pcmciamtd_detach);
 	return 0;
-#endif
 }
 
 
 static void __exit exit_pcmciamtd(void)
 {
+	struct list_head *temp1, *temp2;
+
 	DEBUG(1, DRIVER_DESC " unloading");
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,68)
-	pcmcia_unregister_driver(&pcmciamtd_driver);
-#else
 	unregister_pccard_driver(&dev_info);
-#endif
-
-	while(dev_list) {
-		dev_link_t *link = dev_list;
-
-		dev_list = link->next;
-		if (link) {
-			struct pcmciamtd_dev *dev = link->priv;
-			
- 			if(dev) {
-				if(link->state & DEV_PRESENT) {
-					if (!(link->state & DEV_STALE_LINK)) {
-						pcmciamtd_detach(link);
-					}
-					link->state &= ~DEV_PRESENT;
-					if(dev->mtd_info) {
-						del_mtd_device(dev->mtd_info);
-						info("mtd%d: Removed",
-						     dev->mtd_info->index);
-					}
-				}
-				if(dev->mtd_info) {
-					DEBUG(2, "Destroying map for mtd%d",
-					      dev->mtd_info->index);
-					map_destroy(dev->mtd_info);
-				}
-				kfree(dev);
-			}
+	list_for_each_safe(temp1, temp2, &dev_list) {
+		dev_link_t *link = &list_entry(temp1, struct pcmciamtd_dev, list)->link;
+		if (link && (link->state & DEV_CONFIG)) {
+			pcmciamtd_release((u_long)link);
+			pcmciamtd_detach(link);
 		}
 	}
 }


From dwmw2 at infradead.org  Wed May 28 08:51:53 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:29 2006
Subject: mtd/drivers/mtd/chips cfi_cmdset_0001.c,1.122,1.123
 cfi_cmdset_0002.c,1.73,1.74 cfi_cmdset_0020.c,1.5,1.6
 cfi_probe.c,1.70,1.71 jedec.c,1.17,1.18 jedec_probe.c,1.27,1.28
 map_absent.c,1.3,1.4 map_ram.c,1.16,1.17 map_rom.c,1.19,1.20
 sharp.c,1.10,1.11
Message-ID: <E19L0PI-00084K-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv30997

Modified Files:
	cfi_cmdset_0001.c cfi_cmdset_0002.c cfi_cmdset_0020.c 
	cfi_probe.c jedec.c jedec_probe.c map_absent.c map_ram.c 
	map_rom.c sharp.c 
Log Message:
C99 initialisers, spelling fixes

Index: cfi_cmdset_0001.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0001.c,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -r1.122 -r1.123
--- cfi_cmdset_0001.c	27 May 2003 12:54:14 -0000	1.122
+++ cfi_cmdset_0001.c	28 May 2003 12:51:48 -0000	1.123
@@ -66,10 +66,10 @@
  */
 
 static struct mtd_chip_driver cfi_intelext_chipdrv = {
-	probe: NULL, /* Not usable directly */
-	destroy: cfi_intelext_destroy,
-	name: "cfi_cmdset_0001",
-	module: THIS_MODULE
+	.probe		= NULL, /* Not usable directly */
+	.destroy	= cfi_intelext_destroy,
+	.name		= "cfi_cmdset_0001",
+	.module		= THIS_MODULE
 };
 
 /* #define DEBUG_LOCK_BITS */

Index: cfi_cmdset_0002.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0002.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- cfi_cmdset_0002.c	23 May 2003 12:23:27 -0000	1.73
+++ cfi_cmdset_0002.c	28 May 2003 12:51:48 -0000	1.74
@@ -48,10 +48,10 @@
 
 
 static struct mtd_chip_driver cfi_amdstd_chipdrv = {
-	probe: NULL, /* Not usable directly */
-	destroy: cfi_amdstd_destroy,
-	name: "cfi_cmdset_0002",
-	module: THIS_MODULE
+	.probe		= NULL, /* Not usable directly */
+	.destroy	= cfi_amdstd_destroy,
+	.name		= "cfi_cmdset_0002",
+	.module		= THIS_MODULE
 };
 
 

Index: cfi_cmdset_0020.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0020.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- cfi_cmdset_0020.c	23 May 2003 12:23:27 -0000	1.5
+++ cfi_cmdset_0020.c	28 May 2003 12:51:48 -0000	1.6
@@ -54,10 +54,10 @@
 static struct mtd_info *cfi_staa_setup (struct map_info *);
 
 static struct mtd_chip_driver cfi_staa_chipdrv = {
-	probe: NULL, /* Not usable directly */
-	destroy: cfi_staa_destroy,
-	name: "cfi_cmdset_0020",
-	module: THIS_MODULE
+	.probe		= NULL, /* Not usable directly */
+	.destroy	= cfi_staa_destroy,
+	.name		= "cfi_cmdset_0020",
+	.module		= THIS_MODULE
 };
 
 /* #define DEBUG_LOCK_BITS */

Index: cfi_probe.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_probe.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- cfi_probe.c	23 May 2003 12:30:04 -0000	1.70
+++ cfi_probe.c	28 May 2003 12:51:48 -0000	1.71
@@ -304,8 +304,8 @@
 #endif /* DEBUG_CFI */
 
 static struct chip_probe cfi_chip_probe = {
-	name: "CFI",
-	probe_chip: cfi_probe_chip
+	.name		= "CFI",
+	.probe_chip	= cfi_probe_chip
 };
 
 struct mtd_info *cfi_probe(struct map_info *map)
@@ -318,9 +318,9 @@
 }
 
 static struct mtd_chip_driver cfi_chipdrv = {
-	probe: cfi_probe,
-	name: "cfi_probe",
-	module: THIS_MODULE
+	.probe		= cfi_probe,
+	.name		= "cfi_probe",
+	.module		= THIS_MODULE
 };
 
 int __init cfi_probe_init(void)

Index: jedec.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/jedec.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- jedec.c	21 May 2003 15:15:05 -0000	1.17
+++ jedec.c	28 May 2003 12:51:48 -0000	1.18
@@ -39,14 +39,51 @@
 
 /* Listing of parts and sizes. We need this table to learn the sector
    size of the chip and the total length */
-static const struct JEDECTable JEDEC_table[] = 
-  {{0x013D,"AMD Am29F017D",2*1024*1024,64*1024,MTD_CAP_NORFLASH},
-   {0x01AD,"AMD Am29F016",2*1024*1024,64*1024,MTD_CAP_NORFLASH},
-   {0x01D5,"AMD Am29F080",1*1024*1024,64*1024,MTD_CAP_NORFLASH},
-   {0x01A4,"AMD Am29F040",512*1024,64*1024,MTD_CAP_NORFLASH},
-   {0x20E3,"AMD Am29W040B",512*1024,64*1024,MTD_CAP_NORFLASH},
-   {0xC2AD,"Macronix MX29F016",2*1024*1024,64*1024,MTD_CAP_NORFLASH},
-   {}};
+static const struct JEDECTable JEDEC_table[] = {
+	{
+		.jedec		= 0x013D,
+		.name		= "AMD Am29F017D",
+		.size		= 2*1024*1024,
+		.sectorsize	= 64*1024,
+		.capabilities	= MTD_CAP_NORFLASH
+	},
+	{
+		.jedec		= 0x01AD,
+		.name		= "AMD Am29F016",
+		.size		= 2*1024*1024,
+		.sectorsize	= 64*1024,
+		.capabilities	= MTD_CAP_NORFLASH
+	},
+	{
+		.jedec		= 0x01D5,
+		.name		= "AMD Am29F080",
+		.size		= 1*1024*1024,
+		.sectorsize	= 64*1024,
+		.capabilities	= MTD_CAP_NORFLASH
+	},
+	{
+		.jedec		= 0x01A4,
+		.name		= "AMD Am29F040",
+		.size		= 512*1024,
+		.sectorsize	= 64*1024,
+		.capabilities	= MTD_CAP_NORFLASH
+	},
+	{
+		.jedec		= 0x20E3,
+		.name		= "AMD Am29W040B",
+		.size		= 512*1024,
+		.sectorsize	= 64*1024,
+		.capabilities	= MTD_CAP_NORFLASH
+	},
+	{
+		.jedec		= 0xC2AD,
+		.name		= "Macronix MX29F016",
+		.size		= 2*1024*1024,
+		.sectorsize	= 64*1024,
+		.capabilities	= MTD_CAP_NORFLASH
+	},
+	{ .jedec = 0x0 }
+};
 
 static const struct JEDECTable *jedec_idtoinf(__u8 mfr,__u8 id);
 static void jedec_sync(struct mtd_info *mtd) {};
@@ -60,9 +97,9 @@
 
 
 static struct mtd_chip_driver jedec_chipdrv = {
-	probe: jedec_probe,
-	name: "jedec",
-	module: THIS_MODULE
+	.probe	= jedec_probe,
+	.name	= "jedec",
+	.module	= THIS_MODULE
 };
 
 /* Probe entry point */
@@ -614,7 +651,7 @@
 
    /* Poll the flash for erasure completion, specs say this can take as long
       as 480 seconds to do all the sectors (for a 2 meg flash). 
-      Erasure time is dependant on chip age, temp and wear.. */
+      Erasure time is dependent on chip age, temp and wear.. */
    
    /* This being a generic routine assumes a 32 bit bus. It does read32s
       and bundles interleved chips into the same grouping. This will work 
@@ -761,8 +798,8 @@
 		       size_t *retlen, const u_char *buf)
 {
    /* Does IO to the currently selected chip. It takes the bank addressing
-      base (which is divisable by the chip size) adds the necesary lower bits
-      of addrshift (interleve index) and then adds the control register index. */
+      base (which is divisible by the chip size) adds the necessary lower bits
+      of addrshift (interleave index) and then adds the control register index. */
    #define flread(x) map_read8(map,base+(off&((1<<chip->addrshift)-1))+((x)<<chip->addrshift))
    #define flwrite(v,x) map_write8(map,v,base+(off&((1<<chip->addrshift)-1))+((x)<<chip->addrshift))
    

Index: jedec_probe.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/jedec_probe.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- jedec_probe.c	21 May 2003 15:15:05 -0000	1.27
+++ jedec_probe.c	28 May 2003 12:51:48 -0000	1.28
@@ -235,978 +235,1112 @@
  */
 static const struct amd_flash_info jedec_table[] = {
 	{
-		mfr_id: MANUFACTURER_AMD,
-		dev_id: AM29F032B,
-		name: "AMD AM29F032B",
-		uaddr: {[0] = MTD_UADDR_0x0555_0x02AA}, /* x8 */
-		DevSize: SIZE_4MiB,
-		CmdSet:	P_ID_AMD_STD,
-		NumEraseRegions: 1,
-		regions: {ERASEINFO(0x10000,64)
[...1820 lines suppressed...]
+			ERASEINFO(0x02000,8)
+		}
+	}, {
+		.mfr_id		= MANUFACTURER_WINBOND,
+		.dev_id		= W49V002A,
+		.name		= "Winbond W49V002A",
+		.uaddr		= {
+			[0] = MTD_UADDR_0x5555_0x2AAA /* x8 */
+		},
+		.DevSize	= SIZE_256KiB,
+		.CmdSet		= P_ID_AMD_STD,
+		.NumEraseRegions= 4,
+		.regions	= {
+			ERASEINFO(0x10000, 3),
+			ERASEINFO(0x08000, 1),
+			ERASEINFO(0x02000, 2),
+			ERASEINFO(0x04000, 1),
 		}
 	} 
 };

Index: map_absent.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/map_absent.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- map_absent.c	21 May 2003 15:15:05 -0000	1.3
+++ map_absent.c	28 May 2003 12:51:49 -0000	1.4
@@ -37,10 +37,10 @@
 
 
 static struct mtd_chip_driver map_absent_chipdrv = {
-	probe: 		map_absent_probe,
-	destroy:	map_absent_destroy,
-	name: 		"map_absent",
-	module: 	THIS_MODULE
+	.probe		= map_absent_probe,
+	.destroy	= map_absent_destroy,
+	.name		= "map_absent",
+	.module		= THIS_MODULE
 };
 
 static struct mtd_info *map_absent_probe(struct map_info *map)

Index: map_ram.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/map_ram.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- map_ram.c	21 May 2003 15:15:05 -0000	1.16
+++ map_ram.c	28 May 2003 12:51:49 -0000	1.17
@@ -25,9 +25,9 @@
 
 
 static struct mtd_chip_driver mapram_chipdrv = {
-	probe: map_ram_probe,
-	name: "map_ram",
-	module: THIS_MODULE
+	.probe	= map_ram_probe,
+	.name	= "map_ram",
+	.module	= THIS_MODULE
 };
 
 static struct mtd_info *map_ram_probe(struct map_info *map)

Index: map_rom.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/map_rom.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- map_rom.c	21 May 2003 15:15:05 -0000	1.19
+++ map_rom.c	28 May 2003 12:51:49 -0000	1.20
@@ -23,9 +23,9 @@
 struct mtd_info *map_rom_probe(struct map_info *map);
 
 static struct mtd_chip_driver maprom_chipdrv = {
-	probe: map_rom_probe,
-	name: "map_rom",
-	module: THIS_MODULE
+	.probe	= map_rom_probe,
+	.name	= "map_rom",
+	.module	= THIS_MODULE
 };
 
 struct mtd_info *map_rom_probe(struct map_info *map)

Index: sharp.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/sharp.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- sharp.c	14 May 2003 15:05:13 -0000	1.10
+++ sharp.c	28 May 2003 12:51:49 -0000	1.11
@@ -98,10 +98,10 @@
 static void sharp_destroy(struct mtd_info *mtd);
 
 static struct mtd_chip_driver sharp_chipdrv = {
-	probe: sharp_probe,
-	destroy: sharp_destroy,
-	name: "sharp",
-	module: THIS_MODULE
+	.probe		= sharp_probe,
+	.destroy	= sharp_destroy,
+	.name		= "sharp",
+	.module		= THIS_MODULE
 };
 
 


From dwmw2 at infradead.org  Wed May 28 09:36:17 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:29 2006
Subject: mtd/drivers/mtd/maps pcmciamtd.c,1.46,1.47
Message-ID: <E19L16H-0008Gh-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv31763

Modified Files:
	pcmciamtd.c 
Log Message:
Fix incorrect use of MB/KB


Index: pcmciamtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pcmciamtd.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- pcmciamtd.c	28 May 2003 12:50:51 -0000	1.46
+++ pcmciamtd.c	28 May 2003 13:36:14 -0000	1.47
@@ -532,7 +532,7 @@
 		dev->pcmcia_map.set_vpp = pcmciamtd_set_vpp;
 
 	/* Request a memory window for PCMCIA. Some architeures can map windows upto the maximum
-	   that PCMCIA can support (64Mb) - this is ideal and we aim for a window the size of the
+	   that PCMCIA can support (64MiB) - this is ideal and we aim for a window the size of the
 	   whole card - otherwise we try smaller windows until we succeed */
 
 	req.Attributes =  WIN_MEMORY_TYPE_CM | WIN_ENABLE;
@@ -545,7 +545,7 @@
 
 	do {
 		int ret;
-		DEBUG(2, "requesting window with size = %dKB memspeed = %d",
+		DEBUG(2, "requesting window with size = %dKiB memspeed = %d",
 		      req.Size >> 10, req.AccessSpeed);
 		link->win = (window_handle_t)link->handle;
 		ret = CardServices(RequestWindow, &link->win, &req);
@@ -553,7 +553,7 @@
 		if(ret) {
 			req.Size >>= 1;
 		} else {
-			DEBUG(2, "Got window of size %dKB", req.Size >> 10);
+			DEBUG(2, "Got window of size %dKiB", req.Size >> 10);
 			dev->win_size = req.Size;
 			break;
 		}
@@ -566,7 +566,7 @@
 		pcmciamtd_release((u_long)link);
 		return;
 	}
-	DEBUG(1, "Allocated a window of %dKB", dev->win_size >> 10);
+	DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10);
 		
 	/* Get write protect status */
 	CS_CHECK(GetStatus, link->handle, &status);
@@ -647,14 +647,14 @@
 		char unit = ' ';
 		/* Since we are using a default name, make it better by adding in the
 		   size */
-		if(mtd->size < 1048576) { /* <1MB in size, show size in K */
+		if(mtd->size < 1048576) { /* <1MiB in size, show size in KiB */
 			size = mtd->size >> 10;
 			unit = 'K'; 
 		} else {
 			size = mtd->size >> 20;
 			unit = 'M';
 		}
-		sprintf(mtd->name, "%d%cB %s", size, unit, "PCMCIA Memory card");
+		sprintf(mtd->name, "%d%ciB %s", size, unit, "PCMCIA Memory card");
 	}
 
 	/* If the memory found is fits completely into the mapped PCMCIA window,


From dwmw2 at infradead.org  Wed May 28 09:37:32 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:29 2006
Subject: mtd/drivers/mtd/maps Makefile,1.44,1.45
Message-ID: <E19L17U-0008Hn-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv31828

Modified Files:
	Makefile 
Log Message:
-Wno-error for pcmciamtd.o


Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Makefile,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- Makefile	21 May 2003 15:00:03 -0000	1.44
+++ Makefile	28 May 2003 13:37:29 -0000	1.45
@@ -3,6 +3,8 @@
 #
 # $Id$
 
+CFLAGS_pcmciamtd.o := -Wno-error
+
 # Munge the kernel build environment to suit our needs....
 include $(mtd)/Makefile.inc
 


From dwmw2 at infradead.org  Wed May 28 09:47:22 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:30 2006
Subject: mtd/drivers/mtd/chips amd_flash.c,1.21,1.22
Message-ID: <E19L1H0-0008P0-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv32279

Modified Files:
	amd_flash.c 
Log Message:
C99 initialisers


Index: amd_flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/amd_flash.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- amd_flash.c	14 May 2003 15:05:12 -0000	1.21
+++ amd_flash.c	28 May 2003 13:47:19 -0000	1.22
@@ -125,10 +125,10 @@
 
 
 static struct mtd_chip_driver amd_flash_chipdrv = {
-	probe: amd_flash_probe,
-	destroy: amd_flash_destroy,
-	name: "amd_flash",
-	module: THIS_MODULE
+	.probe = amd_flash_probe,
+	.destroy = amd_flash_destroy,
+	.name = "amd_flash",
+	.module = THIS_MODULE
 };
 
 
@@ -426,226 +426,226 @@
 {
 	static const struct amd_flash_info table[] = {
 	{
-		mfr_id: MANUFACTURER_AMD,
-		dev_id: AM29LV160DT,
-		name: "AMD AM29LV160DT",
-		size: 0x00200000,
-		numeraseregions: 4,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x10000, numblocks: 31 },
-			{ offset: 0x1F0000, erasesize: 0x08000, numblocks:  1 },
-			{ offset: 0x1F8000, erasesize: 0x02000, numblocks:  2 },
-			{ offset: 0x1FC000, erasesize: 0x04000, numblocks:  1 }
-		}
-	}, {
-		mfr_id: MANUFACTURER_AMD,
-		dev_id: AM29LV160DB,
-		name: "AMD AM29LV160DB",
-		size: 0x00200000,
-		numeraseregions: 4,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x04000, numblocks:  1 },
-			{ offset: 0x004000, erasesize: 0x02000, numblocks:  2 },
-			{ offset: 0x008000, erasesize: 0x08000, numblocks:  1 },
-			{ offset: 0x010000, erasesize: 0x10000, numblocks: 31 }
-		}
-	}, {
-		mfr_id: MANUFACTURER_TOSHIBA,
-		dev_id: TC58FVT160,
-		name: "Toshiba TC58FVT160",
-		size: 0x00200000,
-		numeraseregions: 4,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x10000, numblocks: 31 },
-			{ offset: 0x1F0000, erasesize: 0x08000, numblocks:  1 },
-			{ offset: 0x1F8000, erasesize: 0x02000, numblocks:  2 },
-			{ offset: 0x1FC000, erasesize: 0x04000, numblocks:  1 }
-		}
-	}, {
-		mfr_id: MANUFACTURER_FUJITSU,
-		dev_id: MBM29LV160TE,
-		name: "Fujitsu MBM29LV160TE",
-		size: 0x00200000,
-		numeraseregions: 4,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x10000, numblocks: 31 },
-			{ offset: 0x1F0000, erasesize: 0x08000, numblocks:  1 },
-			{ offset: 0x1F8000, erasesize: 0x02000, numblocks:  2 },
-			{ offset: 0x1FC000, erasesize: 0x04000, numblocks:  1 }
-		}
-	}, {
-		mfr_id: MANUFACTURER_TOSHIBA,
-		dev_id: TC58FVB160,
-		name: "Toshiba TC58FVB160",
-		size: 0x00200000,
-		numeraseregions: 4,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x04000, numblocks:  1 },
-			{ offset: 0x004000, erasesize: 0x02000, numblocks:  2 },
-			{ offset: 0x008000, erasesize: 0x08000, numblocks:  1 },
-			{ offset: 0x010000, erasesize: 0x10000, numblocks: 31 }
-		}
-	}, {
-		mfr_id: MANUFACTURER_FUJITSU,
-		dev_id: MBM29LV160BE,
-		name: "Fujitsu MBM29LV160BE",
-		size: 0x00200000,
-		numeraseregions: 4,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x04000, numblocks:  1 },
-			{ offset: 0x004000, erasesize: 0x02000, numblocks:  2 },
-			{ offset: 0x008000, erasesize: 0x08000, numblocks:  1 },
-			{ offset: 0x010000, erasesize: 0x10000, numblocks: 31 }
-		}
-	}, {
-		mfr_id: MANUFACTURER_AMD,
-		dev_id: AM29LV800BB,
-		name: "AMD AM29LV800BB",
-		size: 0x00100000,
-		numeraseregions: 4,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x04000, numblocks:  1 },
-			{ offset: 0x004000, erasesize: 0x02000, numblocks:  2 },
-			{ offset: 0x008000, erasesize: 0x08000, numblocks:  1 },
-			{ offset: 0x010000, erasesize: 0x10000, numblocks: 15 }
-		}
-	}, {
-		mfr_id: MANUFACTURER_AMD,
-		dev_id: AM29F800BB,
-		name: "AMD AM29F800BB",
-		size: 0x00100000,
-		numeraseregions: 4,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x04000, numblocks:  1 },
-			{ offset: 0x004000, erasesize: 0x02000, numblocks:  2 },
-			{ offset: 0x008000, erasesize: 0x08000, numblocks:  1 },
-			{ offset: 0x010000, erasesize: 0x10000, numblocks: 15 }
-		}
-	}, {
-		mfr_id: MANUFACTURER_AMD,
-		dev_id: AM29LV800BT,
-		name: "AMD AM29LV800BT",
-		size: 0x00100000,
-		numeraseregions: 4,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x10000, numblocks: 15 },
-			{ offset: 0x0F0000, erasesize: 0x08000, numblocks:  1 },
-			{ offset: 0x0F8000, erasesize: 0x02000, numblocks:  2 },
-			{ offset: 0x0FC000, erasesize: 0x04000, numblocks:  1 }
-		}
-	}, {
-		mfr_id: MANUFACTURER_AMD,
-		dev_id: AM29F800BT,
-		name: "AMD AM29F800BT",
-		size: 0x00100000,
-		numeraseregions: 4,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x10000, numblocks: 15 },
-			{ offset: 0x0F0000, erasesize: 0x08000, numblocks:  1 },
-			{ offset: 0x0F8000, erasesize: 0x02000, numblocks:  2 },
-			{ offset: 0x0FC000, erasesize: 0x04000, numblocks:  1 }
-		}
-	}, {
-		mfr_id: MANUFACTURER_AMD,
-		dev_id: AM29LV800BB,
-		name: "AMD AM29LV800BB",
-		size: 0x00100000,
-		numeraseregions: 4,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x10000, numblocks: 15 },
-			{ offset: 0x0F0000, erasesize: 0x08000, numblocks:  1 },
-			{ offset: 0x0F8000, erasesize: 0x02000, numblocks:  2 },
-			{ offset: 0x0FC000, erasesize: 0x04000, numblocks:  1 }
-		}
-	}, {
-		mfr_id: MANUFACTURER_FUJITSU,
-		dev_id: MBM29LV800BB,
-		name: "Fujitsu MBM29LV800BB",
-		size: 0x00100000,
-		numeraseregions: 4,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x04000, numblocks:  1 },
-			{ offset: 0x004000, erasesize: 0x02000, numblocks:  2 },
-			{ offset: 0x008000, erasesize: 0x08000, numblocks:  1 },
-			{ offset: 0x010000, erasesize: 0x10000, numblocks: 15 }
-		}
-	}, {
-		mfr_id: MANUFACTURER_ST,
-		dev_id: M29W800T,
-		name: "ST M29W800T",
-		size: 0x00100000,
-		numeraseregions: 4,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x10000, numblocks: 15 },
-			{ offset: 0x0F0000, erasesize: 0x08000, numblocks:  1 },
-			{ offset: 0x0F8000, erasesize: 0x02000, numblocks:  2 },
-			{ offset: 0x0FC000, erasesize: 0x04000, numblocks:  1 }
-		}
-	}, {
-		mfr_id: MANUFACTURER_ST,
-		dev_id: M29W160DT,
-		name: "ST M29W160DT",
-		size: 0x00200000,
-		numeraseregions: 4,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x10000, numblocks: 31 },
-			{ offset: 0x1F0000, erasesize: 0x08000, numblocks:  1 },
-			{ offset: 0x1F8000, erasesize: 0x02000, numblocks:  2 },
-			{ offset: 0x1FC000, erasesize: 0x04000, numblocks:  1 }
-		}
-	}, {
-		mfr_id: MANUFACTURER_ST,
-		dev_id: M29W160DB,
-		name: "ST M29W160DB",
-		size: 0x00200000,
-		numeraseregions: 4,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x04000, numblocks:  1 },
-			{ offset: 0x004000, erasesize: 0x02000, numblocks:  2 },
-			{ offset: 0x008000, erasesize: 0x08000, numblocks:  1 },
-			{ offset: 0x010000, erasesize: 0x10000, numblocks: 31 }
-		}
-	}, {
-		mfr_id: MANUFACTURER_AMD,
-		dev_id: AM29BDS323D,
-		name: "AMD AM29BDS323D",
-		size: 0x00400000,
-		numeraseregions: 3,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x10000, numblocks: 48 },
-			{ offset: 0x300000, erasesize: 0x10000, numblocks: 15 },
-			{ offset: 0x3f0000, erasesize: 0x02000, numblocks:  8 },
-		}
-	}, {
-		mfr_id: MANUFACTURER_AMD,
-		dev_id: AM29BDS643D,
-		name: "AMD AM29BDS643D",
-		size: 0x00800000,
-		numeraseregions: 3,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x10000, numblocks: 96 },
-			{ offset: 0x600000, erasesize: 0x10000, numblocks: 31 },
-			{ offset: 0x7f0000, erasesize: 0x02000, numblocks:  8 },
-		}
-	}, {
-		mfr_id: MANUFACTURER_ATMEL,
-		dev_id: AT49xV16x,
-		name: "Atmel AT49xV16x",
-		size: 0x00200000,
-		numeraseregions: 2,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x02000, numblocks:  8 },
-			{ offset: 0x010000, erasesize: 0x10000, numblocks: 31 }
-		}
-	}, {
-		mfr_id: MANUFACTURER_ATMEL,
-		dev_id: AT49xV16xT,
-		name: "Atmel AT49xV16xT",
-		size: 0x00200000,
-		numeraseregions: 2,
-		regions: {
-			{ offset: 0x000000, erasesize: 0x10000, numblocks: 31 },
-			{ offset: 0x1F0000, erasesize: 0x02000, numblocks:  8 }
+		.mfr_id = MANUFACTURER_AMD,
+		.dev_id = AM29LV160DT,
+		.name = "AMD AM29LV160DT",
+		.size = 0x00200000,
+		.numeraseregions = 4,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x10000, .numblocks = 31 },
+			{ .offset = 0x1F0000, .erasesize = 0x08000, .numblocks =  1 },
+			{ .offset = 0x1F8000, .erasesize = 0x02000, .numblocks =  2 },
+			{ .offset = 0x1FC000, .erasesize = 0x04000, .numblocks =  1 }
+		}
+	}, {
+		.mfr_id = MANUFACTURER_AMD,
+		.dev_id = AM29LV160DB,
+		.name = "AMD AM29LV160DB",
+		.size = 0x00200000,
+		.numeraseregions = 4,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x04000, .numblocks =  1 },
+			{ .offset = 0x004000, .erasesize = 0x02000, .numblocks =  2 },
+			{ .offset = 0x008000, .erasesize = 0x08000, .numblocks =  1 },
+			{ .offset = 0x010000, .erasesize = 0x10000, .numblocks = 31 }
+		}
+	}, {
+		.mfr_id = MANUFACTURER_TOSHIBA,
+		.dev_id = TC58FVT160,
+		.name = "Toshiba TC58FVT160",
+		.size = 0x00200000,
+		.numeraseregions = 4,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x10000, .numblocks = 31 },
+			{ .offset = 0x1F0000, .erasesize = 0x08000, .numblocks =  1 },
+			{ .offset = 0x1F8000, .erasesize = 0x02000, .numblocks =  2 },
+			{ .offset = 0x1FC000, .erasesize = 0x04000, .numblocks =  1 }
+		}
+	}, {
+		.mfr_id = MANUFACTURER_FUJITSU,
+		.dev_id = MBM29LV160TE,
+		.name = "Fujitsu MBM29LV160TE",
+		.size = 0x00200000,
+		.numeraseregions = 4,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x10000, .numblocks = 31 },
+			{ .offset = 0x1F0000, .erasesize = 0x08000, .numblocks =  1 },
+			{ .offset = 0x1F8000, .erasesize = 0x02000, .numblocks =  2 },
+			{ .offset = 0x1FC000, .erasesize = 0x04000, .numblocks =  1 }
+		}
+	}, {
+		.mfr_id = MANUFACTURER_TOSHIBA,
+		.dev_id = TC58FVB160,
+		.name = "Toshiba TC58FVB160",
+		.size = 0x00200000,
+		.numeraseregions = 4,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x04000, .numblocks =  1 },
+			{ .offset = 0x004000, .erasesize = 0x02000, .numblocks =  2 },
+			{ .offset = 0x008000, .erasesize = 0x08000, .numblocks =  1 },
+			{ .offset = 0x010000, .erasesize = 0x10000, .numblocks = 31 }
+		}
+	}, {
+		.mfr_id = MANUFACTURER_FUJITSU,
+		.dev_id = MBM29LV160BE,
+		.name = "Fujitsu MBM29LV160BE",
+		.size = 0x00200000,
+		.numeraseregions = 4,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x04000, .numblocks =  1 },
+			{ .offset = 0x004000, .erasesize = 0x02000, .numblocks =  2 },
+			{ .offset = 0x008000, .erasesize = 0x08000, .numblocks =  1 },
+			{ .offset = 0x010000, .erasesize = 0x10000, .numblocks = 31 }
+		}
+	}, {
+		.mfr_id = MANUFACTURER_AMD,
+		.dev_id = AM29LV800BB,
+		.name = "AMD AM29LV800BB",
+		.size = 0x00100000,
+		.numeraseregions = 4,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x04000, .numblocks =  1 },
+			{ .offset = 0x004000, .erasesize = 0x02000, .numblocks =  2 },
+			{ .offset = 0x008000, .erasesize = 0x08000, .numblocks =  1 },
+			{ .offset = 0x010000, .erasesize = 0x10000, .numblocks = 15 }
+		}
+	}, {
+		.mfr_id = MANUFACTURER_AMD,
+		.dev_id = AM29F800BB,
+		.name = "AMD AM29F800BB",
+		.size = 0x00100000,
+		.numeraseregions = 4,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x04000, .numblocks =  1 },
+			{ .offset = 0x004000, .erasesize = 0x02000, .numblocks =  2 },
+			{ .offset = 0x008000, .erasesize = 0x08000, .numblocks =  1 },
+			{ .offset = 0x010000, .erasesize = 0x10000, .numblocks = 15 }
+		}
+	}, {
+		.mfr_id = MANUFACTURER_AMD,
+		.dev_id = AM29LV800BT,
+		.name = "AMD AM29LV800BT",
+		.size = 0x00100000,
+		.numeraseregions = 4,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x10000, .numblocks = 15 },
+			{ .offset = 0x0F0000, .erasesize = 0x08000, .numblocks =  1 },
+			{ .offset = 0x0F8000, .erasesize = 0x02000, .numblocks =  2 },
+			{ .offset = 0x0FC000, .erasesize = 0x04000, .numblocks =  1 }
+		}
+	}, {
+		.mfr_id = MANUFACTURER_AMD,
+		.dev_id = AM29F800BT,
+		.name = "AMD AM29F800BT",
+		.size = 0x00100000,
+		.numeraseregions = 4,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x10000, .numblocks = 15 },
+			{ .offset = 0x0F0000, .erasesize = 0x08000, .numblocks =  1 },
+			{ .offset = 0x0F8000, .erasesize = 0x02000, .numblocks =  2 },
+			{ .offset = 0x0FC000, .erasesize = 0x04000, .numblocks =  1 }
+		}
+	}, {
+		.mfr_id = MANUFACTURER_AMD,
+		.dev_id = AM29LV800BB,
+		.name = "AMD AM29LV800BB",
+		.size = 0x00100000,
+		.numeraseregions = 4,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x10000, .numblocks = 15 },
+			{ .offset = 0x0F0000, .erasesize = 0x08000, .numblocks =  1 },
+			{ .offset = 0x0F8000, .erasesize = 0x02000, .numblocks =  2 },
+			{ .offset = 0x0FC000, .erasesize = 0x04000, .numblocks =  1 }
+		}
+	}, {
+		.mfr_id = MANUFACTURER_FUJITSU,
+		.dev_id = MBM29LV800BB,
+		.name = "Fujitsu MBM29LV800BB",
+		.size = 0x00100000,
+		.numeraseregions = 4,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x04000, .numblocks =  1 },
+			{ .offset = 0x004000, .erasesize = 0x02000, .numblocks =  2 },
+			{ .offset = 0x008000, .erasesize = 0x08000, .numblocks =  1 },
+			{ .offset = 0x010000, .erasesize = 0x10000, .numblocks = 15 }
+		}
+	}, {
+		.mfr_id = MANUFACTURER_ST,
+		.dev_id = M29W800T,
+		.name = "ST M29W800T",
+		.size = 0x00100000,
+		.numeraseregions = 4,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x10000, .numblocks = 15 },
+			{ .offset = 0x0F0000, .erasesize = 0x08000, .numblocks =  1 },
+			{ .offset = 0x0F8000, .erasesize = 0x02000, .numblocks =  2 },
+			{ .offset = 0x0FC000, .erasesize = 0x04000, .numblocks =  1 }
+		}
+	}, {
+		.mfr_id = MANUFACTURER_ST,
+		.dev_id = M29W160DT,
+		.name = "ST M29W160DT",
+		.size = 0x00200000,
+		.numeraseregions = 4,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x10000, .numblocks = 31 },
+			{ .offset = 0x1F0000, .erasesize = 0x08000, .numblocks =  1 },
+			{ .offset = 0x1F8000, .erasesize = 0x02000, .numblocks =  2 },
+			{ .offset = 0x1FC000, .erasesize = 0x04000, .numblocks =  1 }
+		}
+	}, {
+		.mfr_id = MANUFACTURER_ST,
+		.dev_id = M29W160DB,
+		.name = "ST M29W160DB",
+		.size = 0x00200000,
+		.numeraseregions = 4,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x04000, .numblocks =  1 },
+			{ .offset = 0x004000, .erasesize = 0x02000, .numblocks =  2 },
+			{ .offset = 0x008000, .erasesize = 0x08000, .numblocks =  1 },
+			{ .offset = 0x010000, .erasesize = 0x10000, .numblocks = 31 }
+		}
+	}, {
+		.mfr_id = MANUFACTURER_AMD,
+		.dev_id = AM29BDS323D,
+		.name = "AMD AM29BDS323D",
+		.size = 0x00400000,
+		.numeraseregions = 3,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x10000, .numblocks = 48 },
+			{ .offset = 0x300000, .erasesize = 0x10000, .numblocks = 15 },
+			{ .offset = 0x3f0000, .erasesize = 0x02000, .numblocks =  8 },
+		}
+	}, {
+		.mfr_id = MANUFACTURER_AMD,
+		.dev_id = AM29BDS643D,
+		.name = "AMD AM29BDS643D",
+		.size = 0x00800000,
+		.numeraseregions = 3,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x10000, .numblocks = 96 },
+			{ .offset = 0x600000, .erasesize = 0x10000, .numblocks = 31 },
+			{ .offset = 0x7f0000, .erasesize = 0x02000, .numblocks =  8 },
+		}
+	}, {
+		.mfr_id = MANUFACTURER_ATMEL,
+		.dev_id = AT49xV16x,
+		.name = "Atmel AT49xV16x",
+		.size = 0x00200000,
+		.numeraseregions = 2,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x02000, .numblocks =  8 },
+			{ .offset = 0x010000, .erasesize = 0x10000, .numblocks = 31 }
+		}
+	}, {
+		.mfr_id = MANUFACTURER_ATMEL,
+		.dev_id = AT49xV16xT,
+		.name = "Atmel AT49xV16xT",
+		.size = 0x00200000,
+		.numeraseregions = 2,
+		.regions = {
+			{ .offset = 0x000000, .erasesize = 0x10000, .numblocks = 31 },
+			{ .offset = 0x1F0000, .erasesize = 0x02000, .numblocks =  8 }
 		}
 	} 
 	};


From dwmw2 at infradead.org  Wed May 28 09:57:49 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:30 2006
Subject: mtd/drivers/mtd/chips jedec_probe.c,1.28,1.29
Message-ID: <E19L1R7-0008RB-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv32414

Modified Files:
	jedec_probe.c 
Log Message:
Some more C99 initialisers

Index: jedec_probe.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/jedec_probe.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- jedec_probe.c	28 May 2003 12:51:48 -0000	1.28
+++ jedec_probe.c	28 May 2003 13:57:46 -0000	1.29
@@ -1719,8 +1719,8 @@
 }
 
 static struct chip_probe jedec_chip_probe = {
-	name: "JEDEC",
-	probe_chip: jedec_probe_chip
+	.name = "JEDEC",
+	.probe_chip = jedec_probe_chip
 };
 
 struct mtd_info *jedec_probe(struct map_info *map)
@@ -1733,9 +1733,9 @@
 }
 
 static struct mtd_chip_driver jedec_chipdrv = {
-	probe: jedec_probe,
-	name: "jedec_probe",
-	module: THIS_MODULE
+	.probe	= jedec_probe,
+	.name	= "jedec_probe",
+	.module	= THIS_MODULE
 };
 
 int __init jedec_probe_init(void)


From dwmw2 at infradead.org  Wed May 28 11:13:27 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:30 2006
Subject: mtd/drivers/mtd/chips Kconfig,1.2,1.3
Message-ID: <E19L2cJ-0000FR-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv934

Modified Files:
	Kconfig 
Log Message:
Add I8 and B8 geometry options


Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/Kconfig,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Kconfig	28 May 2003 10:59:06 -0000	1.2
+++ Kconfig	28 May 2003 15:13:24 -0000	1.3
@@ -106,6 +106,13 @@
 	  If you wish to support CFI devices on a physical bus which is
 	  32 bits wide, say 'Y'.
 
+config MTD_CFI_B8
+	bool "Support 64-bit buswidth"
+	depends on MTD_CFI_GEOMETRY
+	help
+	  If you wish to support CFI devices on a physical bus which is
+	  64 bits wide, say 'Y'.
+
 config MTD_CFI_I1
 	bool "Support 1-chip flash interleave" if !MTD_CFI_B1
 	depends on MTD_CFI_GEOMETRY
@@ -126,6 +133,13 @@
 	depends on MTD_CFI_GEOMETRY
 	help
 	  If your flash chips are interleaved in fours - i.e. you have four
+	  flash chips addressed by each bus cycle, then say 'Y'.
+
+config MTD_CFI_I8
+	bool "Support 8-chip flash interleave"
+	depends on MTD_CFI_GEOMETRY
+	help
+	  If your flash chips are interleaved in eights - i.e. you have eight
 	  flash chips addressed by each bus cycle, then say 'Y'.
 
 config MTD_CFI_INTELEXT


From dwmw2 at infradead.org  Wed May 28 11:16:58 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:30 2006
Subject: mtd/drivers/mtd/maps Kconfig,1.10,1.11
Message-ID: <E19L2fi-0000GU-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv999

Modified Files:
	Kconfig 
Log Message:
Make PCMCIA map driver depend on MTD_COMPLEX_MAPPINGS


Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Kconfig,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Kconfig	28 May 2003 11:34:44 -0000	1.10
+++ Kconfig	28 May 2003 15:16:56 -0000	1.11
@@ -458,7 +458,7 @@
 # This needs CFI or JEDEC, depending on the cards found.
 config MTD_PCI
 	tristate "PCI MTD driver"
-	depends on MTD && PCI
+	depends on MTD && PCI && MTD_COMPLEX_MAPPINGS
 	help
 	  Mapping for accessing flash devices on add-in cards like the Intel XScale
 	  IQ80310 card, and the Intel EBSA285 card in blank ROM programming mode
@@ -468,7 +468,7 @@
 
 config MTD_PCMCIA
 	tristate "PCMCIA MTD driver"
-	depends on MTD && PCMCIA
+	depends on MTD && PCMCIA && MTD_COMPLEX_MAPPINGS
 	help
 	  Map driver for accessing PCMCIA linear flash memory cards. These
 	  cards are usually around 4-16MiB in size. This does not include


From dwmw2 at infradead.org  Wed May 28 11:18:56 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:30 2006
Subject: mtd/drivers/mtd/devices Kconfig,1.3,1.4
Message-ID: <E19L2hc-0000HC-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/devices
In directory phoenix.infradead.org:/tmp/cvs-serv1043

Modified Files:
	Kconfig 
Log Message:
Correct text for Millennium Plus option

Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/Kconfig,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Kconfig	28 May 2003 10:54:23 -0000	1.3
+++ Kconfig	28 May 2003 15:18:54 -0000	1.4
@@ -148,20 +148,16 @@
 	  chips.
 
 config MTD_DOC2001PLUS
-	tristate "M-Systems Disk-On-Chip Millennium-only alternative driver (see help)"
+	tristate "M-Systems Disk-On-Chip Millennium Plus"
 	depends on MTD
 	---help---
-	  This provides an alternative MTD device driver for the M-Systems 
-	  DiskOnChip Millennium devices.  Use this if you have problems with
-	  the combined DiskOnChip 2000 and Millennium driver above.  To get
-	  the DiskOnChip probe code to load and use this driver instead of
-	  the other one, you will need to undefine DOC_SINGLE_DRIVER near
-	  the beginning of <file:drivers/mtd/devices/docprobe.c>.
+	  This provides an MTD device driver for the M-Systems DiskOnChip
+	  Millennium Plus devices.
 
-	  If you use this device, you probably also want to enable the NFTL
-	  'NAND Flash Translation Layer' option below, which is used to
-	  emulate a block device by using a kind of file system on the flash
-	  chips.
+	  If you use this device, you probably also want to enable the INFTL
+	  'Inverse NAND Flash Translation Layer' option below, which is used
+	  to emulate a block device by using a kind of file system on the 
+	  flash chips.
 
 config MTD_DOCPROBE
 	tristate


From dwmw2 at infradead.org  Wed May 28 11:37:35 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:30 2006
Subject: mtd/include/linux/mtd cfi.h,1.34,1.35
Message-ID: <E19L2zf-0000Kz-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv1278

Modified Files:
	cfi.h 
Log Message:
Include version.h


Index: cfi.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/cfi.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- cfi.h	16 May 2003 18:55:44 -0000	1.34
+++ cfi.h	28 May 2003 15:37:32 -0000	1.35
@@ -8,6 +8,7 @@
 #define __MTD_CFI_H__
 
 #include <linux/config.h>
+#include <linux/version.h>
 #include <linux/delay.h>
 #include <linux/types.h>
 #include <linux/interrupt.h>


From dwmw2 at infradead.org  Wed May 28 11:39:55 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:30 2006
Subject: mtd/drivers/mtd/chips sharp.c,1.11,1.12
Message-ID: <E19L31v-0000MS-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv1367

Modified Files:
	sharp.c 
Log Message:
Include mtd.h


Index: sharp.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/sharp.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- sharp.c	28 May 2003 12:51:49 -0000	1.11
+++ sharp.c	28 May 2003 15:39:52 -0000	1.12
@@ -28,6 +28,7 @@
 #include <linux/errno.h>
 #include <linux/interrupt.h>
 #include <linux/mtd/map.h>
+#include <linux/mtd/mtd.h>
 #include <linux/mtd/cfi.h>
 #include <linux/delay.h>
 


From dwmw2 at infradead.org  Wed May 28 11:44:31 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:30 2006
Subject: mtd/drivers/mtd/maps amd76xrom.c,1.7,1.8
Message-ID: <E19L36N-0000TM-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv1797

Modified Files:
	amd76xrom.c 
Log Message:
Add missing semicolon


Index: amd76xrom.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/amd76xrom.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- amd76xrom.c	21 May 2003 12:45:17 -0000	1.7
+++ amd76xrom.c	28 May 2003 15:44:28 -0000	1.8
@@ -102,7 +102,7 @@
 		if (rom_size > window->size) {
 			continue;
 		}
-		info->map.phys = window->start + window->size - rom_size
+		info->map.phys = window->start + window->size - rom_size;
 		info->map.virt = 
 			info->window_addr + window->size - rom_size;
 		info->map.size = rom_size;


From dwmw2 at infradead.org  Wed May 28 11:48:13 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:30 2006
Subject: mtd/include/linux config.h,1.3,1.4
Message-ID: <E19L39x-0000Uo-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux
In directory phoenix.infradead.org:/tmp/cvs-serv1887

Modified Files:
	config.h 
Log Message:
Include partition support, turn off the advanced geometry options since
they're automatic anyway.


Index: config.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/config.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- config.h	27 May 2003 09:35:21 -0000	1.3
+++ config.h	28 May 2003 15:48:10 -0000	1.4
@@ -16,20 +16,14 @@
 #define CONFIG_MTD_COMPLEX_MAPPINGS 1
 #endif
 
+#define CONFIG_MTD_PARTITIONS 1
+
 #define CONFIG_MTD_PHYSMAP_START 0x8000000
 #define CONFIG_MTD_PHYSMAP_LEN 0x4000000
 #define CONFIG_MTD_PHYSMAP_BUSWIDTH 2
 
 #define CONFIG_MTDRAM_TOTAL_SIZE 4096
 #define CONFIG_MTDRAM_ERASE_SIZE 64
-
-#define CONFIG_MTD_CFI_B4
-#define CONFIG_MTD_CFI_B2
-#define CONFIG_MTD_CFI_B1
-
-#define CONFIG_MTD_CFI_I4
-#define CONFIG_MTD_CFI_I2
-#define CONFIG_MTD_CFI_I1
 
 #ifndef NONAND
 #define CONFIG_JFFS2_FS_NAND 1


From dwmw2 at infradead.org  Wed May 28 11:53:46 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:30 2006
Subject: mtd/drivers/mtd/maps physmap.c,1.27,1.28
Message-ID: <E19L3FK-0000W9-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv1970

Modified Files:
	physmap.c 
Log Message:
Fix partition handling


Index: physmap.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/physmap.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- physmap.c	21 May 2003 12:45:19 -0000	1.27
+++ physmap.c	28 May 2003 15:53:43 -0000	1.28
@@ -59,6 +59,7 @@
 };
 
 #define NUM_PARTITIONS	(sizeof(physmap_partitions)/sizeof(struct mtd_partition))
+const char *part_probes[] = {"cmdlinepart", "RedBoot", NULL};
 
 #endif /* CONFIG_MTD_PARTITIONS */
 
@@ -86,7 +87,7 @@
 		mymtd->owner = THIS_MODULE;
 
 #ifdef CONFIG_MTD_PARTITIONS
-		mtd_parts_nb = parse_mtd_partitions(mymtd, probes, 
+		mtd_parts_nb = parse_mtd_partitions(mymtd, part_probes, 
 						    &mtd_parts, 0);
 
 		if (mtd_parts_nb > 0)
@@ -120,7 +121,7 @@
 		del_mtd_partitions(mymtd);
 		kfree(mtd_parts);
 	} else if (NUM_PARTITIONS) {
-		del_mtd_partions(mymtd);
+		del_mtd_partitions(mymtd);
 	} else {
 		del_mtd_device(mymtd);
 	}


From dwmw2 at infradead.org  Thu May 29 04:59:38 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:30 2006
Subject: mtd/drivers/mtd/maps sa1100-flash.c,1.35,1.36
Message-ID: <E19LJG6-00040z-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv15431

Modified Files:
	sa1100-flash.c 
Log Message:
Update from 2.5.67-rmk1

Index: sa1100-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sa1100-flash.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- sa1100-flash.c	21 May 2003 12:45:19 -0000	1.35
+++ sa1100-flash.c	29 May 2003 08:59:35 -0000	1.36
@@ -12,187 +12,185 @@
 #include <linux/ioport.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/slab.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/partitions.h>
+#include <linux/mtd/concat.h>
 
[...1903 lines suppressed...]
 	return ret;
 }
 
 static void __exit sa1100_mtd_cleanup(void)
 {
-	if (mymtd) {
-		del_mtd_partitions(mymtd);
-		map_destroy(mymtd);
-		if (parsed_parts)
-			kfree(parsed_parts);
-	}
-	if (sa1100_map.virt != WINDOW_ADDR) {
-		iounmap((void *)sa1100_map.virt);
-		release_mem_region(sa1100_map.phys, sa1100_map.size);
-	}
+	sa1100_destroy_mtd(info, mymtd);
+	sa1100_destroy_partitions();
 }
 
 module_init(sa1100_mtd_init);


From dwmw2 at infradead.org  Thu May 29 05:24:13 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:30 2006
Subject: mtd/drivers/mtd/maps physmap.c,1.28,1.29
Message-ID: <E19LJdt-00043c-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv15594/maps

Modified Files:
	physmap.c 
Log Message:
Add missing slab.h

Index: physmap.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/physmap.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- physmap.c	28 May 2003 15:53:43 -0000	1.28
+++ physmap.c	29 May 2003 09:24:10 -0000	1.29
@@ -8,6 +8,7 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>


From dwmw2 at infradead.org  Thu May 29 05:25:25 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:31 2006
Subject: mtd/drivers/mtd cmdlinepart.c,1.9,1.10
Message-ID: <E19LJf3-00043x-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv15613

Modified Files:
	cmdlinepart.c 
Log Message:
strlcpy

Index: cmdlinepart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/cmdlinepart.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- cmdlinepart.c	16 May 2003 17:08:24 -0000	1.9
+++ cmdlinepart.c	29 May 2003 09:25:22 -0000	1.10
@@ -28,6 +28,7 @@
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+#include <linux/mtd/compatmac.h>
 #include <asm/setup.h>
 #include <linux/bootmem.h>
 
@@ -178,8 +179,7 @@
 	parts[this_part].mask_flags = mask_flags;
 	if (name)
 	{
-		strncpy(extra_mem, name, name_len);
-		extra_mem[name_len] = 0;
+		strlcpy(extra_mem, name, name_len + 1);
 	}
 	else
 	{
@@ -258,8 +258,7 @@
 		this_mtd->parts = parts;
 		this_mtd->num_parts = num_parts;
 		this_mtd->mtd_id = (char*)(this_mtd + 1);
-		strncpy(this_mtd->mtd_id, mtd_id, mtd_id_len);
-		this_mtd->mtd_id[mtd_id_len] = 0;
+		strlcpy(this_mtd->mtd_id, mtd_id, mtd_id_len + 1);
 
 		/* link into chain */
 		this_mtd->next = partitions;	    	


From dwmw2 at infradead.org  Thu May 29 05:25:26 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:31 2006
Subject: mtd/drivers/mtd/chips jedec.c,1.18,1.19
Message-ID: <E19LJf4-000440-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv15613/chips

Modified Files:
	jedec.c 
Log Message:
strlcpy

Index: jedec.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/jedec.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- jedec.c	28 May 2003 12:51:48 -0000	1.18
+++ jedec.c	29 May 2003 09:25:23 -0000	1.19
@@ -174,8 +174,7 @@
    /* Generate a part name that includes the number of different chips and
       other configuration information */
    count = 1;
-   strncpy(Part,map->name,sizeof(Part)-10);
-   Part[sizeof(Part)-11] = 0;
+   strlcpy(Part,map->name,sizeof(Part)-10);
    strcat(Part," ");
    Uniq = 0;
    for (I = 0; priv->chips[I].jedec != 0 && I < MAX_JEDEC_CHIPS; I++)
@@ -252,8 +251,7 @@
    //   printk("Part: '%s'\n",Part);
    
    memset(MTD,0,sizeof(*MTD));
-  // strncpy(MTD->name,Part,sizeof(MTD->name));
-  // MTD->name[sizeof(MTD->name)-1] = 0;
+  // strlcpy(MTD->name,Part,sizeof(MTD->name));
    MTD->name = map->name;
    MTD->type = MTD_NORFLASH;
    MTD->flags = MTD_CAP_NORFLASH;


From dwmw2 at infradead.org  Thu May 29 05:36:18 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:31 2006
Subject: mtd/drivers/mtd/chips chipreg.c,1.15,1.16
Message-ID: <E19LJpa-00045M-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv15699/chips

Modified Files:
	chipreg.c 
Log Message:
2.5 request_module

Index: chipreg.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/chipreg.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- chipreg.c	21 May 2003 15:15:05 -0000	1.15
+++ chipreg.c	29 May 2003 09:36:15 -0000	1.16
@@ -65,7 +65,7 @@
 
 	drv = get_mtd_chip_driver(name);
 
-	if (!drv && !request_module(name))
+	if (!drv && !request_module("%s", name))
 		drv = get_mtd_chip_driver(name);
 
 	if (!drv)


From dwmw2 at infradead.org  Thu May 29 05:36:18 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:31 2006
Subject: mtd/drivers/mtd mtdpart.c,1.39,1.40
Message-ID: <E19LJpa-00045O-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv15699

Modified Files:
	mtdpart.c 
Log Message:
2.5 request_module

Index: mtdpart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdpart.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- mtdpart.c	21 May 2003 15:15:03 -0000	1.39
+++ mtdpart.c	29 May 2003 09:36:15 -0000	1.40
@@ -528,7 +528,7 @@
 	for ( ; ret <= 0 && *types; types++) {
 		parser = get_partition_parser(*types);
 #ifdef CONFIG_KMOD
-		if (!parser && !request_module(*types))
+		if (!parser && !request_module("%s", *types))
 				parser = get_partition_parser(*types);
 #endif
 		if (!parser) {


From dwmw2 at infradead.org  Thu May 29 05:36:50 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:31 2006
Subject: mtd/include/linux/mtd compatmac.h,1.55,1.56
Message-ID: <E19LJq6-00045g-00@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv15722

Modified Files:
	compatmac.h 
Log Message:
compat for strlcpy and 2.5 request_module

Index: compatmac.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/compatmac.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- compatmac.h	21 May 2003 15:14:30 -0000	1.55
+++ compatmac.h	29 May 2003 09:36:47 -0000	1.56
@@ -100,5 +100,25 @@
 #define generic_file_readonly_mmap generic_file_mmap
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,70)
+
+#include <linux/kmod.h>
+#include <linux/string.h>
+
+static inline char *strlcpy(char *dest, const char *src, int len)
+{
+	dest[len-1] = 0;
+	return strncpy(dest, src, len-1);
+}
+
+static inline int do_old_request_module(const char *mod)
+{
+	return request_module(mod);
+}
+#undef request_module
+#define request_module(fmt, ...) \
+ ({ char modname[32]; snprintf(modname, 31, fmt ,##__VA_ARGS__); do_old_request_module(modname); })
+
+#endif /* 2.5.70 */
 
 #endif /* __LINUX_MTD_COMPATMAC_H__ */


From dwmw2 at infradead.org  Thu May 29 05:44:20 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:31 2006
Subject: mtd/drivers/mtd/maps Config.in,1.51,1.52
Message-ID: <E19LJxM-0004DG-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv16192/drivers/mtd/maps

Modified Files:
	Config.in 
Log Message:
Fix line wrapping

Index: Config.in
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Config.in,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- Config.in	28 May 2003 10:48:41 -0000	1.51
+++ Config.in	29 May 2003 09:44:18 -0000	1.52
@@ -67,8 +67,7 @@
   fi
 fi
 
-if [ "$CONFIG_MIPS_PB1000" = "y" -o  "$CONFIG_MIPS_PB1100" = "y" -o 
-	"$CONFIG_MIPS_PB1500" = "y" ]; then
+if [ "$CONFIG_MIPS_PB1000" = "y" -o  "$CONFIG_MIPS_PB1100" = "y" -o "$CONFIG_MIPS_PB1500" = "y" ]; then
    tristate '  Pb1x00 MTD support' CONFIG_MTD_PB1XXX
    if [ "$CONFIG_MIPS_PB1500" = "y" -o "$CONFIG_MIPS_PB1100" = "m" ]; then
       bool '  Pb1x00 boot flash device' CONFIG_MTD_PB1500_BOOT 


From dwmw2 at infradead.org  Thu May 29 06:35:45 2003
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:48:31 2006
Subject: 
 mtd/drivers/mtd/chips cfi_cmdset_0002.c,1.74,1.75 cfi_cmdset_0020.c,1.6,1.7
Message-ID: <E19LKl7-0004In-00@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv16534

Modified Files:
	cfi_cmdset_0002.c cfi_cmdset_0020.c 
Log Message:
include compatmac.h before cfi.h which needs it

Index: cfi_cmdset_0002.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0002.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- cfi_cmdset_0002.c	28 May 2003 12:51:48 -0000	1.74
+++ cfi_cmdset_0002.c	29 May 2003 10:35:42 -0000	1.75
@@ -24,10 +24,10 @@
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
+#include <linux/mtd/compatmac.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/cfi.h>
-#include <linux/mtd/compatmac.h>
 
 #define AMD_BOOTLOC_BUG
 

Index: cfi_cmdset_0020.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0020.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- cfi_cmdset_0020.c	28 May 2003 12:51:48 -0000	1.6
+++ cfi_cmdset_0020.c	29 May 2003 10:35:42 -0000	1.7
@@ -30,10 +30,10 @@
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
+#include <linux/mtd/compatmac.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/cfi.h>
 #include <linux/mtd/mtd.h>
-#include <linux/mtd/compatmac.h>
 
 
 static int cfi_staa_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *);


