[PATCH 09/11] PCI: Move CardBus legacy mode quirk to setup-cardbus.c
From: Ilpo Järvinen
Date: Mon Nov 09 2026 - 16:13:16 EST
quirk_cardbus_legacy() disables the legacy i82365 mode of CardBus
bridges. It was originally applied even without CardBus support to keep
the i82365 driver away from CardBus bridges, but that driver was removed
by commit b3c26ea81ccc ("pcmcia: remove obsolete host controller
drivers").
CardBus bridges are no longer set up when CONFIG_CARDBUS is not set, so
the quirk only matters with CARDBUS. Move it to setup-cardbus.c.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
---
Cc: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
drivers/pci/quirks.c | 13 -------------
drivers/pci/setup-cardbus.c | 15 +++++++++++++++
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 7f1f47ea2ee4..78f6df5d4d19 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1286,19 +1286,6 @@ static void quirk_vt82c598_id(struct pci_dev *dev)
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, quirk_vt82c598_id);
-/*
- * CardBus controllers have a legacy base address that enables them to
- * respond as i82365 PCMCIA controllers. We don't want them to do this.
- */
-static void quirk_cardbus_legacy(struct pci_dev *dev)
-{
- pci_write_config_dword(dev, PCI_CB_LEGACY_MODE_BASE, 0);
-}
-DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
- PCI_CLASS_BRIDGE_CARDBUS, 8, quirk_cardbus_legacy);
-DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(PCI_ANY_ID, PCI_ANY_ID,
- PCI_CLASS_BRIDGE_CARDBUS, 8, quirk_cardbus_legacy);
-
/*
* Following the PCI ordering rules is optional on the AMD762. I'm not sure
* what the designers were smoking but let's not inhale...
diff --git a/drivers/pci/setup-cardbus.c b/drivers/pci/setup-cardbus.c
index 0de82d7fde68..ef35393aca1b 100644
--- a/drivers/pci/setup-cardbus.c
+++ b/drivers/pci/setup-cardbus.c
@@ -316,3 +316,18 @@ int pci_cardbus_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev,
return max;
}
+
+#ifdef CONFIG_PCI_QUIRKS
+/*
+ * CardBus controllers have a legacy base address that enables them to
+ * respond as i82365 PCMCIA controllers. We don't want them to do this.
+ */
+static void quirk_cardbus_legacy(struct pci_dev *dev)
+{
+ pci_write_config_dword(dev, PCI_CB_LEGACY_MODE_BASE, 0);
+}
+DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
+ PCI_CLASS_BRIDGE_CARDBUS, 8, quirk_cardbus_legacy);
+DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(PCI_ANY_ID, PCI_ANY_ID,
+ PCI_CLASS_BRIDGE_CARDBUS, 8, quirk_cardbus_legacy);
+#endif /* CONFIG_PCI_QUIRKS */
--
2.47.3