On Tuesday, 19 June 2007 13:52, Rafael J. Wysocki wrote: > On Tuesday, 19 June 2007 04:33, Shaohua Li wrote: > > Based on David's patch > > http://marc.info/?l=linux-acpi&m=117873972806360&w=2 > > I slightly changed it. > > > > Add a helper routine, which gets the sleep state of a ACPI device. > > Is it going to work with the recent code ordering changes? I mean, > acpi_pm_prepare() is now called after device_suspend() (and analogously for > the hibernation), so the target ACPI state is not known when the drivers' > .suspend() routines are being called. > > > Index: 2.6.22-rc2/drivers/acpi/sleep/main.c > > =================================================================== > > --- 2.6.22-rc2.orig/drivers/acpi/sleep/main.c 2007-05-23 09:15:14.000000000 +0800 > > +++ 2.6.22-rc2/drivers/acpi/sleep/main.c 2007-06-19 09:19:09.000000000 +0800 > > @@ -34,6 +34,8 @@ static u32 acpi_suspend_states[] = { > > > > static int init_8259A_after_S1; > > > > +static int acpi_target_sleep_state = ACPI_STATE_S0; > > + > > /** > > * acpi_pm_prepare - Do preliminary suspend work. > > * @pm_state: suspend state we're entering. > > @@ -54,6 +56,7 @@ static int acpi_pm_prepare(suspend_state > > printk("acpi_pm_prepare does not support %d \n", pm_state); > > return -EPERM; > > } > > + acpi_target_sleep_state = acpi_state; > > return acpi_sleep_prepare(acpi_state); > > } > > > > @@ -140,6 +143,7 @@ static int acpi_pm_finish(suspend_state_ > > printk("Broken toshiba laptop -> kicking interrupts\n"); > > init_8259A(0); > > } > > + acpi_target_sleep_state = ACPI_STATE_S0; > > return 0; > > } > > > > @@ -184,6 +188,7 @@ static struct pm_ops acpi_pm_ops = { > > #ifdef CONFIG_SOFTWARE_SUSPEND > > static int acpi_hibernation_prepare(void) > > { > > + acpi_target_sleep_state = ACPI_STATE_S4; > > return acpi_sleep_prepare(ACPI_STATE_S4); > > } > > > > @@ -215,6 +220,7 @@ static void acpi_hibernation_finish(void > > printk("Broken toshiba laptop -> kicking interrupts\n"); > > init_8259A(0); > > } > > + acpi_target_sleep_state = ACPI_STATE_S0; > > This will clash with the recent Pavel's patch that removes the Toshiba > quirk from the hibernation code path > > http://www.sisk.pl/kernel/hibernation_and_suspend/2.6.22-rc5/patches/35-ACPI-remove-S1-workaround-from-hibernation-code-path.patch The patch has been moved to http://www.sisk.pl/kernel/hibernation_and_suspend/2.6.22-rc5/patches/34-ACPI-remove-S1-workaround-from-hibernation-code-path.patch Sorry for the inconvenience. Greetings, Rafael -- "Premature optimization is the root of all evil." - Donald Knuth - To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html