[PATCH v3 02/10] fpga: dfl-pci: set driver flag to disable SR-IOV on remove()

Peter Colberg
2026-03-03T21:15:39Z

Set the flag managed_sriov in the pci_driver structure to show how a
PCI driver may opt into disabling the Single Root I/O Virtualization
(SR-IOV) capability of the device when the driver is removed.

Merge the function cci_remove_feature_devs() into cci_pci_remove().

Signed-off-by: Peter Colberg <pcolberg@redhat.com>
---
Changes in v2:
- Demonstrate flag managed_sriov for dfl-pci driver.
---
drivers/fpga/dfl-pci.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
index e25205c6d8f00cec579016acade28e743812c924..2410e6f3efe100a635eebfdb21f28f62a3759890 100644
--- a/drivers/fpga/dfl-pci.c
+++ b/drivers/fpga/dfl-pci.c
@@ -125,15 +125,6 @@ static int cci_init_drvdata(struct pci_dev *pcidev)
return 0;
}

-static void cci_remove_feature_devs(struct pci_dev *pcidev)
-{
- struct cci_drvdata *drvdata = pci_get_drvdata(pcidev);
-
- /* remove all children feature devices */
- dfl_fpga_feature_devs_remove(drvdata->cdev);
- cci_pci_free_irq(pcidev);
-}
-
static int *cci_pci_create_irq_table(struct pci_dev *pcidev, unsigned int nvec)
{
unsigned int i;
@@ -425,10 +416,11 @@ static int cci_pci_sriov_configure(struct pci_dev *pcidev, int num_vfs)

static void cci_pci_remove(struct pci_dev *pcidev)
{
- if (dev_is_pf(&pcidev->dev))
- cci_pci_sriov_configure(pcidev, 0);
+ struct cci_drvdata *drvdata = pci_get_drvdata(pcidev);

- cci_remove_feature_devs(pcidev);
+ /* remove all children feature devices */
+ dfl_fpga_feature_devs_remove(drvdata->cdev);
+ cci_pci_free_irq(pcidev);
}

static struct pci_driver cci_pci_driver = {
@@ -437,6 +429,7 @@ static struct pci_driver cci_pci_driver = {
.probe = cci_pci_probe,
.remove = cci_pci_remove,
.sriov_configure = cci_pci_sriov_configure,
+ .managed_sriov = true,
};

module_pci_driver(cci_pci_driver);

--
2.53.0