Commit 0b501e7a authored by Srikanth Jampala's avatar Srikanth Jampala Committed by Herbert Xu

crypto: cavium/nitrox - use pcie_flr instead of duplicating it

check the flr capability using pcie_has_flr() and do the flr.
Signed-off-by: default avatarSrikanth Jampala <Jampala.Srikanth@cavium.com>
Reviewed-by: default avatarGadam Sreerama <sgadam@cavium.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 80e73c8a
...@@ -217,7 +217,7 @@ void nitrox_put_device(struct nitrox_device *ndev) ...@@ -217,7 +217,7 @@ void nitrox_put_device(struct nitrox_device *ndev)
smp_mb__after_atomic(); smp_mb__after_atomic();
} }
static int nitrox_reset_device(struct pci_dev *pdev) static int nitrox_device_flr(struct pci_dev *pdev)
{ {
int pos = 0; int pos = 0;
...@@ -227,15 +227,10 @@ static int nitrox_reset_device(struct pci_dev *pdev) ...@@ -227,15 +227,10 @@ static int nitrox_reset_device(struct pci_dev *pdev)
return -ENOMEM; return -ENOMEM;
} }
pos = pci_pcie_cap(pdev); /* check flr support */
if (!pos) if (pcie_has_flr(pdev))
return -ENOTTY; pcie_flr(pdev);
if (!pci_wait_for_pending_transaction(pdev))
dev_err(&pdev->dev, "waiting for pending transaction\n");
pcie_capability_set_word(pdev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR);
msleep(100);
pci_restore_state(pdev); pci_restore_state(pdev);
return 0; return 0;
...@@ -345,7 +340,7 @@ static int nitrox_probe(struct pci_dev *pdev, ...@@ -345,7 +340,7 @@ static int nitrox_probe(struct pci_dev *pdev,
return err; return err;
/* do FLR */ /* do FLR */
err = nitrox_reset_device(pdev); err = nitrox_device_flr(pdev);
if (err) { if (err) {
dev_err(&pdev->dev, "FLR failed\n"); dev_err(&pdev->dev, "FLR failed\n");
pci_disable_device(pdev); pci_disable_device(pdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment