Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\power\hibernate.c Create Date:2022-07-28 09:59:25
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:hibernate - Carry out system hibernation, including saving the image.

Proto:int hibernate(void)

Type:int

Parameter:Nothing

697  nr_calls = 0
698  bool snapshot_test = false
700  If Not hibernation_available() Then
701  pm_pr_dbg("Hibernation not available.\n")
702  Return -EPERM
705  lock_system_sleep()
707  If Not atomic_add_unless - add unless the number is already a given value*@v: pointer of type atomic_t*@a: the amount to add to v...*@u: ...unless v is equal to u.* Atomically adds @a to @v, if @v was not already @u.* Returns true if the addition was done. Then
708  error = -EBUSY
709  Go to Unlock
712  pr_info("hibernation entry\n")
713  pm_prepare_console()
714  error = __pm_notifier_call_chain(Going to hibernate , - 1, & nr_calls)
715  If error Then
716  nr_calls--
717  Go to Exit
720  ksys_sync_helper()
722  error = ze_processes - Signal user space processes to enter the refrigerator.* The current thread will not be frozen. The same process that calls* freeze_processes must later call thaw_processes.* On success, returns 0
723  If error Then Go to Exit
726  lock_device_hotplug()
728  error = create_basic_memory_bitmaps()
729  If error Then Go to Thaw
732  error = hibernation_snapshot - Quiesce devices and create a hibernation image.*@platform_mode: If set, use platform driver to prepare for the transition.* This routine must be called with system_transition_mutex held.
733  If error || freezer_test_done Then Go to Free_bitmaps
736  If in_suspend Then
737  flags = 0
739  If hibernation_mode == HIBERNATION_PLATFORM Then flags |= Flags that can be passed from the hibernatig hernel to the "boot" kernel in* the image header.
741  If nocompress Then flags |= SF_NOCOMPRESS_MODE
743  Else flags |= SF_CRC32_MODE
746  pm_pr_dbg("Writing image.\n")
747  error = swsusp_write(flags)
748  swsusp_free()
749  If Not error Then
755  in_suspend = 0
756  pm_restore_gfp_mask()
757  Else
758  pm_pr_dbg("Image restored successfully.\n")
761  Free_bitmaps :
762  free_basic_memory_bitmaps()
763  Thaw :
764  unlock_device_hotplug()
765  If snapshot_test Then
766  pm_pr_dbg("Checking hibernation image\n")
767  error = kernel/power/hibernate.c
768  If Not error Then error = load_image_and_restore()
771  thaw_processes()
774  freezer_test_done = false
775  Exit :
776  __pm_notifier_call_chain(Hibernation finished , nr_calls, NULL)
777  pm_restore_console()
778  atomic_inc( & If unset, the snapshot device cannot be open. )
779  Unlock :
780  unlock_system_sleep()
781  pr_info("hibernation exit\n")
783  Return error
Caller
NameDescribe
try_to_suspend