Merge remote-tracking branch 'origin/time_upgrade' into 64_and_32_bit_time_tests
[yaffs2.git] / yaffs_guts.c
index ba7fc845812a62e73abc6348a6e7661e1180316b..4621dfa2117b33fc78abb105c389246074551b9c 100644 (file)
@@ -163,6 +163,8 @@ u8 *yaffs_get_temp_buffer(struct yaffs_dev * dev)
 
 }
 
+/* Frees all the temp_buffer objects in the yaffs_dev instance
+*/
 void yaffs_release_temp_buffer(struct yaffs_dev *dev, u8 *buffer)
 {
        int i;
@@ -4541,11 +4543,16 @@ int yaffs_guts_ll_init(struct yaffs_dev *dev)
                return YAFFS_FAIL;
        }
 
+       if (!yaffs_init_tmp_buffers(dev))
+               return YAFFS_FAIL;
+
        if (yaffs_init_nand(dev) != YAFFS_OK) {
                yaffs_trace(YAFFS_TRACE_ALWAYS, "InitialiseNAND failed");
                return YAFFS_FAIL;
        }
 
+       dev->ll_init = 1;
+
        return YAFFS_OK;
 }
 
@@ -4692,10 +4699,7 @@ int yaffs_guts_initialise(struct yaffs_dev *dev)
 
        yaffs_endian_config(dev);
 
-       /* Initialise temporary buffers and caches. */
-       if (!yaffs_init_tmp_buffers(dev))
-               init_failed = 1;
-
+       /* Initialise temporary caches. */
        dev->gc_cleanup_list = NULL;
 
        if (!init_failed)
@@ -4824,6 +4828,7 @@ void yaffs_deinitialise(struct yaffs_dev *dev)
                kfree(dev->checkpt_block_list);
                dev->checkpt_block_list = NULL;
 
+               dev->ll_init = 0;
                dev->is_mounted = 0;
 
                yaffs_deinit_nand(dev);