Skip to content

Commit

Permalink
nvme-pci: Use pci_sriov_configure_simple() to enable VFs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexander Duyck authored and Bjorn Helgaas committed Apr 24, 2018
1 parent 115ddc4 commit 74d986a
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions drivers/nvme/host/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -2598,24 +2598,6 @@ static void nvme_remove(struct pci_dev *pdev)
nvme_put_ctrl(&dev->ctrl);
}

static int nvme_pci_sriov_configure(struct pci_dev *pdev, int numvfs)
{
int ret = 0;

if (numvfs == 0) {
if (pci_vfs_assigned(pdev)) {
dev_warn(&pdev->dev,
"Cannot disable SR-IOV VFs while assigned\n");
return -EPERM;
}
pci_disable_sriov(pdev);
return 0;
}

ret = pci_enable_sriov(pdev, numvfs);
return ret ? ret : numvfs;
}

#ifdef CONFIG_PM_SLEEP
static int nvme_suspend(struct device *dev)
{
Expand Down Expand Up @@ -2734,7 +2716,7 @@ static struct pci_driver nvme_driver = {
.driver = {
.pm = &nvme_dev_pm_ops,
},
.sriov_configure = nvme_pci_sriov_configure,
.sriov_configure = pci_sriov_configure_simple,
.err_handler = &nvme_err_handler,
};

Expand Down

0 comments on commit 74d986a

Please sign in to comment.