]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
bnx2x: Use pci_wait_for_pending_transaction() instead of for loop
authorCasey Leedom <leedom@chelsio.com>
Tue, 6 Aug 2013 10:18:38 +0000 (15:48 +0530)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 12 Aug 2013 19:58:14 +0000 (13:58 -0600)
New routine has been added to avoid duplication of code to wait for
pending PCI transactions to complete.  This makes use of that routine.

Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Vipul Pandya <vipul@chelsio.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
Acked-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c

index e5da07858a2f0d5dca0747e1b7fe58992b799d5e..c51d2f82a93ebe3be5584f2e46ef8156fda9febe 100644 (file)
@@ -9935,8 +9935,6 @@ static int bnx2x_prev_mark_path(struct bnx2x *bp, bool after_undi)
 
 static int bnx2x_do_flr(struct bnx2x *bp)
 {
-       int i;
-       u16 status;
        struct pci_dev *dev = bp->pdev;
 
        if (CHIP_IS_E1x(bp)) {
@@ -9951,20 +9949,8 @@ static int bnx2x_do_flr(struct bnx2x *bp)
                return -EINVAL;
        }
 
-       /* Wait for Transaction Pending bit clean */
-       for (i = 0; i < 4; i++) {
-               if (i)
-                       msleep((1 << (i - 1)) * 100);
-
-               pcie_capability_read_word(dev, PCI_EXP_DEVSTA, &status);
-               if (!(status & PCI_EXP_DEVSTA_TRPND))
-                       goto clear;
-       }
-
-       dev_err(&dev->dev,
-               "transaction is not cleared; proceeding with reset anyway\n");
-
-clear:
+       if (!pci_wait_for_pending_transaction(dev))
+               dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n");
 
        BNX2X_DEV_INFO("Initiating FLR\n");
        bnx2x_fw_command(bp, DRV_MSG_CODE_INITIATE_FLR, 0);