]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] mtd onenand driver: check correct manufacturer
authorKyungmin Park <kyungmin.park@samsung.com>
Fri, 16 Dec 2005 02:17:29 +0000 (11:17 +0900)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 19 Dec 2005 00:28:23 +0000 (16:28 -0800)
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>
drivers/mtd/onenand/onenand_base.c
include/linux/mtd/onenand.h

index f67d5d6eb9a68aa1f290b4e580429c13017cd5c1..33d6f5c2e053c6a955c324140765b390861a993e 100644 (file)
@@ -1346,7 +1346,6 @@ static void onenand_print_device_info(int device)
 
 static const struct onenand_manufacturers onenand_manuf_ids[] = {
         {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)
 {
+       int size = ARRAY_SIZE(onenand_manuf_ids);
+       char *name;
         int i;
 
-        for (i = 0; onenand_manuf_ids[i].id; i++) {
+       for (i = 0; i < size; i++)
                 if (manuf == onenand_manuf_ids[i].id)
                         break;
-        }
 
-        printk(KERN_DEBUG "OneNAND Manufacturer: %s (0x%0x)\n",
-                onenand_manuf_ids[i].name, manuf);
+       if (i < size)
+               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);
 }
 
 /**
index f1fd4215686acc2b7655c6a5e63f974115c3ff78..53423d3b43bfbd144e6751828f62983a15b5d828 100644 (file)
@@ -140,7 +140,6 @@ struct onenand_chip {
  * OneNAND Flash Manufacturer ID Codes
  */
 #define ONENAND_MFR_SAMSUNG    0xec
-#define ONENAND_MFR_UNKNOWN    0x00
 
 /**
  * struct nand_manufacturers - NAND Flash Manufacturer ID Structure