From 803070e07f7213a8061bb8518771e807a693c06e Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Thu, 1 May 2025 13:51:13 +0800 Subject: [PATCH] generic: fix disable common USB quirks patch Remove modifications for codes guarded by CONFIG_USB_PCI_AMD. This kernel symbol is only visible on desktop level platform, e.g. x86. They are not sensitive to firmware image size. This patch also fixes function redefinition build errors: drivers/usb/host/pci-quirks.c:621:6: error: redefinition of 'usb_asmedia_modifyflowcontrol' 621 | void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/usb/host/pci-quirks.c:22: drivers/usb/host/pci-quirks.h:49:20: note: previous definition of 'usb_asmedia_modifyflowcontrol' with type 'void(struct pci_dev *)' 49 | static inline void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev) {} | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: be6753dda00c ("generic: 6.12: manually rebuild pending patches") Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/18637 Signed-off-by: Hauke Mehrtens --- .../811-pci_disable_usb_common_quirks.patch | 44 +++++++------------ 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/target/linux/generic/pending-6.12/811-pci_disable_usb_common_quirks.patch b/target/linux/generic/pending-6.12/811-pci_disable_usb_common_quirks.patch index ddc15ed282c..4e0360d47fe 100644 --- a/target/linux/generic/pending-6.12/811-pci_disable_usb_common_quirks.patch +++ b/target/linux/generic/pending-6.12/811-pci_disable_usb_common_quirks.patch @@ -1,35 +1,32 @@ -From 472e77e6edb548addfe9b1f71e307223e892b2a3 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 26 Apr 2025 21:10:40 +0200 Subject: [PATCH] debloat: disable common USB quirks Signed-off-by: Felix Fietkau --- - drivers/usb/host/pci-quirks.c | 9 +++++++++ - drivers/usb/host/pci-quirks.h | 6 +++++- - 2 files changed, 14 insertions(+), 1 deletion(-) + drivers/usb/host/pci-quirks.c | 7 +++++++ + drivers/usb/host/pci-quirks.h | 4 ++++ + 2 files changed, 11 insertions(+) --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c -@@ -130,6 +130,8 @@ struct amd_chipset_type { - u8 rev; - }; - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS -+ - static struct amd_chipset_info { - struct pci_dev *nb_dev; - struct pci_dev *smbus_dev; -@@ -590,6 +592,8 @@ bool usb_amd_pt_check_port(struct device +@@ -590,6 +590,7 @@ bool usb_amd_pt_check_port(struct device EXPORT_SYMBOL_GPL(usb_amd_pt_check_port); #endif /* CONFIG_USB_PCI_AMD */ -+#endif /* CONFIG_PCI_DISABLE_COMMON_QUIRKS */ -+ ++#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS static int usb_asmedia_wait_write(struct pci_dev *pdev) { unsigned long retry_count; -@@ -724,6 +728,10 @@ reset_needed: +@@ -642,6 +643,7 @@ static inline int io_type_enabled(struct + } + + #define mmio_enabled(dev) io_type_enabled(dev, PCI_COMMAND_MEMORY) ++#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */ + + #if defined(CONFIG_HAS_IOPORT) && IS_ENABLED(CONFIG_USB_UHCI_HCD) + /* +@@ -724,6 +726,10 @@ reset_needed: return 1; } EXPORT_SYMBOL_GPL(uhci_check_and_reset_hc); @@ -40,22 +37,13 @@ Signed-off-by: Felix Fietkau #define pio_enabled(dev) io_type_enabled(dev, PCI_COMMAND_IO) -@@ -1304,3 +1312,4 @@ static void quirk_usb_early_handoff(stru +@@ -1304,3 +1310,4 @@ static void quirk_usb_early_handoff(stru } DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_SERIAL_USB, 8, quirk_usb_early_handoff); -+#endif ++#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */ --- a/drivers/usb/host/pci-quirks.h +++ b/drivers/usb/host/pci-quirks.h -@@ -2,7 +2,7 @@ - #ifndef __LINUX_USB_PCI_QUIRKS_H - #define __LINUX_USB_PCI_QUIRKS_H - --#ifdef CONFIG_USB_PCI_AMD -+#if defined(CONFIG_USB_PCI_AMD) && !defined(CONFIG_PCI_DISABLE_COMMON_QUIRKS) - int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *pdev); - bool usb_amd_hang_symptom_quirk(void); - bool usb_amd_prefetch_quirk(void); @@ -38,12 +38,16 @@ static inline bool usb_amd_pt_check_port #ifdef CONFIG_USB_PCI void uhci_reset_hc(struct pci_dev *pdev, unsigned long base); -- 2.47.2