aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2018-04-24 17:47:27 -0400
committerBjorn Helgaas <bhelgaas@google.com>2018-04-24 17:47:27 -0400
commit74d986abc20bc2f0190a4e2683b9ae4d2de4117b (patch)
tree827d43c22275513b2867a9e2ee2b6efd76410cff
parent115ddc491922c3c133551e9cff2d3bfaed02a27e (diff)
nvme-pci: Use pci_sriov_configure_simple() to enable VFs
Instead of implementing our own version of a SR-IOV configuration stub in the nvme driver, use the existing pci_sriov_configure_simple() function. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--drivers/nvme/host/pci.c20
1 files changed, 1 insertions, 19 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index fbc71fac6f1e..284cdd336271 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2598,24 +2598,6 @@ static void nvme_remove(struct pci_dev *pdev)
2598 nvme_put_ctrl(&dev->ctrl); 2598 nvme_put_ctrl(&dev->ctrl);
2599} 2599}
2600 2600
2601static int nvme_pci_sriov_configure(struct pci_dev *pdev, int numvfs)
2602{
2603 int ret = 0;
2604
2605 if (numvfs == 0) {
2606 if (pci_vfs_assigned(pdev)) {
2607 dev_warn(&pdev->dev,
2608 "Cannot disable SR-IOV VFs while assigned\n");
2609 return -EPERM;
2610 }
2611 pci_disable_sriov(pdev);
2612 return 0;
2613 }
2614
2615 ret = pci_enable_sriov(pdev, numvfs);
2616 return ret ? ret : numvfs;
2617}
2618
2619#ifdef CONFIG_PM_SLEEP 2601#ifdef CONFIG_PM_SLEEP
2620static int nvme_suspend(struct device *dev) 2602static int nvme_suspend(struct device *dev)
2621{ 2603{
@@ -2734,7 +2716,7 @@ static struct pci_driver nvme_driver = {
2734 .driver = { 2716 .driver = {
2735 .pm = &nvme_dev_pm_ops, 2717 .pm = &nvme_dev_pm_ops,
2736 }, 2718 },
2737 .sriov_configure = nvme_pci_sriov_configure, 2719 .sriov_configure = pci_sriov_configure_simple,
2738 .err_handler = &nvme_err_handler, 2720 .err_handler = &nvme_err_handler,
2739}; 2721};
2740 2722