Re: reboot vs poweroff

Eric W. Biederman
2005-09-02T04:28:59Z

Pavel Machek <pavel@ucw.cz> writes:

> Hi!
>>
>> Thanks.
>>
>> This is clearly a code path I missed when I was fixing things.
>>
>> When I made the final acpi change I checked for any other users
>> of device_suspend and it seems I was blind and missed this one.
>> Looking again...
>>
>> The patch in the bug report looks correct. However it is still
>> a little incomplete. In particular the reboot notifier is not
>> being called, and since not everything has been converted into
>> using shutdown methods that could lead to some other inconsistent
>> behavior.
>>
>> Does anyone have any problems with the patch below?
>> If not I will send this off to Linus..
>
> Yes. kernel_suspend is *way* too generic name. kernel_suspend_off?
> kernel_powe_off_suspend?

Darn. You have a point there.

>> @@ -420,6 +421,15 @@ void kernel_power_off(void)
>> }
>> EXPORT_SYMBOL_GPL(kernel_power_off);
>>
>> +int kernel_suspend(void)
>> +{
>> + notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL);
>> + system_state = SYSTEM_POWER_OFF;
>> + device_shutdown();
>> + return pm_ops->enter(PM_SUSPEND_DISK);
>> +}
>> +EXPORT_SYMBOL_GPL(kernel_suspend);
>> +
>
> Are you sure pm_ops exists in !CONFIG_PM case?

Hmm. Good point. I hadn't considered that. I am now certain
it only exists when CONFIG_PM is set.

Thinking about it more I probably want to simply have a
kernel_power_off_shutdown(); common factor and call
that instead of device_shutdown().

Ok some sleep and then I will see if I can better version of this
cleanup.

Eric