mtd/drivers/mtd/nand autcpu12.c,1.13,1.14

gleixner at infradead.org gleixner at infradead.org
Wed Apr 14 15:00:58 EDT 2004


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

Modified Files:
	autcpu12.c 
Log Message:
modify to meet new requirements

Index: autcpu12.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/autcpu12.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- autcpu12.c	11 Jul 2003 15:12:29 -0000	1.13
+++ autcpu12.c	14 Apr 2004 19:00:56 -0000	1.14
@@ -140,6 +140,11 @@
 	return ( (*(volatile unsigned char *) (autcpu12_io_base + autcpu12_pedr)) & AUTCPU12_SMC_RDY) ? 1 : 0;
 
 }
+
+/* Internal buffers. Page buffer and oob buffer for one block*/
+static u_char data_buf[512 + 16];
+static u_char oob_buf[16 * 32];
+
 /*
  * Main initialization routine
  */
@@ -184,20 +189,16 @@
 	this->chip_delay = 20;		
 	this->eccmode = NAND_ECC_SOFT;
 
+	/* Set internal data buffer */
+	this->data_buf = data_buf;
+	this->oob_buf = oob_buf;
+
 	/* Scan to find existance of the device */
 	if (nand_scan (autcpu12_mtd, 1)) {
 		err = -ENXIO;
 		goto out_ior;
 	}
-
-	/* Allocate memory for internal data buffer */
-	this->data_buf = kmalloc (sizeof(u_char) * (autcpu12_mtd->oobblock + autcpu12_mtd->oobsize), GFP_KERNEL);
-	if (!this->data_buf) {
-		printk ("Unable to allocate NAND data buffer for AUTCPU12.\n");
-		err = -ENOMEM;
-		goto out_ior;
-	}
-
+	
 	/* Register the partitions */
 	switch(autcpu12_mtd->size){
 		case SZ_16M: add_mtd_partitions(autcpu12_mtd, partition_info16k, NUM_PARTITIONS16K); break;
@@ -207,13 +208,11 @@
 		default: {
 			printk ("Unsupported SmartMedia device\n"); 
 			err = -ENXIO;
-			goto out_buf;
+			goto out_ior;
 		}
 	}
 	goto out;
 
-out_buf:
-	kfree (this->data_buf);    
 out_ior:
 	iounmap((void *)autcpu12_fio_base);
 out_mtd:
@@ -237,9 +236,6 @@
 	
 	/* Unregister the device */
 	del_mtd_device (autcpu12_mtd);
-
-	/* Free internal data buffers */
-	kfree (this->data_buf);
 
 	/* unmap physical adress */
 	iounmap((void *)autcpu12_fio_base);




More information about the linux-mtd-cvs mailing list