staging: gasket: Fix pci remove/rescan for kernel module build.
For driver build as module pci_fixup_header approach doesn't work.
This causes apex pci class to remain 0xff and BARs remain
unclaimed. Adding a retry with explicit fixup function call
workarounds the problem.
Bug: 129287752
Change-Id: Id5ff85ef427d3740706a214d3beb1c9bbf42ab5a
Signed-off-by: Leonid Lobachev <leonidl@google.com>
diff --git a/drivers/staging/gasket/apex_driver.c b/drivers/staging/gasket/apex_driver.c
index e227017..1eff202 100644
--- a/drivers/staging/gasket/apex_driver.c
+++ b/drivers/staging/gasket/apex_driver.c
@@ -652,7 +652,7 @@
pdev->class = (PCI_CLASS_SYSTEM_OTHER << 8) | pdev->class;
}
DECLARE_PCI_FIXUP_CLASS_HEADER(APEX_PCI_VENDOR_ID, APEX_PCI_DEVICE_ID,
- PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class);
+ PCI_ANY_ID, 8, apex_pci_fixup_class);
static int apex_pci_probe(struct pci_dev *pci_dev,
const struct pci_device_id *id)
@@ -663,6 +663,13 @@
struct gasket_dev *gasket_dev;
ret = pci_enable_device(pci_dev);
+#ifdef MODULE
+ if (ret) {
+ apex_pci_fixup_class(pci_dev);
+ pci_bus_assign_resources(pci_dev->bus);
+ ret = pci_enable_device(pci_dev);
+ }
+#endif
if (ret) {
dev_err(&pci_dev->dev, "error enabling PCI device\n");
return ret;