PM: Fix pm_notifiers during user mode hibernation

Snapshot device is opened with O_RDONLY during suspend and O_WRONLY durig
resume. Make sure we also call notifiers with correct parameter telling
them what we are really doing.

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Len Brown <lenb@kernel.org>
Cc: Greg KH <gregkh@suse.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Andrey Borzenkov and committed by
Linus Torvalds
ebae2604 0cb57258

+6 -6
+6 -6
kernel/power/user.c
··· 95 data->swap = swsusp_resume_device ? 96 swap_type_of(swsusp_resume_device, 0, NULL) : -1; 97 data->mode = O_RDONLY; 98 - error = pm_notifier_call_chain(PM_RESTORE_PREPARE); 99 - if (error) 100 - pm_notifier_call_chain(PM_POST_RESTORE); 101 - } else { 102 - data->swap = -1; 103 - data->mode = O_WRONLY; 104 error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE); 105 if (error) 106 pm_notifier_call_chain(PM_POST_HIBERNATION); 107 } 108 if (error) 109 atomic_inc(&snapshot_device_available);
··· 95 data->swap = swsusp_resume_device ? 96 swap_type_of(swsusp_resume_device, 0, NULL) : -1; 97 data->mode = O_RDONLY; 98 error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE); 99 if (error) 100 pm_notifier_call_chain(PM_POST_HIBERNATION); 101 + } else { 102 + data->swap = -1; 103 + data->mode = O_WRONLY; 104 + error = pm_notifier_call_chain(PM_RESTORE_PREPARE); 105 + if (error) 106 + pm_notifier_call_chain(PM_POST_RESTORE); 107 } 108 if (error) 109 atomic_inc(&snapshot_device_available);