mtd/drivers/mtd/nand nand_bbt.c,1.22,1.23

dbrown at infradead.org dbrown at infradead.org
Thu Jun 24 10:59:31 EDT 2004


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

Modified Files:
	nand_bbt.c 
Log Message:
Fix type usage for BBT version codes.


Index: nand_bbt.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_bbt.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- nand_bbt.c	24 Jun 2004 14:24:24 -0000	1.22
+++ nand_bbt.c	24 Jun 2004 14:59:29 -0000	1.23
@@ -226,14 +226,14 @@
 	/* Read the primary version, if available */	
 	if (td->options & NAND_BBT_VERSION) {
 		nand_read_raw (mtd, buf, td->pages[0] << this->page_shift, mtd->oobblock, mtd->oobsize); 
-		td->version[0] = *((char *) &buf[mtd->oobblock + td->veroffs]);
+		td->version[0] = buf[mtd->oobblock + td->veroffs];
 		printk (KERN_DEBUG "Bad block table at page %d, version 0x%02X\n", td->pages[0], td->version[0]);
 	}
 
 	/* Read the mirror version, if available */	
 	if (md && (md->options & NAND_BBT_VERSION)) {
 		nand_read_raw (mtd, buf, md->pages[0] << this->page_shift, mtd->oobblock, mtd->oobsize); 
-		md->version[0] = *((char *) &buf[mtd->oobblock + md->veroffs]);
+		md->version[0] = buf[mtd->oobblock + md->veroffs];
 		printk (KERN_DEBUG "Bad block table at page %d, version 0x%02X\n", md->pages[0], md->version[0]);
 	}
 
@@ -365,7 +365,7 @@
 			if (!check_pattern(buf, scanlen, mtd->oobblock, td)) {
 				td->pages[i] = actblock << (this->bbt_erase_shift - this->page_shift);
 				if (td->options & NAND_BBT_VERSION) {
-					td->version[i] = *((char *) &buf[mtd->oobblock + td->veroffs]);
+					td->version[i] = buf[mtd->oobblock + td->veroffs];
 				}
 				break;
 			}
@@ -527,7 +527,7 @@
 			memset (&buf[len + pageoffs * mtd->oobsize], 0xff,
 				((len >> this->page_shift) - pageoffs) * mtd->oobsize);
 			if (td->options & NAND_BBT_VERSION) {
-				*((char *) &buf[len + (pageoffs * mtd->oobsize) + td->veroffs]) = td->version[chip];
+				buf[len + (pageoffs * mtd->oobsize) + td->veroffs] = td->version[chip];
 			}
 		} else {
 			/* Calc length */
@@ -540,7 +540,7 @@
 			/* Pattern is located in oob area of first page */
 			memcpy (&buf[len + td->offs], td->pattern, td->len);
 			if (td->options & NAND_BBT_VERSION) {
-				*((char *) &buf[len + td->veroffs]) = td->version[chip];
+				buf[len + td->veroffs] = td->version[chip];
 			}
 		}
 	
@@ -658,7 +658,7 @@
 				goto writecheck;
 			}	
 
-			if ((td->version[i] - md->version[i]) > 0) {
+			if (((int8_t) (td->version[i] - md->version[i])) > 0) {
 				rd = td;
 				md->version[i] = td->version[i];
 				writeops = 2;





More information about the linux-mtd-cvs mailing list