PM: hibernate: Turn snapshot_test into global variable
[platform/kernel/linux-starfive.git] / kernel / power / hibernate.c
index 793c55a..aa551b0 100644 (file)
@@ -64,6 +64,7 @@ enum {
 static int hibernation_mode = HIBERNATION_SHUTDOWN;
 
 bool freezer_test_done;
+bool snapshot_test;
 
 static const struct platform_hibernation_ops *hibernation_ops;
 
@@ -716,7 +717,6 @@ static int load_image_and_restore(void)
  */
 int hibernate(void)
 {
-       bool snapshot_test = false;
        unsigned int sleep_flags;
        int error;
 
@@ -744,6 +744,9 @@ int hibernate(void)
        if (error)
                goto Exit;
 
+       /* protected by system_transition_mutex */
+       snapshot_test = false;
+
        lock_device_hotplug();
        /* Allocate memory management structures */
        error = create_basic_memory_bitmaps();
@@ -940,6 +943,8 @@ static int software_resume(void)
         */
        mutex_lock_nested(&system_transition_mutex, SINGLE_DEPTH_NESTING);
 
+       snapshot_test = false;
+
        if (swsusp_resume_device)
                goto Check_image;