[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>
This commit is contained in:
Kyungmin Park 2005-12-16 11:17:29 +09:00 committed by Linus Torvalds
parent ee219e5e7c
commit 37b1cc3910
2 changed files with 10 additions and 7 deletions

View File

@ -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[] = {
*/ */
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";
return (i != ONENAND_MFR_UNKNOWN); printk(KERN_DEBUG "OneNAND Manufacturer: %s (0x%0x)\n", name, manuf);
return (i == size);
} }
/** /**

View File

@ -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