Revert to Fedora kernel-2.6.17-1.2187_FC5 patched with vs2.0.2.1; there are too many...
[linux-2.6.git] / drivers / mtd / mtdblock.c
index 04ed346..2cef280 100644 (file)
@@ -7,6 +7,7 @@
  * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org>
  */
 
+#include <linux/config.h>
 #include <linux/fs.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
@@ -70,7 +71,7 @@ static int erase_write (struct mtd_info *mtd, unsigned long pos,
        set_current_state(TASK_INTERRUPTIBLE);
        add_wait_queue(&wait_q, &wait);
 
-       ret = mtd->erase(mtd, &erase);
+       ret = MTD_ERASE(mtd, &erase);
        if (ret) {
                set_current_state(TASK_RUNNING);
                remove_wait_queue(&wait_q, &wait);
@@ -87,7 +88,7 @@ static int erase_write (struct mtd_info *mtd, unsigned long pos,
         * Next, writhe data to flash.
         */
 
-       ret = mtd->write(mtd, pos, len, &retlen, buf);
+       ret = MTD_WRITE (mtd, pos, len, &retlen, buf);
        if (ret)
                return ret;
        if (retlen != len)
@@ -137,7 +138,7 @@ static int do_cached_write (struct mtdblk_dev *mtdblk, unsigned long pos,
                mtd->name, pos, len);
 
        if (!sect_size)
-               return mtd->write(mtd, pos, len, &retlen, buf);
+               return MTD_WRITE (mtd, pos, len, &retlen, buf);
 
        while (len > 0) {
                unsigned long sect_start = (pos/sect_size)*sect_size;
@@ -169,8 +170,7 @@ static int do_cached_write (struct mtdblk_dev *mtdblk, unsigned long pos,
                            mtdblk->cache_offset != sect_start) {
                                /* fill the cache with the current sector */
                                mtdblk->cache_state = STATE_EMPTY;
-                               ret = mtd->read(mtd, sect_start, sect_size,
-                                               &retlen, mtdblk->cache_data);
+                               ret = MTD_READ(mtd, sect_start, sect_size, &retlen, mtdblk->cache_data);
                                if (ret)
                                        return ret;
                                if (retlen != sect_size)
@@ -207,7 +207,7 @@ static int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos,
                        mtd->name, pos, len);
 
        if (!sect_size)
-               return mtd->read(mtd, pos, len, &retlen, buf);
+               return MTD_READ (mtd, pos, len, &retlen, buf);
 
        while (len > 0) {
                unsigned long sect_start = (pos/sect_size)*sect_size;
@@ -226,7 +226,7 @@ static int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos,
                    mtdblk->cache_offset == sect_start) {
                        memcpy (buf, mtdblk->cache_data + offset, size);
                } else {
-                       ret = mtd->read(mtd, pos, size, &retlen, buf);
+                       ret = MTD_READ (mtd, pos, size, &retlen, buf);
                        if (ret)
                                return ret;
                        if (retlen != size)
@@ -288,7 +288,8 @@ static int mtdblock_open(struct mtd_blktrans_dev *mbd)
 
        mutex_init(&mtdblk->cache_mutex);
        mtdblk->cache_state = STATE_EMPTY;
-       if ( !(mtdblk->mtd->flags & MTD_NO_ERASE) && mtdblk->mtd->erasesize) {
+       if ((mtdblk->mtd->flags & MTD_CAP_RAM) != MTD_CAP_RAM &&
+           mtdblk->mtd->erasesize) {
                mtdblk->cache_size = mtdblk->mtd->erasesize;
                mtdblk->cache_data = NULL;
        }