Adopt the same approach as in intel_graphics_quirks(), with a static local variable, to control when the quirk has already been applied. However, contrary to intel_graphics_quirks() here we always set it as applied as soon as it's called to avoid changing the current behavior that is not failing. After converting other users, it will allow us to remove all the logic handling the flags. Signed-off-by: Lucas De Marchi <lucas.demarchi@xxxxxxxxx> --- arch/x86/kernel/early-quirks.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index de9a76eb544e..59cc67aace93 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -57,6 +57,13 @@ static void __init fix_hypertransport_config(int num, int slot, int func) static void __init via_bugs(int num, int slot, int func) { #ifdef CONFIG_GART_IOMMU + static bool quirk_applied __initdata; + + if (quirk_applied) + return; + + quirk_applied = true; + if ((max_pfn > MAX_DMA32_PFN || force_iommu) && !gart_iommu_aperture_allowed) { printk(KERN_INFO @@ -697,7 +704,7 @@ static struct chipset early_qrk[] __initdata = { { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, nvidia_bugs }, { PCI_VENDOR_ID_VIA, PCI_ANY_ID, - PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, via_bugs }, + PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, 0, via_bugs }, { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB, PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, fix_hypertransport_config }, { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS, -- 2.34.1