diff options
author | Casey Leedom <leedom@chelsio.com> | 2013-08-06 06:18:39 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-08-12 15:58:14 -0400 |
commit | 4d708ab0c88512a3bea12f1ad68539fbe0d11d1a (patch) | |
tree | e7958c5879947350b7a66e7a3acae6bff0702545 | |
parent | 8903b9eb19e0e2ca5ec0fc257cb0e5d9e94c75f4 (diff) |
PCI: 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 function.
Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Vipul Pandya <vipul@chelsio.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r-- | drivers/pci/quirks.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 8f075a3cd805..296508ec91d7 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -3126,9 +3126,6 @@ static int reset_intel_generic_dev(struct pci_dev *dev, int probe) | |||
3126 | 3126 | ||
3127 | static int reset_intel_82599_sfp_virtfn(struct pci_dev *dev, int probe) | 3127 | static int reset_intel_82599_sfp_virtfn(struct pci_dev *dev, int probe) |
3128 | { | 3128 | { |
3129 | int i; | ||
3130 | u16 status; | ||
3131 | |||
3132 | /* | 3129 | /* |
3133 | * http://www.intel.com/content/dam/doc/datasheet/82599-10-gbe-controller-datasheet.pdf | 3130 | * http://www.intel.com/content/dam/doc/datasheet/82599-10-gbe-controller-datasheet.pdf |
3134 | * | 3131 | * |
@@ -3140,20 +3137,9 @@ static int reset_intel_82599_sfp_virtfn(struct pci_dev *dev, int probe) | |||
3140 | if (probe) | 3137 | if (probe) |
3141 | return 0; | 3138 | return 0; |
3142 | 3139 | ||
3143 | /* Wait for Transaction Pending bit clean */ | 3140 | if (!pci_wait_for_pending_transaction(dev)) |
3144 | for (i = 0; i < 4; i++) { | 3141 | dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n"); |
3145 | if (i) | ||
3146 | msleep((1 << (i - 1)) * 100); | ||
3147 | |||
3148 | pcie_capability_read_word(dev, PCI_EXP_DEVSTA, &status); | ||
3149 | if (!(status & PCI_EXP_DEVSTA_TRPND)) | ||
3150 | goto clear; | ||
3151 | } | ||
3152 | |||
3153 | dev_err(&dev->dev, "transaction is not cleared; " | ||
3154 | "proceeding with reset anyway\n"); | ||
3155 | 3142 | ||
3156 | clear: | ||
3157 | pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR); | 3143 | pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR); |
3158 | 3144 | ||
3159 | msleep(100); | 3145 | msleep(100); |