During hibernation, after the memory snapshot has been created, the
kernel briefly resumes devices with PMSG_THAW to write the snapshot to
storage before powering off. USB driver resume callbacks do not receive
the hibernation PM message, so uvcvideo cannot distinguish this transient
image-write phase from the final restore path.
This series adds pm_hibernation_snapshot_done() and uses it in uvcvideo
to avoid reinitializing the camera during the image-write phase.
This is not intended to make every leaf driver special-case hibernation
THAW. A generic USB-core skip would not be safe because some USB
interfaces may be part of the storage path, or otherwise be required by
dependencies during image writeout. The helper is an opt-in mechanism
for drivers with a concrete reason to avoid reinitializing hardware in
this transient phase. In this case, uvcvideo has a user-visible side
effect, the camera indicator LED, while the camera is not part of the
image writeout path.
Changes in v2:
- Rename pm_hibernation_storing_image() to
pm_hibernation_snapshot_done().
- Clear in_suspend before releasing snapshot memory on the hibernation
failure paths and after swsusp_write() returns.
- Update the uvcvideo call site for the new helper name.
Haowen Tu (2):
PM: hibernate: add pm_hibernation_snapshot_done() helper
media: uvcvideo: skip resume after hibernation snapshot
drivers/media/usb/uvc/uvc_video.c | 12 ++++++++++++
include/linux/suspend.h | 2 ++
kernel/power/hibernate.c | 31 +++++++++++++++++++++++++++----
3 files changed, 41 insertions(+), 4 deletions(-)
--
2.20.1