aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/qat
diff options
context:
space:
mode:
authorAllan, Bruce W <bruce.w.allan@intel.com>2015-01-09 14:55:14 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2015-01-13 06:30:46 -0500
commita6bcc1e443420f370881ec0b38aea636c1bf71c7 (patch)
tree9d58699df2f9d5adab25db18e0e1a3c7084df10c /drivers/crypto/qat
parentfd98d692bb2bdd22f76bf1449df7131cefddccae (diff)
crypto: qat - use pci_wait_for_pending_transaction()
Prior to resetting the hardware, use pci_wait_for_pending_transaction() instead of open coding similar functionality. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Acked-by: Tadeusz Struk <tadeusz.struk@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/qat')
-rw-r--r--drivers/crypto/qat/qat_common/adf_aer.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/drivers/crypto/qat/qat_common/adf_aer.c b/drivers/crypto/qat/qat_common/adf_aer.c
index 740dc9e1c70c..fa1fef824de2 100644
--- a/drivers/crypto/qat/qat_common/adf_aer.c
+++ b/drivers/crypto/qat/qat_common/adf_aer.c
@@ -82,28 +82,15 @@ struct adf_reset_dev_data {
82 struct work_struct reset_work; 82 struct work_struct reset_work;
83}; 83};
84 84
85#define PPDSTAT_OFFSET 0x7E
86static void adf_dev_restore(struct adf_accel_dev *accel_dev) 85static void adf_dev_restore(struct adf_accel_dev *accel_dev)
87{ 86{
88 struct pci_dev *pdev = accel_to_pci_dev(accel_dev); 87 struct pci_dev *pdev = accel_to_pci_dev(accel_dev);
89 struct pci_dev *parent = pdev->bus->self; 88 struct pci_dev *parent = pdev->bus->self;
90 uint16_t ppdstat = 0, bridge_ctl = 0; 89 uint16_t bridge_ctl = 0;
91 int pending = 0;
92 90
93 pr_info("QAT: Resetting device qat_dev%d\n", accel_dev->accel_id); 91 pr_info("QAT: Resetting device qat_dev%d\n", accel_dev->accel_id);
94 pci_read_config_word(pdev, PPDSTAT_OFFSET, &ppdstat);
95 pending = ppdstat & PCI_EXP_DEVSTA_TRPND;
96 if (pending) {
97 int ctr = 0;
98
99 do {
100 msleep(100);
101 pci_read_config_word(pdev, PPDSTAT_OFFSET, &ppdstat);
102 pending = ppdstat & PCI_EXP_DEVSTA_TRPND;
103 } while (pending && ctr++ < 10);
104 }
105 92
106 if (pending) 93 if (!pci_wait_for_pending_transaction(pdev))
107 pr_info("QAT: Transaction still in progress. Proceeding\n"); 94 pr_info("QAT: Transaction still in progress. Proceeding\n");
108 95
109 pci_read_config_word(parent, PCI_BRIDGE_CONTROL, &bridge_ctl); 96 pci_read_config_word(parent, PCI_BRIDGE_CONTROL, &bridge_ctl);