diff options
| author | Russell King <rmk@flint.arm.linux.org.uk> | 2003-05-13 16:50:07 +0100 |
|---|---|---|
| committer | Russell King <rmk@flint.arm.linux.org.uk> | 2003-05-13 16:50:07 +0100 |
| commit | 02562d06d65c224ac7a4e060ded0e839532050ce (patch) | |
| tree | 08d8242c8e4887b1f6b2d7c4e8e3e122dd2eeeb3 | |
| parent | cb4169bc1fca8ee86e79ccfcc6a4586586cece42 (diff) | |
[ARM] Allow CONFIG_PM to be enabled on all ARM platforms
| -rw-r--r-- | arch/arm/kernel/pm.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/arch/arm/kernel/pm.c b/arch/arm/kernel/pm.c index be9a07e62795..03fcb771b579 100644 --- a/arch/arm/kernel/pm.c +++ b/arch/arm/kernel/pm.c @@ -16,10 +16,18 @@ #include <asm/leds.h> #include <asm/system.h> +/* + * Tell the linker that pm_do_suspend may not be present. + */ +extern int pm_do_suspend(void) __attribute__((weak)); + int suspend(void) { int ret; + if (!pm_do_suspend) + return -ENOSYS; + /* * Suspend "legacy" devices. */ @@ -82,9 +90,26 @@ int suspend(void) } #ifdef CONFIG_SYSCTL +/* + * We really want this to die. It's a disgusting hack using unallocated + * sysctl numbers. We should be using a real interface. + */ + #include <linux/init.h> #include <linux/sysctl.h> +static int +pm_sysctl_proc_handler(ctl_table *ctl, int write, struct file *filp, + void *buffer, size_t *lenp) +{ + int ret = -EIO; + printk("PM: task %s (pid %d) uses deprecated sysctl PM interface\n", + current->comm, current->pid); + if (write) + ret = suspend(); + return ret; +} + /* * This came from arch/arm/mach-sa1100/pm.c: * Copyright (c) 2001 Cliff Brake <cbrake@accelent.com> @@ -102,13 +127,23 @@ int suspend(void) static struct ctl_table pm_table[] = { - {ACPI_S1_SLP_TYP, "suspend", NULL, 0, 0600, NULL, (proc_handler *)&suspend}, + { + .ctl_name = ACPI_S1_SLP_TYP, + .procname = "suspend", + .mode = 0200, + .proc_handler = pm_sysctl_proc_handler, + }, {0} }; static struct ctl_table pm_dir_table[] = { - {CTL_ACPI, "pm", NULL, 0, 0555, pm_table}, + { + .ctl_name = CTL_ACPI, + .procname = "pm", + .mode = 0555, + .child = pm_table, + }, {0} }; |
