All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: linux-pm@lists.linux-foundation.org
Cc: Gary Hade <garyhade@us.ibm.com>,
	Linux PCI <linux-pci@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	"Moore, Robert" <robert.moore@intel.com>,
	Matthew Garrett <mjg@redhat.com>
Subject: Re: [linux-pm] [PATCH 8/9] PCI / ACPI / PM: Platform support for PCI PME wake-up (rev. 7)
Date: Mon, 8 Feb 2010 22:30:30 +0100	[thread overview]
Message-ID: <201002082230.30497.rjw@sisk.pl> (raw)
In-Reply-To: <201002082017.14631.rjw@sisk.pl>

On Monday 08 February 2010, Rafael J. Wysocki wrote:
> On Monday 08 February 2010, Gary Hade wrote:
> > On Sat, Feb 06, 2010 at 09:11:56PM +0100, Rafael J. Wysocki wrote:
> > > On Saturday 06 February 2010, Bjorn Helgaas wrote:
> > > > On Sunday 10 January 2010 07:01:03 am Rafael J. Wysocki wrote:
> > > > > From: Rafael J. Wysocki <rjw@sisk.pl>
> > > > > 
> > > > > Although the majority of PCI devices can generate PMEs that in
> > > > > principle may be used to wake up devices suspended at run time,
> > > > > platform support is generally necessary to convert PMEs into wake-up
> > > > > events that can be delivered to the kernel.  If ACPI is used for this
> > > > > purpose, a PME generated by a PCI device will trigger the ACPI GPE
> > > > > associated with the device to generate an ACPI wake-up event that we
> > > > > can set up a handler for, provided that everything is configured
> > > > > correctly.
> > > > 
> > > > I think acpiphp needs a little attention after this patch.  Gary
> > > > Hade noticed while testing Jesse's linux-next branch that acpiphp
> > > > complains like this:
> > > > 
> > > >   acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
> > > >   acpiphp: Slot [9] registered
> > > >   acpiphp: Slot [10] registered
> > > >   acpiphp_glue: failed to register interrupt notify handler
> > > >   acpiphp: Slot [6] registered
> > > >   acpiphp_glue: failed to register interrupt notify handler
> > > > 
> > > > I reproduced this on an HP rx3600 (ia64), and found that acpiphp
> > > > doesn't complain on commit 82533a617f453, but it *does* complain
> > > > on commit fb3383bb4ac6e, which seems to be this patch.
> > > 
> > > I can't see the possible reason looking at the code alone.
> > > 
> > > Could you add a debug printk() printing the error code returned by
> > > pci_acpi_add_hp_notifier() in acpiphp_glue.c:register_slot(), please?
> > 
> > Rafael, On the system where I ran into the problem it returns
> > AE_NOT_FOUND.  See below.
> 
> Thanks!
> 
> Well, that means there's no struct acpi_device object associated with handle.
> 
> I must admit I didn't take that into consideration, but it should be easily
> fixable.  I'll send a patch for that later today.

Patch appended.

If the theory is correct, it should fix the issue.  Please test.

Rafael


---
 drivers/pci/pci-acpi.c |   30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

Index: linux-2.6/drivers/pci/pci-acpi.c
===================================================================
--- linux-2.6.orig/drivers/pci/pci-acpi.c
+++ linux-2.6/drivers/pci/pci-acpi.c
@@ -116,10 +116,19 @@ acpi_status pci_acpi_add_hp_notifier(acp
 {
 	struct pci_acpi_notify_data *nd;
 	struct acpi_device *dev;
-	acpi_status status = AE_OK;
+	acpi_status status;
+
+	if (!handle)
+		return AE_BAD_PARAMETER;
 
-	if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &dev)))
-		return AE_NOT_FOUND;
+	status = acpi_bus_get_device(handle, &dev);
+	/*
+	 * If there's no struct acpi_device for given handle, try to install the
+	 * handler directly.
+	 */
+	if (ACPI_FAILURE(status))
+		return acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
+							handler, context);
 
 	mutex_lock(&pci_acpi_notifier_mtx);
 
@@ -170,10 +179,19 @@ acpi_status pci_acpi_remove_hp_notifier(
 {
 	struct pci_acpi_notify_data *nd;
 	struct acpi_device *dev;
-	acpi_status status = AE_NOT_FOUND;
+	acpi_status status;
+
+	if (!handle)
+		return AE_BAD_PARAMETER;
 
-	if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &dev)))
-		return AE_NOT_FOUND;
+	status = acpi_bus_get_device(handle, &dev);
+	/*
+	 * If there's no struct acpi_device for given handle, try to remove the
+	 * handler directly.
+	 */
+	if (ACPI_FAILURE(status))
+		return acpi_remove_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
+							handler);
 
 	mutex_lock(&pci_acpi_notifier_mtx);
 

  parent reply	other threads:[~2010-02-08 21:29 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-10 13:31 [PATCH 0/9] PCI run-time PM support (rev. 3) Rafael J. Wysocki
2010-01-10 13:31 ` Rafael J. Wysocki
2010-01-10 13:35 ` [PATCH 1/9] PCI PM: Add function for checking PME status of devices Rafael J. Wysocki
2010-01-10 13:35 ` Rafael J. Wysocki
2010-01-15 17:55   ` Jesse Barnes
2010-01-15 17:55   ` Jesse Barnes
2010-01-10 13:36 ` [PATCH 2/9] PCI PM: PCIe PME root port service driver (rev. 5) Rafael J. Wysocki
2010-01-10 13:36 ` Rafael J. Wysocki
2010-01-10 13:37 ` [PATCH 3/9] PCI PM: Make it possible to force using INTx for PCIe PME signaling Rafael J. Wysocki
2010-01-10 13:37 ` Rafael J. Wysocki
2010-01-10 13:38 ` [PATCH 4/9] ACPI: Add infrastructure for refcounting GPE consumers Rafael J. Wysocki
2010-01-10 13:38 ` Rafael J. Wysocki
2010-01-10 13:39 ` [PATCH 5/9] ACPI: Add support for new refcounted GPE API to drivers Rafael J. Wysocki
2010-01-10 13:39 ` Rafael J. Wysocki
2010-01-10 13:40 ` [PATCH 6/9] ACPI: Remove old GPE API and transition code entirely to new one Rafael J. Wysocki
2010-01-10 13:40 ` Rafael J. Wysocki
2010-01-10 13:48 ` [PATCH 7/9] ACPI / PM: Add more run-time wake-up fields (rev. 2) Rafael J. Wysocki
2010-01-10 13:48 ` Rafael J. Wysocki
2010-01-10 14:01 ` [PATCH 8/9] PCI / ACPI / PM: Platform support for PCI PME wake-up (rev. 7) Rafael J. Wysocki
2010-02-05 23:57   ` Bjorn Helgaas
2010-02-05 23:57   ` Bjorn Helgaas
2010-02-06  0:20     ` Rafael J. Wysocki
2010-02-06  0:20     ` Rafael J. Wysocki
2010-02-06 20:11     ` Rafael J. Wysocki
2010-02-06 20:11     ` Rafael J. Wysocki
2010-02-08 17:53       ` Gary Hade
2010-02-08 17:53       ` Gary Hade
2010-02-08 19:17         ` Rafael J. Wysocki
2010-02-08 19:17         ` Rafael J. Wysocki
2010-02-08 21:12           ` Gary Hade
2010-02-08 21:12           ` Gary Hade
2010-02-08 21:30           ` Rafael J. Wysocki [this message]
2010-02-08 23:37             ` Gary Hade
2010-02-08 23:37             ` [linux-pm] " Gary Hade
2010-02-09  0:53               ` Gary Hade
2010-02-09  0:53               ` [linux-pm] " Gary Hade
2010-02-09 12:48                 ` Rafael J. Wysocki
2010-02-09 12:48                 ` [linux-pm] " Rafael J. Wysocki
2010-02-09 13:34                   ` Rafael J. Wysocki
2010-02-09 13:34                   ` Rafael J. Wysocki
2010-02-09 16:41                   ` Gary Hade
2010-02-09 16:41                   ` [linux-pm] " Gary Hade
2010-02-09 17:35                     ` Gary Hade
2010-02-09 20:19                       ` Rafael J. Wysocki
2010-02-09 20:58                         ` Gary Hade
2010-02-09 20:58                         ` [linux-pm] " Gary Hade
2010-02-09 23:31                           ` Gary Hade
2010-02-10  1:07                             ` Rafael J. Wysocki
2010-02-10  1:12                               ` Rafael J. Wysocki
2010-02-10  1:12                               ` Rafael J. Wysocki
2010-02-10 17:48                                 ` Gary Hade
2010-02-10 17:48                                 ` Gary Hade
2010-02-10 18:00                                   ` Rafael J. Wysocki
2010-02-10 20:38                                     ` Gary Hade
2010-02-10 20:38                                     ` Gary Hade
2010-02-10 21:42                                       ` Rafael J. Wysocki
2010-02-10 21:42                                       ` Rafael J. Wysocki
2010-02-10 22:13                                         ` Gary Hade
2010-02-10 22:13                                         ` Gary Hade
2010-02-10 22:58                                           ` Rafael J. Wysocki
2010-02-10 23:04                                             ` Gary Hade
2010-02-10 23:04                                             ` Gary Hade
2010-02-10 23:25                                               ` Rafael J. Wysocki
2010-02-10 23:25                                               ` Rafael J. Wysocki
2010-02-11  0:56                                                 ` Rafael J. Wysocki
2010-02-11  0:56                                                 ` Rafael J. Wysocki
2010-02-11  2:07                                                   ` Gary Hade
2010-02-11 13:27                                                     ` Rafael J. Wysocki
2010-02-11 18:29                                                       ` Gary Hade
2010-02-11 18:29                                                       ` Gary Hade
2010-02-11 18:33                                                         ` Bjorn Helgaas
2010-02-11 18:33                                                         ` Bjorn Helgaas
2010-02-11 20:32                                                         ` Rafael J. Wysocki
2010-02-11 20:32                                                         ` Rafael J. Wysocki
2010-02-11 20:40                                                           ` Rafael J. Wysocki
2010-02-11 20:40                                                           ` Rafael J. Wysocki
2010-02-11 21:56                                                           ` Gary Hade
2010-02-11 22:21                                                             ` Rafael J. Wysocki
2010-02-12  1:55                                                               ` Gary Hade
2010-02-12  1:55                                                               ` Gary Hade
2010-02-12 11:19                                                                 ` Rafael J. Wysocki
2010-02-13  0:20                                                                   ` Rafael J. Wysocki
2010-02-13  1:27                                                                     ` Gary Hade
2010-02-14 13:51                                                                       ` Rafael J. Wysocki
2010-02-15 19:22                                                                         ` Gary Hade
2010-02-15 19:22                                                                         ` Gary Hade
2010-02-15 21:42                                                                           ` Rafael J. Wysocki
2010-02-15 21:42                                                                           ` Rafael J. Wysocki
2010-02-14 13:51                                                                       ` Rafael J. Wysocki
2010-02-13  1:27                                                                     ` Gary Hade
2010-02-13  0:20                                                                   ` Rafael J. Wysocki
2010-02-12 11:19                                                                 ` Rafael J. Wysocki
2010-02-11 22:21                                                             ` Rafael J. Wysocki
2010-02-11 21:56                                                           ` Gary Hade
2010-02-11 13:27                                                     ` Rafael J. Wysocki
2010-02-11  2:07                                                   ` Gary Hade
2010-02-10 22:58                                           ` Rafael J. Wysocki
2010-02-10 18:00                                   ` Rafael J. Wysocki
2010-02-10  1:07                             ` Rafael J. Wysocki
2010-02-09 23:31                           ` Gary Hade
2010-02-09 20:19                       ` Rafael J. Wysocki
2010-02-09 17:35                     ` Gary Hade
2010-02-08 21:30           ` Rafael J. Wysocki
2010-01-10 14:01 ` Rafael J. Wysocki
2010-01-10 14:02 ` [PATCH 9/9] PCI PM: Run-time callbacks for PCI bus type (rev. 2) Rafael J. Wysocki
2010-01-10 14:02 ` Rafael J. Wysocki

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=201002082230.30497.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=garyhade@us.ibm.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=mjg@redhat.com \
    --cc=robert.moore@intel.com \
    /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.