From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>,
"Moore, Robert" <robert.moore@intel.com>,
Len Brown <lenb@kernel.org>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
pm list <linux-pm@lists.linux-foundation.org>,
Linux PCI <linux-pci@vger.kernel.org>,
Shaohua Li <shaohua.li@intel.com>,
Bjorn Helgaas <bjorn.helgaas@hp.com>,
Oliver Neukum <oliver@neukum.org>,
Matthew Garrett <mjg@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
Gary Hade <garyhade@us.ibm.com>
Subject: Re: [PATCH 2/8] PCI PM: PCIe PME root port service driver (rev. 5)
Date: Thu, 18 Feb 2010 13:08:23 +0900 [thread overview]
Message-ID: <4B7CBD37.9000706@jp.fujitsu.com> (raw)
In-Reply-To: <201002172339.08865.rjw@sisk.pl>
Hi,
I'm sorry for the delayed comments.
> +
> +/**
> + * pcie_pme_interrupt_enable - Enable/disable PCIe PME interrupt generation.
> + * @dev: PCIe root port or event collector.
> + * @enable: Enable or disable the interrupt.
> + */
> +static void pcie_pme_interrupt_enable(struct pci_dev *dev, bool enable)
> +{
> + int rtctl_pos;
> + u16 rtctl;
> +
> + rtctl_pos = pci_find_capability(dev, PCI_CAP_ID_EXP) + PCI_EXP_RTCTL;
How about
rtctl_pos = pci_pcie_cap(dev) + PCI_EXP_RTCTL;
?
The pci_pcie_cap() returns PCIe capability offset saved in struct pci_dev.
By using this, we can avoid redundant search in PCI configuration space.
> +
> +/**
> + * pcie_pme_clear_status - Clear root port PME interrupt status.
> + * @dev: PCIe root port or event collector.
> + */
> +static void pcie_pme_clear_status(struct pci_dev *dev)
> +{
> + int rtsta_pos;
> + u32 rtsta;
> +
> + rtsta_pos = pci_find_capability(dev, PCI_CAP_ID_EXP) + PCI_EXP_RTSTA;
Ditto.
> +/**
> + * pcie_pme_work_fn - Work handler for PCIe PME interrupt.
> + * @work: Work structure giving access to service data.
> + */
> +static void pcie_pme_work_fn(struct work_struct *work)
> +{
> + struct pcie_pme_service_data *data =
> + container_of(work, struct pcie_pme_service_data, work);
> + struct pci_dev *port = data->srv->port;
> + int rtsta_pos;
> + u32 rtsta;
> +
> + rtsta_pos = pci_find_capability(port, PCI_CAP_ID_EXP) + PCI_EXP_RTSTA;
Ditto.
> +/**
> + * pcie_pme_irq - Interrupt handler for PCIe root port PME interrupt.
> + * @irq: Interrupt vector.
> + * @context: Interrupt context pointer.
> + */
> +static irqreturn_t pcie_pme_irq(int irq, void *context)
> +{
> + struct pci_dev *port;
> + struct pcie_pme_service_data *data;
> + int rtsta_pos;
> + u32 rtsta;
> + unsigned long flags;
> +
> + port = ((struct pcie_device *)context)->port;
> + data = get_service_data((struct pcie_device *)context);
> +
> + rtsta_pos = pci_find_capability(port, PCI_CAP_ID_EXP) + PCI_EXP_RTSTA;
Ditto.
Thanks,
Kenji Kaneshige
next prev parent reply other threads:[~2010-02-18 4:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-17 22:35 [PATCH 0/8] PCI run-time PM support (rev. 4) Rafael J. Wysocki
2010-02-17 22:36 ` [PATCH 1/8] PCI PM: Add function for checking PME status of devices Rafael J. Wysocki
2010-02-23 0:21 ` Jesse Barnes
2010-02-23 19:56 ` Rafael J. Wysocki
2010-02-17 22:39 ` [PATCH 2/8] PCI PM: PCIe PME root port service driver (rev. 5) Rafael J. Wysocki
2010-02-18 4:08 ` Kenji Kaneshige [this message]
2010-02-18 19:57 ` Rafael J. Wysocki
2010-02-19 2:07 ` Kenji Kaneshige
2010-02-17 22:40 ` [PATCH 3/8] PCI PM: Make it possible to force using INTx for PCIe PME signaling Rafael J. Wysocki
2010-02-17 22:41 ` [PATCH 4/8] ACPI: Use GPE reference counting to support shared GPEs Rafael J. Wysocki
2010-02-18 7:05 ` Jin Dongming
2010-02-18 20:01 ` Rafael J. Wysocki
2010-02-19 7:24 ` Jin Dongming
2010-02-19 21:08 ` Rafael J. Wysocki
2010-02-17 22:41 ` [PATCH 5/8] ACPI / PM: Add more run-time wake-up fields (rev. 2) Rafael J. Wysocki
2010-02-17 22:42 ` [PATCH 6/8] ACPI / ACPICA: Multiple system notify handlers per device Rafael J. Wysocki
2010-02-17 22:44 ` [PATCH 7/8] PCI / ACPI / PM: Platform support for PCI PME wake-up (rev. 9) Rafael J. Wysocki
2010-02-17 22:44 ` [PATCH 8/8] PCI PM: Run-time callbacks for PCI bus type (rev. 2) 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=4B7CBD37.9000706@jp.fujitsu.com \
--to=kaneshige.kenji@jp.fujitsu.com \
--cc=bjorn.helgaas@hp.com \
--cc=garyhade@us.ibm.com \
--cc=jbarnes@virtuousgeek.org \
--cc=lenb@kernel.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=mjg@redhat.com \
--cc=oliver@neukum.org \
--cc=rjw@sisk.pl \
--cc=robert.moore@intel.com \
--cc=shaohua.li@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 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).