aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCasey Leedom <leedom@chelsio.com>2013-08-06 06:18:38 -0400
committerBjorn Helgaas <bhelgaas@google.com>2013-08-12 15:58:14 -0400
commit8903b9eb19e0e2ca5ec0fc257cb0e5d9e94c75f4 (patch)
tree0f13178dc81be6f67d9077c253a0786dbeaa79f5
parent2c6217e0fc5f6c7458f413346806061d97ce37cf (diff)
bnx2x: Use pci_wait_for_pending_transaction() instead of for loop
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>
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index e5da07858a2f..c51d2f82a93e 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -9935,8 +9935,6 @@ static int bnx2x_prev_mark_path(struct bnx2x *bp, bool after_undi)
9935 9935
9936static int bnx2x_do_flr(struct bnx2x *bp) 9936static int bnx2x_do_flr(struct bnx2x *bp)
9937{ 9937{
9938 int i;
9939 u16 status;
9940 struct pci_dev *dev = bp->pdev; 9938 struct pci_dev *dev = bp->pdev;
9941 9939
9942 if (CHIP_IS_E1x(bp)) { 9940 if (CHIP_IS_E1x(bp)) {
@@ -9951,20 +9949,8 @@ static int bnx2x_do_flr(struct bnx2x *bp)
9951 return -EINVAL; 9949 return -EINVAL;
9952 } 9950 }
9953 9951
9954 /* Wait for Transaction Pending bit clean */ 9952 if (!pci_wait_for_pending_transaction(dev))
9955 for (i = 0; i < 4; i++) { 9953 dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n");
9956 if (i)
9957 msleep((1 << (i - 1)) * 100);
9958
9959 pcie_capability_read_word(dev, PCI_EXP_DEVSTA, &status);
9960 if (!(status & PCI_EXP_DEVSTA_TRPND))
9961 goto clear;
9962 }
9963
9964 dev_err(&dev->dev,
9965 "transaction is not cleared; proceeding with reset anyway\n");
9966
9967clear:
9968 9954
9969 BNX2X_DEV_INFO("Initiating FLR\n"); 9955 BNX2X_DEV_INFO("Initiating FLR\n");
9970 bnx2x_fw_command(bp, DRV_MSG_CODE_INITIATE_FLR, 0); 9956 bnx2x_fw_command(bp, DRV_MSG_CODE_INITIATE_FLR, 0);