[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B7CBD37.9000706@jp.fujitsu.com>
Date: Thu, 18 Feb 2010 13:08:23 +0900
From: Kenji Kaneshige <kaneshige.kenji@...fujitsu.com>
To: "Rafael J. Wysocki" <rjw@...k.pl>
CC: Jesse Barnes <jbarnes@...tuousgeek.org>,
"Moore, Robert" <robert.moore@...el.com>,
Len Brown <lenb@...nel.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
pm list <linux-pm@...ts.linux-foundation.org>,
Linux PCI <linux-pci@...r.kernel.org>,
Shaohua Li <shaohua.li@...el.com>,
Bjorn Helgaas <bjorn.helgaas@...com>,
Oliver Neukum <oliver@...kum.org>,
Matthew Garrett <mjg@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
Gary Hade <garyhade@...ibm.com>
Subject: Re: [PATCH 2/8] PCI PM: PCIe PME root port service driver (rev. 5)
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists