Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pm-6.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael Wysocki:
"Fix the handling of block devices in the test_resume mode of
hibernation (Chen Yu)"

* tag 'pm-6.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
PM: hibernate: Fix the exclusive get block device in test_resume mode
PM: hibernate: Rename function parameter from snapshot_test to exclusive

+16 -14
+6 -6
kernel/power/hibernate.c
··· 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 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 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 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
+2 -2
kernel/power/power.h
··· 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
+8 -6
kernel/power/swap.c
··· 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, ··· 1564 1563 } 1565 1564 1566 1565 /** 1567 - * swsusp_close - close swap device. 1566 + * swsusp_close - close swap device. 1567 + * @exclusive: Close the resume device which is exclusively opened. 1568 1568 */ 1569 1569 1570 - void swsusp_close(bool snapshot_test) 1570 + void swsusp_close(bool exclusive) 1571 1571 { 1572 1572 if (IS_ERR(hib_resume_bdev)) { 1573 1573 pr_debug("Image device not initialised\n"); 1574 1574 return; 1575 1575 } 1576 1576 1577 - blkdev_put(hib_resume_bdev, snapshot_test ? &swsusp_holder : NULL); 1577 + blkdev_put(hib_resume_bdev, exclusive ? &swsusp_holder : NULL); 1578 1578 } 1579 1579 1580 1580 /**