lkml.org 
[lkml]   [2010]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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



\
 
 \ /
  Last update: 2010-02-18 05:11    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site