mtd/drivers/mtd/nand nand_base.c,1.104,1.105

gleixner at infradead.org gleixner at infradead.org
Fri Jun 18 12:22:45 EDT 2004


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

Modified Files:
	nand_base.c 
Log Message:
fix typecasts and comments

Index: nand_base.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_base.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -r1.104 -r1.105
--- nand_base.c	18 Jun 2004 00:01:27 -0000	1.104
+++ nand_base.c	18 Jun 2004 16:22:42 -0000	1.105
@@ -384,7 +384,7 @@
 	u16 bad;
 
 	if (getchip) {
-		page = ((int) ofs) >> this->page_shift;
+		page = (int)(ofs >> this->page_shift);
 		chipnr = (int)(ofs >> this->chip_shift);
 
 		/* Grab the lock and see if the device is available */
@@ -841,7 +841,7 @@
 			/* enable hardware ecc logic for write */
 			this->enable_hwecc(mtd, NAND_ECC_WRITE);
 			this->write_buf(mtd, &this->data_poi[datidx], this->eccsize);
-			this->calculate_ecc(mtd, NULL, ecc_code);
+			this->calculate_ecc(mtd, &this->data_poi[datidx], ecc_code);
 			for (i = 0; i < eccbytes; i++, eccidx++)
 				oob_buf[oob_config[eccidx]] = ecc_code[i];
 			/* If the hardware ecc provides syndromes then
@@ -1069,7 +1069,7 @@
 	this->select_chip(mtd, chipnr);
 
 	/* First we calculate the starting page */
-	realpage = from >> this->page_shift;
+	realpage = (int) (from >> this->page_shift);
 	page = realpage & this->pagemask;
 
 	/* Get raw starting column */
@@ -1169,11 +1169,13 @@
 					 * generator for an error, reads back the syndrome and
 					 * does the error correction on the fly */
 					if (this->correct_data(mtd, &data_poi[datidx], &oob_data[i], &ecc_code[i]) == -1) {
-						DEBUG (MTD_DEBUG_LEVEL0, "DBB nand_read_ecc: " "Failed ECC read, page 0x%08x\n", page);
+						DEBUG (MTD_DEBUG_LEVEL0, "nand_read_ecc: " 
+							"Failed ECC read, page 0x%08x on chip %d\n", page, chipnr);
 						ecc_failed++;
 					}
-				} else
+				} else {
 					this->calculate_ecc(mtd, &data_poi[datidx], &ecc_calc[i]);
+				}	
 			}
 			break;						
 
@@ -1304,7 +1306,7 @@
 	DEBUG (MTD_DEBUG_LEVEL3, "nand_read_oob: from = 0x%08x, len = %i\n", (unsigned int) from, (int) len);
 
 	/* Shift to get page */
-	page = ((int) from) >> this->page_shift;
+	page = (int)(from >> this->page_shift);
 	chipnr = (int)(from >> this->chip_shift);
 	
 	/* Mask to get column */
@@ -1558,7 +1560,7 @@
 	nand_get_chip (this, mtd, FL_WRITING);
 
 	/* Calculate chipnr */
-	chipnr = (int)(to>> this->chip_shift);
+	chipnr = (int)(to >> this->chip_shift);
 	/* Select the NAND device */
 	this->select_chip(mtd, chipnr);
 
@@ -1578,7 +1580,7 @@
 
 	/* Setup variables and oob buffer */
 	totalpages = len >> this->page_shift;
-	page = ((int) to) >> this->page_shift;
+	page = (int) (to >> this->page_shift);
 	/* Invalidate the page cache, if we write to the cached page */
 	if (page <= this->pagebuf && this->pagebuf < (page + totalpages))  
 		this->pagebuf = -1;
@@ -1851,7 +1853,7 @@
 	}	
 
 	/* Setup start page */
-	page = ((int) to) >> this->page_shift;
+	page = (int) (to >> this->page_shift);
 	/* Invalidate the page cache, if we write to the cached page */
 	if (page <= this->pagebuf && this->pagebuf < ((to + total_len) >> this->page_shift))  
 		this->pagebuf = -1;
@@ -2057,7 +2059,7 @@
 
 	while (len) {
 		/* Check if we have a bad block, we do not erase bad blocks ! */
-		if (nand_block_checkbad(mtd, (loff_t) page << this->page_shift, 0, allowbbt)) {
+		if (nand_block_checkbad(mtd, ((loff_t) page) << this->page_shift, 0, allowbbt)) {
 			printk (KERN_WARNING "nand_erase: attempt to erase a bad block at page 0x%08x\n", page);
 			instr->state = MTD_ERASE_FAILED;
 			goto erase_exit;





More information about the linux-mtd-cvs mailing list