0
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2025-05-22 06:07:54 +00:00
Files
openwrt/target/linux/generic/pending-6.12/811-pci_disable_usb_common_quirks.patch
Shiji Yang 803070e07f 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: be6753dda0 ("generic: 6.12: manually rebuild pending patches")
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/18637
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-05-17 19:46:52 +02:00

64 lines
2.2 KiB
Diff

From: Felix Fietkau <nbd@nbd.name>
Date: Sat, 26 Apr 2025 21:10:40 +0200
Subject: [PATCH] debloat: disable common USB quirks
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
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
@@ -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 */
+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS
static int usb_asmedia_wait_write(struct pci_dev *pdev)
{
unsigned long retry_count;
@@ -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);
+#endif
+
+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS
+#if defined(CONFIG_HAS_IOPORT) && IS_ENABLED(CONFIG_USB_UHCI_HCD)
#define pio_enabled(dev) io_type_enabled(dev, PCI_COMMAND_IO)
@@ -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 /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */
--- a/drivers/usb/host/pci-quirks.h
+++ b/drivers/usb/host/pci-quirks.h
@@ -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);
int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base);
+#endif
+
+#if defined(CONFIG_USB_PCI) && !defined(CONFIG_PCI_DISABLE_COMMON_QUIRKS)
void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev);
void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev);
void usb_disable_xhci_ports(struct pci_dev *xhci_pdev);
#else
struct pci_dev;
static inline void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev) {}
+static inline void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev) {}
static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {}
#endif /* CONFIG_USB_PCI */