From: Jin Dongming <jin.dongming@np.css.fujitsu.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: pm list <linux-pm@lists.linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Linux PCI <linux-pci@vger.kernel.org>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Alan Stern <stern@rowland.harvard.edu>,
Jesse Barnes <jbarnes@virtuousgeek.org>,
Matthew Garrett <mjg59@srcf.ucam.org>,
Oliver Neukum <oliver@neukum.org>,
Shaohua Li <shaohua.li@intel.com>,
Bjorn Helgaas <bjorn.helgaas@hp.com>
Subject: Re: [RFC][PATCH 9/10] PCI / ACPI PM: Platform support for PCI PME wake-up (rev. 3)
Date: Mon, 16 Nov 2009 13:36:50 +0900 [thread overview]
Message-ID: <4B00D6E2.9010404@np.css.fujitsu.com> (raw)
In-Reply-To: <200911160057.42421.rjw@sisk.pl>
Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> +/**
> + * pci_acpi_add_pm_notifier - Register PM notifier for given device.
> + * @dev: ACPI device to add the notifier for.
> + * @pci_dev: PCI device to check for the PME status if an event is signaled.
> + * @pci_bus: PCI bus to walk (checking PME status) if an event is signaled.
> + *
> + * Check if there is a notifier object for @dev and if that is the case, add
> + * @pci_dev to it as the device whose PME status should be checked if a PM
> + * event is signaled for @dev. Also, add @pci_bus to it as the bus to walk
> + * checking the PME status of all devices on it if a PM event is signaled for
> + * @dev. Otherwise, create a new notifier object for @dev and add both
> + * @pci_dev and @pci_bus to it.
> + */
> +acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev,
> + struct pci_dev *pci_dev,
> + struct pci_bus *pci_bus)
> +{
> + struct pci_acpi_notifier_block *nb;
> + acpi_status status = AE_OK;
> +
> + if (!dev->wakeup.flags.run_wake)
> + return AE_BAD_PARAMETER;
> +
> + mutex_lock(&pci_acpi_notifier_mtx);
> +
> + list_for_each_entry(nb, &pci_acpi_runtime_notifiers, entry)
> + if (nb->dev == dev) {
> + if (nb->pci_dev || nb->pci_bus)
> + goto out;
> + else
> + goto add;
> + }
> +
> + nb = new_notifier(dev);
> + if (!nb) {
> + status = AE_NO_MEMORY;
> + goto out;
> + }
> + list_add_tail(&nb->entry, &pci_acpi_runtime_notifiers);
> +
> + status = acpi_install_notify_handler(dev->handle, ACPI_SYSTEM_NOTIFY,
> + pci_acpi_event_fn, nb);
> + if (ACPI_FAILURE(status)) {
> + list_del(&nb->entry);
> + kfree(nb);
> + }
I think when nb is freed, it should be go to "out:".
> +
> + add:
> + nb->pci_dev = pci_dev;
> + nb->pci_bus = pci_bus;
> +
> + out:
> + mutex_unlock(&pci_acpi_notifier_mtx);
> + return status;
> +}
> +
> +/**
> + * pci_acpi_remove_pm_notifier - Unregister PM notifier for given device.
> + * @dev: ACPI device to remove the notifier from.
> + *
> + * Find the notifier object for @dev and clear its @pci_dev and @pci_bus fields.
> + * If the notifier object is not necessary any more after that, remove it too.
> + */
next prev parent reply other threads:[~2009-11-16 4:37 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-15 23:47 [RFC][PATCH 0/10] PCI run-time PM support Rafael J. Wysocki
2009-11-15 23:49 ` [RFC][PATCH 1/10] PM: Add flag for devices capable of generating run-time wake-up events Rafael J. Wysocki
2009-11-16 19:39 ` Alan Stern
2009-11-16 20:52 ` Rafael J. Wysocki
2009-11-16 21:00 ` Alan Stern
2009-11-16 21:05 ` Matthew Garrett
2009-11-16 21:31 ` Alan Stern
2009-11-16 21:23 ` Oliver Neukum
2009-11-15 23:50 ` [RFC][PATCH 2/10] PCI PM: Add function for checking PME status of devices Rafael J. Wysocki
2009-11-15 23:51 ` [RFC][PATCH 3/10] PCI / PM: Propagate wake-up enable for PCIe devices too Rafael J. Wysocki
2009-11-15 23:52 ` [RFC][PATCH 4/10] PCI PM: PCIe PME root port service driver (rev. 4) Rafael J. Wysocki
2009-11-15 23:53 ` [RFC][PATCH 5/10] ACPI: Add infrastructure for refcounting GPE consumers Rafael J. Wysocki
2009-11-15 23:55 ` [RFC][PATCH 6/10] ACPI: Add support for new refcounted GPE API to drivers Rafael J. Wysocki
2009-11-15 23:55 ` [RFC][PATCH 7/10] ACPI: Remove old GPE API and transition code entirely to new one Rafael J. Wysocki
2009-11-15 23:55 ` [RFC][PATCH 8/10] ACPI / PM: Add more run-time wake-up fields Rafael J. Wysocki
2009-11-15 23:57 ` [RFC][PATCH 9/10] PCI / ACPI PM: Platform support for PCI PME wake-up (rev. 3) Rafael J. Wysocki
2009-11-16 4:36 ` Jin Dongming [this message]
2009-11-16 19:04 ` Rafael J. Wysocki
2009-11-15 23:58 ` [RFC][PATCH 10/10] PCI PM: Run-time callbacks for PCI bus type Rafael J. Wysocki
2009-11-29 15:32 ` [RFC][PATCH 0/12] PCI run-time PM support (updated) Rafael J. Wysocki
2009-11-29 15:34 ` [RFC][PATCH 1/12] PM: Add flag for devices capable of generating run-time wake-up events Rafael J. Wysocki
2009-11-29 15:34 ` [RFC][PATCH 2/12] PCI PM: Add function for checking PME status of devices Rafael J. Wysocki
2009-11-29 15:35 ` [RFC][PATCH 3/12] PCI / PM: Propagate wake-up enable for PCIe devices too Rafael J. Wysocki
2009-12-16 19:19 ` Jesse Barnes
2009-12-16 19:28 ` Rafael J. Wysocki
2009-11-29 15:36 ` [RFC][PATCH 4/12] PCI PM: PCIe PME root port service driver (rev. 5) Rafael J. Wysocki
2009-12-05 0:38 ` [RFC][PATCH 4/12] PCI PM: PCIe PME root port service driver (rev. 5) (updated) Rafael J. Wysocki
2009-11-29 15:37 ` [RFC][PATCH 5/12] PCI PM: Make it possible to force using INTx for PCIe PME signaling Rafael J. Wysocki
2009-12-04 21:17 ` [RFC][PATCH 5/12] PCI PM: Make it possible to force using INTx for PCIe PME signaling (updated) Rafael J. Wysocki
2009-11-29 15:39 ` [RFC][PATCH 6/12] ACPI: Add infrastructure for refcounting GPE consumers Rafael J. Wysocki
2009-11-29 15:39 ` [RFC][PATCH 7/12] ACPI: Add support for new refcounted GPE API to drivers Rafael J. Wysocki
2009-11-29 15:40 ` [RFC][PATCH 8/12] ACPI: Remove old GPE API and transition code entirely to new one Rafael J. Wysocki
2009-11-29 15:41 ` [RFC][PATCH 9/12] ACPI / PM: Add more run-time wake-up fields Rafael J. Wysocki
2009-11-29 15:42 ` [RFC][PATCH 10/12] PCI / ACPI PM: Platform support for PCI PME wake-up (rev. 4) Rafael J. Wysocki
2009-12-04 16:21 ` Matthew Garrett
2009-12-04 21:15 ` Rafael J. Wysocki
2009-12-05 0:35 ` [RFC][PATCH 10/12] PCI / ACPI PM: Platform support for PCI PME wake-up (rev. 5) Rafael J. Wysocki
2009-11-29 15:43 ` [RFC][PATCH 11/12] PCI PM: Run-time callbacks for PCI bus type (rev. 2) Rafael J. Wysocki
2009-12-01 22:00 ` Matthew Garrett
2009-12-01 22:50 ` Rafael J. Wysocki
2009-11-29 15:44 ` [RFC][PATCH 12/12] PM / r8169: Add simplified run-time PM support Rafael J. Wysocki
2009-12-15 11:49 ` Pavel Machek
2009-12-27 19:48 ` Rafael J. Wysocki
2009-12-27 20:01 ` Pavel Machek
2010-01-02 20:49 ` Rafael J. Wysocki
2010-01-03 19:55 ` Pavel Machek
2010-01-03 21:01 ` Rafael J. Wysocki
2010-01-04 8:31 ` Pavel Machek
2010-01-04 9:53 ` Oliver Neukum
2010-01-04 19:51 ` Rafael J. Wysocki
2010-01-04 21:00 ` Pavel Machek
2009-12-04 23:21 ` [RFC][PATCH 0/12] PCI run-time PM support (updated) Jesse Barnes
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=4B00D6E2.9010404@np.css.fujitsu.com \
--to=jin.dongming@np.css.fujitsu.com \
--cc=bjorn.helgaas@hp.com \
--cc=jbarnes@virtuousgeek.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=mjg59@srcf.ucam.org \
--cc=oliver@neukum.org \
--cc=rjw@sisk.pl \
--cc=shaohua.li@intel.com \
--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