diff mbox

[3/4] PCI: Allow msix_capability_init() take MSIX cap struct

Message ID 1364374564-19096-4-git-send-email-shangw@linux.vnet.ibm.com
State Changes Requested
Headers show

Commit Message

Gavin Shan March 27, 2013, 8:56 a.m. UTC
The patch introduces additional parameter to msix_capability_init()
so that we can pass the address of MSI-X capability structure to
the function.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
 drivers/pci/msi.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 7ba9461..a20cb0a 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -674,19 +674,20 @@  static void msix_program_entries(struct pci_dev *dev,
  * @dev: pointer to the pci_dev data structure of MSI-X device function
  * @entries: pointer to an array of struct msix_entry entries
  * @nvec: number of @entries
+ * @pos: address of MSI-X capability structure
  *
  * Setup the MSI-X capability structure of device function with a
  * single MSI-X irq. A return of zero indicates the successful setup of
  * requested MSI-X entries with allocated irqs or non-zero for otherwise.
  **/
 static int msix_capability_init(struct pci_dev *dev,
-				struct msix_entry *entries, int nvec)
+				struct msix_entry *entries,
+				int nvec, int pos)
 {
-	int pos, ret;
+	int ret;
 	u16 control;
 	void __iomem *base;
 
-	pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
 	pci_read_config_word(dev, pos + PCI_MSIX_FLAGS, &control);
 
 	/* Ensure MSI-X is disabled while it is set up */
@@ -980,7 +981,8 @@  int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec)
 		       "(MSI IRQ already assigned)\n");
 		return -EINVAL;
 	}
-	status = msix_capability_init(dev, entries, nvec);
+
+	status = msix_capability_init(dev, entries, nvec, pos);
 	return status;
 }
 EXPORT_SYMBOL(pci_enable_msix);