Add nand driver that works with a nand simulator
[yaffs2.git] / yaffs_vfs_single.c
index 19ced5f021f7ce7e450f2dad07bf5bb9012f927a..145517b69b165d4274037493075046c85c78ac58 100644 (file)
@@ -436,7 +436,8 @@ static int yaffs_unlink(struct inode *dir, struct dentry *dentry)
        return -ENOTEMPTY;
 }
 
-static int yaffs_sync_object(struct file *file, loff_t start, loff_t end, int datasync)
+static int yaffs_sync_object(struct file *file,
+                               loff_t start, loff_t end, int datasync)
 {
 
        struct yaffs_obj *obj;
@@ -1219,7 +1220,8 @@ static int yaffs_writepage(struct page *page, struct writeback_control *wbc)
                (int)obj->variant.file_variant.file_size, (int)inode->i_size);
 
        n_written = yaffs_wr_file(obj, buffer,
-                                 ((loff_t)page->index) << PAGE_CACHE_SHIFT, n_bytes, 0);
+                                 ((loff_t)page->index) << PAGE_CACHE_SHIFT,
+                                 n_bytes, 0);
 
        yaffs_touch_super(dev);
 
@@ -1910,6 +1912,7 @@ static void yaffs_fill_inode_from_obj(struct inode *inode,
 static void yaffs_put_super(struct super_block *sb)
 {
        struct yaffs_dev *dev = yaffs_super_to_dev(sb);
+       struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
 
        yaffs_trace(YAFFS_TRACE_OS, "yaffs_put_super");
 
@@ -1939,16 +1942,14 @@ static void yaffs_put_super(struct super_block *sb)
        }
 
        kfree(dev);
-}
 
-static void yaffs_mtd_put_super(struct super_block *sb)
-{
-       struct mtd_info *mtd = yaffs_dev_to_mtd(yaffs_super_to_dev(sb));
 
-       if (mtd->sync)
+
+       if (mtd && mtd->sync)
                mtd->sync(mtd);
 
-       put_mtd_device(mtd);
+       if (mtd)
+               put_mtd_device(mtd);
 }
 
 static const struct super_operations yaffs_super_ops = {
@@ -2211,7 +2212,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
        yaffs_dev_to_lc(dev)->put_super_fn = yaffs_mtd_put_super;
 
        param->sb_dirty_fn = yaffs_touch_super;
-       param->gc_control = yaffs_gc_control_callback;
+       param->gc_control_fn = yaffs_gc_control_callback;
 
        yaffs_dev_to_lc(dev)->super = sb;
 
@@ -2260,10 +2261,6 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
 
        sb->s_maxbytes = yaffs_max_file_size(dev);
 
-       yaffs_trace(YAFFS_TRACE_OS,
-               "yaffs_readpage_nolock at %lld, size %08x",
-               (long long)pos,
-               (unsigned)PAGE_CACHE_SIZE);
        /* Release lock before yaffs_get_inode() */
        yaffs_gross_unlock(dev);
 
@@ -2374,9 +2371,9 @@ static char *yaffs_dump_dev_part0(char *buf, struct yaffs_dev *dev)
 static char *yaffs_dump_dev_part1(char *buf, struct yaffs_dev *dev)
 {
        buf += sprintf(buf, "max file size......... %lld\n",
-                       (long long) yaffs_max_file_size(dev));
+                       (long long) yaffs_max_file_size(dev));
        buf += sprintf(buf, "data_bytes_per_chunk.. %d\n",
-                   dev->data_bytes_per_chunk);
+                       dev->data_bytes_per_chunk);
        buf += sprintf(buf, "chunk_grp_bits........ %d\n", dev->chunk_grp_bits);
        buf += sprintf(buf, "chunk_grp_size........ %d\n", dev->chunk_grp_size);
        buf +=