Message ID | 1365075572-20763-5-git-send-email-shangw@linux.vnet.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Bjorn Helgaas |
Headers | show |
On Thu, Apr 4, 2013 at 5:39 AM, Gavin Shan <shangw@linux.vnet.ibm.com> wrote: > The patch intends to use cached MSI capability offset instead of > polling that from config space in pci_enable_msi_block_auto(). > > Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> > --- > drivers/pci/msi.c | 7 +++---- > 1 files changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c > index 182474d..0b6b254 100644 > --- a/drivers/pci/msi.c > +++ b/drivers/pci/msi.c > @@ -848,14 +848,13 @@ EXPORT_SYMBOL(pci_enable_msi_block); > > int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec) > { > - int ret, pos, nvec; > + int ret, nvec; > u16 msgctl; > > - pos = pci_find_capability(dev, PCI_CAP_ID_MSI); > - if (!pos) > + if (!dev->msi_cap) > return -EINVAL; > > - pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &msgctl); > + pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &msgctl); I don't understand why this is in a separate patch. Just add and populate the cache, then replace all the pci_find_capability() calls with a dev->msi_cap reference at once. > ret = 1 << ((msgctl & PCI_MSI_FLAGS_QMASK) >> 1); > > if (maxvec) > -- > 1.7.5.4 > -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 182474d..0b6b254 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -848,14 +848,13 @@ EXPORT_SYMBOL(pci_enable_msi_block); int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec) { - int ret, pos, nvec; + int ret, nvec; u16 msgctl; - pos = pci_find_capability(dev, PCI_CAP_ID_MSI); - if (!pos) + if (!dev->msi_cap) return -EINVAL; - pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &msgctl); + pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &msgctl); ret = 1 << ((msgctl & PCI_MSI_FLAGS_QMASK) >> 1); if (maxvec)
The patch intends to use cached MSI capability offset instead of polling that from config space in pci_enable_msi_block_auto(). Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> --- drivers/pci/msi.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)