Is suspend() function working?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In arch/x86/kerne/apm_32.c there is the suspend() function - question
is why immediately after calling save_processor_state() it will call
restore_processor_state()?   And subsequently the other half of the
routine is focusing on restoration?

static int suspend(int vetoable)
{
	int		err;
	struct apm_user	*as;

	if (pm_send_all(PM_SUSPEND, (void *)3)) {
		/* Vetoed */
		if (vetoable) {
			if (apm_info.connection_version > 0x100)
				set_system_power_state(APM_STATE_REJECT);
			err = -EBUSY;
			ignore_sys_suspend = 0;
			printk(KERN_WARNING "apm: suspend was vetoed.\n");
			goto out;
		}
		printk(KERN_CRIT "apm: suspend was vetoed, but suspending anyway.\n");
	}

	device_suspend(PMSG_SUSPEND);
	local_irq_disable();
	device_power_down(PMSG_SUSPEND);

	local_irq_enable();

	save_processor_state();===========> after this
	err = set_system_power_state(APM_STATE_SUSPEND);
	ignore_normal_resume = 1;
	restore_processor_state();============>is this????

	local_irq_disable();
	reinit_timer();

	if (err == APM_NO_ERROR)
		err = APM_SUCCESS;
	if (err != APM_SUCCESS)
		apm_error("suspend", err);
	err = (err == APM_SUCCESS) ? 0 : -EIO;
	device_power_up();
	local_irq_enable();
	device_resume();
	pm_send_all(PM_RESUME, (void *)0);
	queue_event(APM_NORMAL_RESUME, NULL);
 out:
	spin_lock(&user_list_lock);
	for (as = user_list; as != NULL; as = as->next) {
		as->suspend_wait = 0;
		as->suspend_result = err;
	}
	spin_unlock(&user_list_lock);
	wake_up_interruptible(&apm_suspend_waitqueue);
	return err;
}

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux