Commit 37b1cc39 authored by Kyungmin Park's avatar Kyungmin Park Committed by Linus Torvalds

[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: default avatarLinus Torvalds <torvalds@osdl.org>
parent ee219e5e
...@@ -1346,7 +1346,6 @@ static void onenand_print_device_info(int device) ...@@ -1346,7 +1346,6 @@ static void onenand_print_device_info(int device)
static const struct onenand_manufacturers onenand_manuf_ids[] = { static const struct onenand_manufacturers onenand_manuf_ids[] = {
{ONENAND_MFR_SAMSUNG, "Samsung"}, {ONENAND_MFR_SAMSUNG, "Samsung"},
{ONENAND_MFR_UNKNOWN, "Unknown"}
}; };
/** /**
...@@ -1357,17 +1356,22 @@ static const struct onenand_manufacturers onenand_manuf_ids[] = { ...@@ -1357,17 +1356,22 @@ static const struct onenand_manufacturers onenand_manuf_ids[] = {
*/ */
static int onenand_check_maf(int manuf) static int onenand_check_maf(int manuf)
{ {
int size = ARRAY_SIZE(onenand_manuf_ids);
char *name;
int i; int i;
for (i = 0; onenand_manuf_ids[i].id; i++) { for (i = 0; i < size; i++)
if (manuf == onenand_manuf_ids[i].id) if (manuf == onenand_manuf_ids[i].id)
break; break;
}
printk(KERN_DEBUG "OneNAND Manufacturer: %s (0x%0x)\n", if (i < size)
onenand_manuf_ids[i].name, manuf); name = onenand_manuf_ids[i].name;
else
name = "Unknown";
printk(KERN_DEBUG "OneNAND Manufacturer: %s (0x%0x)\n", name, manuf);
return (i != ONENAND_MFR_UNKNOWN); return (i == size);
} }
/** /**
......
...@@ -140,7 +140,6 @@ struct onenand_chip { ...@@ -140,7 +140,6 @@ struct onenand_chip {
* OneNAND Flash Manufacturer ID Codes * OneNAND Flash Manufacturer ID Codes
*/ */
#define ONENAND_MFR_SAMSUNG 0xec #define ONENAND_MFR_SAMSUNG 0xec
#define ONENAND_MFR_UNKNOWN 0x00
/** /**
* struct nand_manufacturers - NAND Flash Manufacturer ID Structure * struct nand_manufacturers - NAND Flash Manufacturer ID Structure
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment