Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:software_resume - Resume from a saved hibernation image.* This routine is called as a late initcall, when all devices have been* discovered and initialized already.* The image reading code is called to see if there is a hibernation image

Proto:static int software_resume(void)

Type:int

Parameter:Nothing

804  nr_calls = 0
809  If noresume || Not hibernation_available() Then Return 0
822  mutex_lock_nested( & system_transition_mutex, For trivial one-depth nesting of a lock-class, the following* global define can be used. (Subsystems with multiple levels* of nesting should define their own lock-nesting subclasses.))
824  If swsusp_resume_device Then Go to Check_image
827  If Not strlen - Find the length of a string*@s: The string to be sized Then
828  error = -ENOENT
829  Go to Unlock
832  pm_pr_dbg("Checking hibernation image partition %s\n", resume_file)
834  If resume_delay Then
835  pr_info("Waiting %dsec before reading resume device ...\n", resume_delay)
837  ssleep(resume_delay)
841  swsusp_resume_device = name_to_dev_t(resume_file)
847  If isdigit(resume_file[0]) && resume_wait Then
849  When Not get_gendisk - get partitioning information for a given device*@devt: device to get partitioning information for*@partno: returned partition index* This function gets the structure containing partitioning* information for the given device @devt. cycle
850  msleep(10)
853  If Not swsusp_resume_device Then
858  wait_for_device_probe()
860  If resume_wait Then
862  msleep(10)
866  swsusp_resume_device = name_to_dev_t(resume_file)
867  If Not swsusp_resume_device Then
868  error = -ENODEV
869  Go to Unlock
873  Check_image :
874  pm_pr_dbg("Hibernation image partition %d:%d present\n", MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device))
877  pm_pr_dbg("Looking for hibernation image.\n")
878  error = kernel/power/hibernate.c
879  If error Then Go to Unlock
883  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
884  error = -EBUSY
885  swsusp_close(le is open for reading )
886  Go to Unlock
889  pr_info("resume from hibernation\n")
890  pm_prepare_console()
891  error = __pm_notifier_call_chain(Going to restore a saved image , - 1, & nr_calls)
892  If error Then
893  nr_calls--
894  Go to Close_Finish
897  pm_pr_dbg("Preparing processes for restore.\n")
898  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
899  If error Then Go to Close_Finish
901  error = load_image_and_restore()
902  thaw_processes()
903  Finish :
904  __pm_notifier_call_chain(Restore failed , nr_calls, NULL)
905  pm_restore_console()
906  pr_info("resume from hibernation failed (%d)\n", error)
907  atomic_inc( & If unset, the snapshot device cannot be open. )
909  Unlock :
910  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
911  pm_pr_dbg("Hibernation image not present or could not be loaded.\n")
912  Return error
913  Close_Finish :
914  swsusp_close(le is open for reading )
915  Go to Finish
Caller
NameDescribe
resume_store