aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyungmin Park <kyungmin.park@samsung.com>2005-12-15 21:17:29 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-12-18 19:28:23 -0500
commit37b1cc3910f7976369fc0ed55068a686e92555e6 (patch)
treea4560bd6c25546e43d266a8b1f5f6f9d6d177421
parentee219e5e7c12b742243a080e2d8d288a48a32e44 (diff)
[PATCH] mtd onenand driver: check correct manufacturer
This (and the three subsequent patches) is working well on OMAP H4 with 2.6.15-rc4 kernel and passes the LTP fs test. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/mtd/onenand/onenand_base.c16
-rw-r--r--include/linux/mtd/onenand.h1
2 files changed, 10 insertions, 7 deletions
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index f67d5d6eb9a6..33d6f5c2e053 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -1346,7 +1346,6 @@ static void onenand_print_device_info(int device)
1346 1346
1347static const struct onenand_manufacturers onenand_manuf_ids[] = { 1347static const struct onenand_manufacturers onenand_manuf_ids[] = {
1348 {ONENAND_MFR_SAMSUNG, "Samsung"}, 1348 {ONENAND_MFR_SAMSUNG, "Samsung"},
1349 {ONENAND_MFR_UNKNOWN, "Unknown"}
1350}; 1349};
1351 1350
1352/** 1351/**
@@ -1357,17 +1356,22 @@ static const struct onenand_manufacturers onenand_manuf_ids[] = {
1357 */ 1356 */
1358static int onenand_check_maf(int manuf) 1357static int onenand_check_maf(int manuf)
1359{ 1358{
1359 int size = ARRAY_SIZE(onenand_manuf_ids);
1360 char *name;
1360 int i; 1361 int i;
1361 1362
1362 for (i = 0; onenand_manuf_ids[i].id; i++) { 1363 for (i = 0; i < size; i++)
1363 if (manuf == onenand_manuf_ids[i].id) 1364 if (manuf == onenand_manuf_ids[i].id)
1364 break; 1365 break;
1365 }
1366 1366
1367 printk(KERN_DEBUG "OneNAND Manufacturer: %s (0x%0x)\n", 1367 if (i < size)
1368 onenand_manuf_ids[i].name, manuf); 1368 name = onenand_manuf_ids[i].name;
1369 else
1370 name = "Unknown";
1371
1372 printk(KERN_DEBUG "OneNAND Manufacturer: %s (0x%0x)\n", name, manuf);
1369 1373
1370 return (i != ONENAND_MFR_UNKNOWN); 1374 return (i == size);
1371} 1375}
1372 1376
1373/** 1377/**
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index f1fd4215686a..53423d3b43bf 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -140,7 +140,6 @@ struct onenand_chip {
140 * OneNAND Flash Manufacturer ID Codes 140 * OneNAND Flash Manufacturer ID Codes
141 */ 141 */
142#define ONENAND_MFR_SAMSUNG 0xec 142#define ONENAND_MFR_SAMSUNG 0xec
143#define ONENAND_MFR_UNKNOWN 0x00
144 143
145/** 144/**
146 * struct nand_manufacturers - NAND Flash Manufacturer ID Structure 145 * struct nand_manufacturers - NAND Flash Manufacturer ID Structure