Commit 7803516d authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branch 'pm-sleep'

Merge hibernation-related fixes for 5.16-rc3.

* pm-sleep:
  PM: hibernate: Fix snapshot partial write lengths
  PM: hibernate: use correct mode for swsusp_close()
parents 03c83982 88a5045f
...@@ -693,7 +693,7 @@ static int load_image_and_restore(void) ...@@ -693,7 +693,7 @@ static int load_image_and_restore(void)
goto Unlock; goto Unlock;
error = swsusp_read(&flags); error = swsusp_read(&flags);
swsusp_close(FMODE_READ); swsusp_close(FMODE_READ | FMODE_EXCL);
if (!error) if (!error)
error = hibernation_restore(flags & SF_PLATFORM_MODE); error = hibernation_restore(flags & SF_PLATFORM_MODE);
...@@ -983,7 +983,7 @@ static int software_resume(void) ...@@ -983,7 +983,7 @@ static int software_resume(void)
/* The snapshot device should not be opened while we're running */ /* The snapshot device should not be opened while we're running */
if (!hibernate_acquire()) { if (!hibernate_acquire()) {
error = -EBUSY; error = -EBUSY;
swsusp_close(FMODE_READ); swsusp_close(FMODE_READ | FMODE_EXCL);
goto Unlock; goto Unlock;
} }
...@@ -1018,7 +1018,7 @@ static int software_resume(void) ...@@ -1018,7 +1018,7 @@ static int software_resume(void)
pm_pr_dbg("Hibernation image not present or could not be loaded.\n"); pm_pr_dbg("Hibernation image not present or could not be loaded.\n");
return error; return error;
Close_Finish: Close_Finish:
swsusp_close(FMODE_READ); swsusp_close(FMODE_READ | FMODE_EXCL);
goto Finish; goto Finish;
} }
......
...@@ -177,7 +177,7 @@ static ssize_t snapshot_write(struct file *filp, const char __user *buf, ...@@ -177,7 +177,7 @@ static ssize_t snapshot_write(struct file *filp, const char __user *buf,
if (res <= 0) if (res <= 0)
goto unlock; goto unlock;
} else { } else {
res = PAGE_SIZE - pg_offp; res = PAGE_SIZE;
} }
if (!data_of(data->handle)) { if (!data_of(data->handle)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment