File tree Expand file tree Collapse file tree 3 files changed +16
-14
lines changed Expand file tree Collapse file tree 3 files changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -786,9 +786,9 @@ int hibernate(void)
786
786
unlock_device_hotplug ();
787
787
if (snapshot_test ) {
788
788
pm_pr_dbg ("Checking hibernation image\n" );
789
- error = swsusp_check (snapshot_test );
789
+ error = swsusp_check (false );
790
790
if (!error )
791
- error = load_image_and_restore (snapshot_test );
791
+ error = load_image_and_restore (false );
792
792
}
793
793
thaw_processes ();
794
794
@@ -945,14 +945,14 @@ static int software_resume(void)
945
945
pm_pr_dbg ("Looking for hibernation image.\n" );
946
946
947
947
mutex_lock (& system_transition_mutex );
948
- error = swsusp_check (false );
948
+ error = swsusp_check (true );
949
949
if (error )
950
950
goto Unlock ;
951
951
952
952
/* The snapshot device should not be opened while we're running */
953
953
if (!hibernate_acquire ()) {
954
954
error = - EBUSY ;
955
- swsusp_close (false );
955
+ swsusp_close (true );
956
956
goto Unlock ;
957
957
}
958
958
@@ -973,7 +973,7 @@ static int software_resume(void)
973
973
goto Close_Finish ;
974
974
}
975
975
976
- error = load_image_and_restore (false );
976
+ error = load_image_and_restore (true );
977
977
thaw_processes ();
978
978
Finish :
979
979
pm_notifier_call_chain (PM_POST_RESTORE );
@@ -987,7 +987,7 @@ static int software_resume(void)
987
987
pm_pr_dbg ("Hibernation image not present or could not be loaded.\n" );
988
988
return error ;
989
989
Close_Finish :
990
- swsusp_close (false );
990
+ swsusp_close (true );
991
991
goto Finish ;
992
992
}
993
993
Original file line number Diff line number Diff line change @@ -168,11 +168,11 @@ extern int swsusp_swap_in_use(void);
168
168
#define SF_HW_SIG 8
169
169
170
170
/* kernel/power/hibernate.c */
171
- int swsusp_check (bool snapshot_test );
171
+ int swsusp_check (bool exclusive );
172
172
extern void swsusp_free (void );
173
173
extern int swsusp_read (unsigned int * flags_p );
174
174
extern int swsusp_write (unsigned int flags );
175
- void swsusp_close (bool snapshot_test );
175
+ void swsusp_close (bool exclusive );
176
176
#ifdef CONFIG_SUSPEND
177
177
extern int swsusp_unmark (void );
178
178
#endif
Original file line number Diff line number Diff line change @@ -1513,12 +1513,13 @@ int swsusp_read(unsigned int *flags_p)
1513
1513
static void * swsusp_holder ;
1514
1514
1515
1515
/**
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.
1517
1518
*/
1518
1519
1519
- int swsusp_check (bool snapshot_test )
1520
+ int swsusp_check (bool exclusive )
1520
1521
{
1521
- void * holder = snapshot_test ? & swsusp_holder : NULL ;
1522
+ void * holder = exclusive ? & swsusp_holder : NULL ;
1522
1523
int error ;
1523
1524
1524
1525
hib_resume_bdev = blkdev_get_by_dev (swsusp_resume_device , BLK_OPEN_READ ,
@@ -1563,17 +1564,18 @@ int swsusp_check(bool snapshot_test)
1563
1564
}
1564
1565
1565
1566
/**
1566
- * swsusp_close - close swap device.
1567
+ * swsusp_close - close swap device.
1568
+ * @exclusive: Close the resume device which is exclusively opened.
1567
1569
*/
1568
1570
1569
- void swsusp_close (bool snapshot_test )
1571
+ void swsusp_close (bool exclusive )
1570
1572
{
1571
1573
if (IS_ERR (hib_resume_bdev )) {
1572
1574
pr_debug ("Image device not initialised\n" );
1573
1575
return ;
1574
1576
}
1575
1577
1576
- blkdev_put (hib_resume_bdev , snapshot_test ? & swsusp_holder : NULL );
1578
+ blkdev_put (hib_resume_bdev , exclusive ? & swsusp_holder : NULL );
1577
1579
}
1578
1580
1579
1581
/**
You can’t perform that action at this time.
0 commit comments