mtd: chips: use common manufacturer codes in jedec_probe()
[safe/jmp/linux-2.6] / drivers / mtd / sm_ftl.c
index 2e7307d..67822cf 100644 (file)
 #include <linux/freezer.h>
 #include <linux/sysfs.h>
 #include <linux/bitops.h>
+#include <linux/slab.h>
+#include <linux/mtd/nand_ecc.h>
 #include "nand/sm_common.h"
 #include "sm_ftl.h"
 
-#ifdef CONFIG_SM_FTL_MUSEUM
-#include <linux/mtd/nand_ecc.h>
-#endif
 
 
 struct workqueue_struct *cache_flush_workqueue;
@@ -206,7 +205,6 @@ static void sm_break_offset(struct sm_ftl *ftl, loff_t offset,
 
 static int sm_correct_sector(uint8_t *buffer, struct sm_oob *oob)
 {
-#ifdef CONFIG_SM_FTL_MUSEUM
        uint8_t ecc[3];
 
        __nand_calculate_ecc(buffer, SM_SMALL_PAGE, ecc);
@@ -218,7 +216,6 @@ static int sm_correct_sector(uint8_t *buffer, struct sm_oob *oob)
        __nand_calculate_ecc(buffer, SM_SMALL_PAGE, ecc);
        if (__nand_correct_data(buffer, ecc, oob->ecc2, SM_SMALL_PAGE) < 0)
                return -EIO;
-#endif
        return 0;
 }
 
@@ -382,7 +379,6 @@ restart:
                        oob.data_status = 0;
                }
 
-#ifdef CONFIG_SM_FTL_MUSEUM
                if (ftl->smallpagenand) {
                        __nand_calculate_ecc(buf + boffset,
                                                SM_SMALL_PAGE, oob.ecc1);
@@ -390,7 +386,6 @@ restart:
                        __nand_calculate_ecc(buf + boffset + SM_SMALL_PAGE,
                                                SM_SMALL_PAGE, oob.ecc2);
                }
-#endif
                if (!sm_write_sector(ftl, zone, block, boffset,
                                                        buf + boffset, &oob))
                        continue;
@@ -939,7 +934,7 @@ int sm_cache_flush(struct sm_ftl *ftl)
 
 
        /* Try to read all unread areas of the cache block*/
-       for_each_bit(sector_num, &ftl->cache_data_invalid_bitmap,
+       for_each_set_bit(sector_num, &ftl->cache_data_invalid_bitmap,
                ftl->block_size / SM_SECTOR_SIZE) {
 
                if (!sm_read_sector(ftl,