Re: [pci PATCH v6 4/5] nvme: Migrate over to unmanaged SR-IOV support

2018-03-14 Thread Christoph Hellwig
Looks good,

Reviewed-by: Christoph Hellwig 


[pci PATCH v6 4/5] nvme: Migrate over to unmanaged SR-IOV support

2018-03-13 Thread Alexander Duyck
From: Alexander Duyck 

Instead of implementing our own version of a SR-IOV configuration stub in
the nvme driver we can just reuse the existing
pci_sriov_configure_simple function.

Signed-off-by: Alexander Duyck 
---

v5: Replaced call to pci_sriov_configure_unmanaged with
pci_sriov_configure_simple
v6: Dropped "#ifdef" checks for IOV wrapping sriov_configure definition

 drivers/nvme/host/pci.c |   20 +---
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 5933a5c732e8..5e963058882a 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2580,24 +2580,6 @@ static void nvme_remove(struct pci_dev *pdev)
nvme_put_ctrl(>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(>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)
 {
@@ -2716,7 +2698,7 @@ static void nvme_error_resume(struct pci_dev *pdev)
.driver = {
.pm = _dev_pm_ops,
},
-   .sriov_configure = nvme_pci_sriov_configure,
+   .sriov_configure = pci_sriov_configure_simple,
.err_handler= _err_handler,
 };