From: Len Brown <lenb@kernel.org>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>
Subject: Re: [PATCH] ACPI: Fix acpi_pm_device_sleep_state()
Date: Fri, 11 Jan 2008 23:46:04 -0500 [thread overview]
Message-ID: <200801112346.04744.lenb@kernel.org> (raw)
In-Reply-To: <200801110010.38658.rjw@sisk.pl>
On Thursday 10 January 2008 18:10, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
>
> Fix acpi_pm_device_sleep_state() to return the value returned
> by _SxD if the device is supposed to wake up the system from
> given sleep state and the evaluation of _SxW fails (e.g. _SxW
> is not present).
>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---
> drivers/acpi/sleep/main.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> Index: linux-2.6/drivers/acpi/sleep/main.c
> ===================================================================
> --- linux-2.6.orig/drivers/acpi/sleep/main.c
> +++ linux-2.6/drivers/acpi/sleep/main.c
> @@ -472,11 +472,20 @@ int acpi_pm_device_sleep_state(struct de
> if (acpi_target_sleep_state == ACPI_STATE_S0 ||
> (wake && adev->wakeup.state.enabled &&
> adev->wakeup.sleep_state <= acpi_target_sleep_state)) {
> + acpi_status status;
> +
> acpi_method[3] = 'W';
> - acpi_evaluate_integer(handle, acpi_method, NULL, &d_max);
> - /* Sanity check */
> - if (d_max < d_min)
> + status = acpi_evaluate_integer(handle, acpi_method, NULL,
> + &d_max);
> + if (ACPI_FAILURE(status)) {
> + d_max = d_min;
> + } else if (d_max < d_min) {
> + /* Warn the user of the broken DSDT */
> + printk(KERN_WARNING "ACPI: Wrong value from %s\n",
> + acpi_method);
> + /* Sanitize it */
> d_min = d_max;
> + }
> }
>
> if (d_min_p)
>
this patch looks correct, it fixes the bug where
_SxD=2, _PRW=x, _SxW was absent, we would return D3 as legal,
when we should have returned D2.
applied to acpi test.
BTW. We currently don't use *d_min_p
and I can't imagine when and why we ever would,
so it would be fine with me if you simplify by deleting it.
Also, the last line of this block comment can be deleted,
though that was true before this patch also:
acpi_pci_choose_state() block comment can now be updated to delete this line:
* currently we simply return _SxD, if present.
thanks,
-Len
next prev parent reply other threads:[~2008-01-12 4:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-10 23:10 [PATCH] ACPI: Fix acpi_pm_device_sleep_state() Rafael J. Wysocki
2008-01-12 4:46 ` Len Brown [this message]
2008-01-12 11:36 ` Rafael J. Wysocki
2008-01-12 23:24 ` Len Brown
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=200801112346.04744.lenb@kernel.org \
--to=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=rjw@sisk.pl \
/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.