Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 61553
b: refs/heads/master
c: bd804eb
h: refs/heads/master
i:
  61551: 94823ed
v: v3
  • Loading branch information
Rafael J. Wysocki authored and Linus Torvalds committed Jul 19, 2007
1 parent 324150c commit 1297d95
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d7372cdf6938ccea23ec9fc68970702fed9ec3c8
refs/heads/master: bd804eba1c8597cbb7cd5a5f9fe886aae16a079a
38 changes: 9 additions & 29 deletions trunk/drivers/acpi/sleep/poweroff.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ int acpi_sleep_prepare(u32 acpi_state)

#ifdef CONFIG_PM

void acpi_power_off(void)
static void acpi_power_off_prepare(void)
{
/* Prepare to power off the system */
acpi_sleep_prepare(ACPI_STATE_S5);
}

static void acpi_power_off(void)
{
/* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
printk("%s called\n", __FUNCTION__);
Expand All @@ -48,27 +54,6 @@ void acpi_power_off(void)
acpi_enter_sleep_state(ACPI_STATE_S5);
}

static int acpi_shutdown(struct sys_device *x)
{
switch (system_state) {
case SYSTEM_POWER_OFF:
/* Prepare to power off the system */
return acpi_sleep_prepare(ACPI_STATE_S5);
default:
return 0;
}
}

static struct sysdev_class acpi_sysclass = {
set_kset_name("acpi"),
.shutdown = acpi_shutdown
};

static struct sys_device device_acpi = {
.id = 0,
.cls = &acpi_sysclass,
};

static int acpi_poweroff_init(void)
{
if (!acpi_disabled) {
Expand All @@ -78,13 +63,8 @@ static int acpi_poweroff_init(void)
status =
acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
if (ACPI_SUCCESS(status)) {
int error;
error = sysdev_class_register(&acpi_sysclass);
if (!error)
error = sysdev_register(&device_acpi);
if (!error)
pm_power_off = acpi_power_off;
return error;
pm_power_off_prepare = acpi_power_off_prepare;
pm_power_off = acpi_power_off;
}
}
return 0;
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/pm.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ struct pm_dev
*/
extern void (*pm_idle)(void);
extern void (*pm_power_off)(void);
extern void (*pm_power_off_prepare)(void);

typedef int __bitwise suspend_state_t;

Expand Down
9 changes: 9 additions & 0 deletions trunk/kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ int C_A_D = 1;
struct pid *cad_pid;
EXPORT_SYMBOL(cad_pid);

/*
* If set, this is used for preparing the system to power off.
*/

void (*pm_power_off_prepare)(void);
EXPORT_SYMBOL(pm_power_off_prepare);

/*
* Notifier list for kernel code which wants to be called
* at shutdown. This is used to stop any idling DMA operations
Expand Down Expand Up @@ -867,6 +874,8 @@ EXPORT_SYMBOL_GPL(kernel_halt);
void kernel_power_off(void)
{
kernel_shutdown_prepare(SYSTEM_POWER_OFF);
if (pm_power_off_prepare)
pm_power_off_prepare();
printk(KERN_EMERG "Power down.\n");
machine_power_off();
}
Expand Down

0 comments on commit 1297d95

Please sign in to comment.