From: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
To: Tobias Ringstrom
<tori-cF8t/dA0MSs0DrVG+m1MRYdd74u8MsAO@public.gmane.org>
Cc: "Grover,
Andrew" <andrew.grover-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH] ACPI power-down in Linux 2.5.59
Date: Tue, 21 Jan 2003 18:42:08 +0100 [thread overview]
Message-ID: <20030121174207.GA4049@elf.ucw.cz> (raw)
In-Reply-To: <Pine.LNX.4.44.0301202353530.21175-200000-CWfOIYxxj7kInT2dYjKYhA@public.gmane.org>
Hi!
> I noticed that Linux 2.5.59 did not power-down when using ACPI. The reason
> is that you need CONFIG_ACPI_SLEEP which needs CONFIG_SOFTWARE_SUSPEND.
> Both are described as a bit dangerous in the config help.
>
> As an experiment, I moved the power-down code from sleep.c to bus.c (which
> seemed like a top-level file) and it seems to work well. I've attached
> the patch to this email. Perhaps something like this can be considered
> for future updates? What do you think?
Yes, this seems like good idea.
Pavel
> /Tobias
> diff -ru linux-2.5.59.orig/drivers/acpi/bus.c linux-2.5.59/drivers/acpi/bus.c
> --- linux-2.5.59.orig/drivers/acpi/bus.c 2003-01-11 11:50:23.000000000 +0100
> +++ linux-2.5.59/drivers/acpi/bus.c 2003-01-19 17:42:01.000000000 +0100
> @@ -29,6 +29,7 @@
> #include <linux/pm.h>
> #include <linux/device.h>
> #include <linux/proc_fs.h>
> +#include <linux/sysrq.h>
> #ifdef CONFIG_X86
> #include <asm/mpspec.h>
> #endif
> @@ -676,11 +677,38 @@
> return_VALUE(-ENODEV);
> }
>
> +static void
> +acpi_power_off (void)
> +{
> + acpi_enter_sleep_state_prep(ACPI_STATE_S5);
> + ACPI_DISABLE_IRQS();
> + acpi_enter_sleep_state(ACPI_STATE_S5);
> +}
> +
> +#if defined(CONFIG_MAGIC_SYSRQ) && defined(CONFIG_PM)
> +
> +/* Simple wrapper calling power down function. */
> +static void acpi_sysrq_power_off(int key, struct pt_regs *pt_regs,
> + struct tty_struct *tty)
> +{
> + acpi_power_off();
> +}
> +
> +struct sysrq_key_op sysrq_acpi_poweroff_op = {
> + .handler = &acpi_sysrq_power_off,
> + .help_msg = "Off",
> + .action_msg = "Power Off\n"
> +};
> +
> +#endif /* CONFIG_MAGIC_SYSRQ */
> +
> decl_subsys(acpi,NULL);
>
> static int __init acpi_init (void)
> {
> int result = 0;
> + acpi_status status;
> + u8 type_a, type_b;
>
> ACPI_FUNCTION_TRACE("acpi_init");
>
> @@ -712,6 +740,13 @@
> } else
> acpi_disabled = 1;
>
> + /* Install the soft-off (S5) handler. */
> + status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
> + if (ACPI_SUCCESS(status)) {
> + pm_power_off = acpi_power_off;
> + register_sysrq_key('o', &sysrq_acpi_poweroff_op);
> + }
> +
> return_VALUE(result);
> }
>
> diff -ru linux-2.5.59.orig/drivers/acpi/sleep.c linux-2.5.59/drivers/acpi/sleep.c
> --- linux-2.5.59.orig/drivers/acpi/sleep.c 2003-01-06 23:26:51.000000000 +0100
> +++ linux-2.5.59/drivers/acpi/sleep.c 2003-01-19 17:41:14.000000000 +0100
> @@ -9,7 +9,6 @@
> */
>
> #include <linux/proc_fs.h>
> -#include <linux/sysrq.h>
> #include <linux/delay.h>
> #include <linux/irq.h>
> #include <linux/pm.h>
> @@ -53,14 +52,6 @@
> .release = single_release,
> };
>
> -static void
> -acpi_power_off (void)
> -{
> - acpi_enter_sleep_state_prep(ACPI_STATE_S5);
> - ACPI_DISABLE_IRQS();
> - acpi_enter_sleep_state(ACPI_STATE_S5);
> -}
> -
> /**
> * acpi_system_restore_state - OS-specific restoration of state
> * @state: sleep state we're exiting
> @@ -625,24 +616,6 @@
> return_VALUE(result ? result : count);
> }
>
> -
> -#if defined(CONFIG_MAGIC_SYSRQ) && defined(CONFIG_PM)
> -
> -/* Simple wrapper calling power down function. */
> -static void acpi_sysrq_power_off(int key, struct pt_regs *pt_regs,
> - struct tty_struct *tty)
> -{
> - acpi_power_off();
> -}
> -
> -struct sysrq_key_op sysrq_acpi_poweroff_op = {
> - .handler = &acpi_sysrq_power_off,
> - .help_msg = "Off",
> - .action_msg = "Power Off\n"
> -};
> -
> -#endif /* CONFIG_MAGIC_SYSRQ */
> -
> static int __init acpi_sleep_init(void)
> {
> struct proc_dir_entry *entry = NULL;
> @@ -690,11 +663,7 @@
> entry->proc_fops->write = acpi_system_write_alarm;
> }
>
> - /* Install the soft-off (S5) handler. */
> if (sleep_states[ACPI_STATE_S5]) {
> - pm_power_off = acpi_power_off;
> - register_sysrq_key('o', &sysrq_acpi_poweroff_op);
> -
> /* workaround: some systems don't claim S4 support, but they
> do support S5 (power-down). That is all we need, so
> indicate support. */
--
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?
-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
prev parent reply other threads:[~2003-01-21 17:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-20 23:02 [PATCH] ACPI power-down in Linux 2.5.59 Tobias Ringstrom
[not found] ` <Pine.LNX.4.44.0301202353530.21175-200000-CWfOIYxxj7kInT2dYjKYhA@public.gmane.org>
2003-01-21 17:42 ` Pavel Machek [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030121174207.GA4049@elf.ucw.cz \
--to=pavel-+zi9xunit7i@public.gmane.org \
--cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=andrew.grover-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=tori-cF8t/dA0MSs0DrVG+m1MRYdd74u8MsAO@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.