linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Oleksij Rempel (fishor)" <bug-track@fisher-privat.net>,
	ACPI Devel Mailing List <linux-acpi@vger.kernel.org>,
	Linux PM list <linux-pm@vger.kernel.org>
Subject: Re: [PATCH] ACPI / PCI: Make _SxD/_SxW check follow ACPI 4.0a spec
Date: Fri, 25 May 2012 22:00:24 +0200	[thread overview]
Message-ID: <201205252200.24331.rjw@sisk.pl> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1205251511170.1907-100000@iolanthe.rowland.org>

On Friday, May 25, 2012, Alan Stern wrote:
> Oleksij:
> 
> Please take a look at this bug report:
> 
> 	https://bugzilla.kernel.org/show_bug.cgi?id=43278
> 
> Apparently your patch breaks wakeup on this machine by preventing the 
> USB host controllers from being put into D3.

I think the patch is incorrect, actually.

First, if you look at the first hunk:

-       if (acpi_target_sleep_state > ACPI_STATE_S0)
+       if (acpi_target_sleep_state > ACPI_STATE_S0) {
+               acpi_status status;
+
                acpi_evaluate_integer(handle, acpi_method, NULL, &d_min);
 
+               if (device_may_wakeup(dev)) {
+                       acpi_method[3] = 'W';
+                       status = acpi_evaluate_integer(handle, acpi_method,
+                                                      NULL, &d_max);
+                       if (ACPI_FAILURE(status))
+                               d_max = d_min;
+               }
+       }

it will do something like this: if the device is wakeup-capable, get d_max
from _SxW, unless it fails.  However, the code just below in that function:

	if (acpi_target_sleep_state == ACPI_STATE_S0 ||
	    (device_may_wakeup(dev) &&
	     adev->wakeup.sleep_state <= acpi_target_sleep_state)) {
		acpi_status status;

		acpi_method[3] = 'W';
		status = acpi_evaluate_integer(handle, acpi_method, NULL,
						&d_max);
		if (ACPI_FAILURE(status)) {
			if (acpi_target_sleep_state != ACPI_STATE_S0 ||
			    status != AE_NOT_FOUND)
				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;
		}
	}

does _exactly_ the same thing (it only has a more sophisticated error code path).

It might check adev->wakeup.flags.valid instead of device_may_wakeup(dev),
but that's a different story.

So the only difference made by the patch is te hunk in pci_target_state().

Thanks,
Rafael

  reply	other threads:[~2012-05-25 20:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-29 20:44 [PATCH] ACPI / PCI: Make _SxD/_SxW check follow ACPI 4.0a spec Rafael J. Wysocki
2012-04-30 16:03 ` Bjorn Helgaas
2012-04-30 17:53   ` Alan Stern
2012-04-30 21:30     ` Oleksij Rempel
2012-04-30 21:43       ` Rafael J. Wysocki
2012-05-01  6:38         ` Oleksij Rempel (fishor)
2012-05-01 14:04           ` Rafael J. Wysocki
2012-05-01 14:11             ` Alan Stern
2012-05-01 16:27               ` Oleksij Rempel (fishor)
2012-05-01 16:59                 ` Alan Stern
2012-05-02  4:10                   ` Oleksij Rempel (fishor)
2012-05-25 19:15                     ` Alan Stern
2012-05-25 20:00                       ` Rafael J. Wysocki [this message]
2012-05-26  6:03                         ` Oleksij Rempel (fishor)
2012-05-26  8:15                           ` Oleksij Rempel
2012-05-26 20:21                             ` Rafael J. Wysocki
2012-04-30 21:32     ` Rafael J. Wysocki
2012-04-30 21:41   ` Rafael J. Wysocki
2012-04-30 21:38     ` Bjorn Helgaas
2012-05-10 20:14     ` Rafael J. Wysocki
2012-07-11  0:08 ` Greg KH
2012-07-11  9:07   ` Rafael J. Wysocki
2012-07-11 13:53     ` Greg KH
2012-07-11 19:04       ` Rafael J. Wysocki
2012-07-11 19:20         ` Greg KH
2012-07-11 19:29           ` Rafael J. Wysocki
2012-07-12  4:30         ` Ben Hutchings

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=201205252200.24331.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=bug-track@fisher-privat.net \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).