File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -786,9 +786,9 @@ int hibernate(void)
786786 unlock_device_hotplug ();
787787 if (snapshot_test ) {
788788 pm_pr_dbg ("Checking hibernation image\n" );
789- error = swsusp_check (snapshot_test );
789+ error = swsusp_check (false );
790790 if (!error )
791- error = load_image_and_restore (snapshot_test );
791+ error = load_image_and_restore (false );
792792 }
793793 thaw_processes ();
794794
@@ -945,14 +945,14 @@ static int software_resume(void)
945945 pm_pr_dbg ("Looking for hibernation image.\n" );
946946
947947 mutex_lock (& system_transition_mutex );
948- error = swsusp_check (false );
948+ error = swsusp_check (true );
949949 if (error )
950950 goto Unlock ;
951951
952952 /* The snapshot device should not be opened while we're running */
953953 if (!hibernate_acquire ()) {
954954 error = - EBUSY ;
955- swsusp_close (false );
955+ swsusp_close (true );
956956 goto Unlock ;
957957 }
958958
@@ -973,7 +973,7 @@ static int software_resume(void)
973973 goto Close_Finish ;
974974 }
975975
976- error = load_image_and_restore (false );
976+ error = load_image_and_restore (true );
977977 thaw_processes ();
978978 Finish :
979979 pm_notifier_call_chain (PM_POST_RESTORE );
@@ -987,7 +987,7 @@ static int software_resume(void)
987987 pm_pr_dbg ("Hibernation image not present or could not be loaded.\n" );
988988 return error ;
989989 Close_Finish :
990- swsusp_close (false );
990+ swsusp_close (true );
991991 goto Finish ;
992992}
993993
Original file line number Diff line number Diff line change @@ -168,11 +168,11 @@ extern int swsusp_swap_in_use(void);
168168#define SF_HW_SIG 8
169169
170170/* kernel/power/hibernate.c */
171- int swsusp_check (bool snapshot_test );
171+ int swsusp_check (bool exclusive );
172172extern void swsusp_free (void );
173173extern int swsusp_read (unsigned int * flags_p );
174174extern int swsusp_write (unsigned int flags );
175- void swsusp_close (bool snapshot_test );
175+ void swsusp_close (bool exclusive );
176176#ifdef CONFIG_SUSPEND
177177extern int swsusp_unmark (void );
178178#endif
Original file line number Diff line number Diff line change @@ -1513,12 +1513,13 @@ int swsusp_read(unsigned int *flags_p)
15131513static void * swsusp_holder ;
15141514
15151515/**
1516- * swsusp_check - Check for swsusp signature in the resume device
1516+ * swsusp_check - Check for swsusp signature in the resume device
1517+ * @exclusive: Open the resume device exclusively.
15171518 */
15181519
1519- int swsusp_check (bool snapshot_test )
1520+ int swsusp_check (bool exclusive )
15201521{
1521- void * holder = snapshot_test ? & swsusp_holder : NULL ;
1522+ void * holder = exclusive ? & swsusp_holder : NULL ;
15221523 int error ;
15231524
15241525 hib_resume_bdev = blkdev_get_by_dev (swsusp_resume_device , BLK_OPEN_READ ,
@@ -1563,17 +1564,18 @@ int swsusp_check(bool snapshot_test)
15631564}
15641565
15651566/**
1566- * swsusp_close - close swap device.
1567+ * swsusp_close - close swap device.
1568+ * @exclusive: Close the resume device which is exclusively opened.
15671569 */
15681570
1569- void swsusp_close (bool snapshot_test )
1571+ void swsusp_close (bool exclusive )
15701572{
15711573 if (IS_ERR (hib_resume_bdev )) {
15721574 pr_debug ("Image device not initialised\n" );
15731575 return ;
15741576 }
15751577
1576- blkdev_put (hib_resume_bdev , snapshot_test ? & swsusp_holder : NULL );
1578+ blkdev_put (hib_resume_bdev , exclusive ? & swsusp_holder : NULL );
15771579}
15781580
15791581/**
You can’t perform that action at this time.
0 commit comments