crypto: qat - use pci_wait_for_pending_transaction()
authorAllan, Bruce W <bruce.w.allan@intel.com>
Fri, 9 Jan 2015 19:55:14 +0000 (11:55 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 13 Jan 2015 11:30:46 +0000 (22:30 +1100)
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>
drivers/crypto/qat/qat_common/adf_aer.c

index 740dc9e1c70cb1f53994e3d8f797939fcea012f6..fa1fef824de2dc8d40c0ede7f273a451b6d840fb 100644 (file)
@@ -82,28 +82,15 @@ struct adf_reset_dev_data {
        struct work_struct reset_work;
 };
 
-#define PPDSTAT_OFFSET 0x7E
 static void adf_dev_restore(struct adf_accel_dev *accel_dev)
 {
        struct pci_dev *pdev = accel_to_pci_dev(accel_dev);
        struct pci_dev *parent = pdev->bus->self;
-       uint16_t ppdstat = 0, bridge_ctl = 0;
-       int pending = 0;
+       uint16_t bridge_ctl = 0;
 
        pr_info("QAT: Resetting device qat_dev%d\n", accel_dev->accel_id);
-       pci_read_config_word(pdev, PPDSTAT_OFFSET, &ppdstat);
-       pending = ppdstat & PCI_EXP_DEVSTA_TRPND;
-       if (pending) {
-               int ctr = 0;
-
-               do {
-                       msleep(100);
-                       pci_read_config_word(pdev, PPDSTAT_OFFSET, &ppdstat);
-                       pending = ppdstat & PCI_EXP_DEVSTA_TRPND;
-               } while (pending && ctr++ < 10);
-       }
 
-       if (pending)
+       if (!pci_wait_for_pending_transaction(pdev))
                pr_info("QAT: Transaction still in progress. Proceeding\n");
 
        pci_read_config_word(parent, PCI_BRIDGE_CONTROL, &bridge_ctl);