benet: Use pci_enable_msix_range() instead of pci_enable_msix()
authorAlexander Gordeev <agordeev@redhat.com>
Tue, 18 Feb 2014 10:11:40 +0000 (11:11 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 18 Feb 2014 20:33:30 +0000 (15:33 -0500)
As result of deprecation of MSI-X/MSI enablement functions
pci_enable_msix() and pci_enable_msi_block() all drivers
using these two interfaces need to be updated to use the
new pci_enable_msi_range() and pci_enable_msix_range()
interfaces.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: Sathya Perla <sathya.perla@emulex.com>
Cc: Subbu Seetharaman <subbu.seetharaman@emulex.com>
Cc: Ajit Khaparde <ajit.khaparde@emulex.com>
Cc: netdev@vger.kernel.org
Cc: linux-pci@vger.kernel.org
Acked-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/emulex/benet/be_main.c

index a8cf03ed2de6e6e977a2f4de91e979073c019c17..4f87f5c0b03ceaa4132543e4398d0514a2e2cb99 100644 (file)
@@ -2507,7 +2507,7 @@ static void be_msix_disable(struct be_adapter *adapter)
 
 static int be_msix_enable(struct be_adapter *adapter)
 {
-       int i, status, num_vec;
+       int i, num_vec;
        struct device *dev = &adapter->pdev->dev;
 
        /* If RoCE is supported, program the max number of NIC vectors that
@@ -2523,24 +2523,11 @@ static int be_msix_enable(struct be_adapter *adapter)
        for (i = 0; i < num_vec; i++)
                adapter->msix_entries[i].entry = i;
 
-       status = pci_enable_msix(adapter->pdev, adapter->msix_entries, num_vec);
-       if (status == 0) {
-               goto done;
-       } else if (status >= MIN_MSIX_VECTORS) {
-               num_vec = status;
-               status = pci_enable_msix(adapter->pdev, adapter->msix_entries,
-                                        num_vec);
-               if (!status)
-                       goto done;
-       }
+       num_vec = pci_enable_msix_range(adapter->pdev, adapter->msix_entries,
+                                       MIN_MSIX_VECTORS, num_vec);
+       if (num_vec < 0)
+               goto fail;
 
-       dev_warn(dev, "MSIx enable failed\n");
-
-       /* INTx is not supported in VFs, so fail probe if enable_msix fails */
-       if (!be_physfn(adapter))
-               return status;
-       return 0;
-done:
        if (be_roce_supported(adapter) && num_vec > MIN_MSIX_VECTORS) {
                adapter->num_msix_roce_vec = num_vec / 2;
                dev_info(dev, "enabled %d MSI-x vector(s) for RoCE\n",
@@ -2552,6 +2539,14 @@ done:
        dev_info(dev, "enabled %d MSI-x vector(s) for NIC\n",
                 adapter->num_msix_vec);
        return 0;
+
+fail:
+       dev_warn(dev, "MSIx enable failed\n");
+
+       /* INTx is not supported in VFs, so fail probe if enable_msix fails */
+       if (!be_physfn(adapter))
+               return num_vec;
+       return 0;
 }
 
 static inline int be_msix_vec_get(struct be_adapter *adapter,