Re: [PATCH v4 36/41] usb: pci-quirks: handle HAS_IOPORT dependencies

From: Niklas Schnelle
Date: Tue May 30 2023 - 07:00:52 EST


On Tue, 2023-05-16 at 13:00 +0200, Niklas Schnelle wrote:
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. In the pci-quirks case the I/O port acceses are
> used in the quirks for several AMD south bridges. Move unrelated
> ASMEDIA quirks out of the way and introduce an additional config option
> for the AMD quirks that depends on HAS_IOPORT.
>
> Co-developed-by: Arnd Bergmann <arnd@xxxxxxxxxx>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxxxx>
> Signed-off-by: Niklas Schnelle <schnelle@xxxxxxxxxxxxx>
> ---
> Note: The HAS_IOPORT Kconfig option was added in v6.4-rc1 so
> per-subsystem patches may be applied independently
>
> drivers/usb/Kconfig | 10 +++
> drivers/usb/core/hcd-pci.c | 2 +
> drivers/usb/host/pci-quirks.c | 125 ++++++++++++++++++----------------
> drivers/usb/host/pci-quirks.h | 30 ++++++--
> 4 files changed, 101 insertions(+), 66 deletions(-)
>
> diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
> index 7f33bcc315f2..765093112ed8 100644
> --- a/drivers/usb/Kconfig
> +++ b/drivers/usb/Kconfig
>
---8<---
>
> static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask)
> {
> @@ -723,6 +728,7 @@ static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask)
>
> static void quirk_usb_handoff_uhci(struct pci_dev *pdev)
> {
> +#ifdef CONFIG_HAS_IOPORT
> unsigned long base = 0;
> int i;
>
> @@ -737,6 +743,7 @@ static void quirk_usb_handoff_uhci(struct pci_dev *pdev)
>
> if (base)
> uhci_check_and_reset_hc(pdev, base);

I got a kernel test robot message for the above function call being
undefined on an ARM config. Will have to investigate the details but I
think this is still missing a stub or an #ifdef here.

> +#endif /* CONFIG_HAS_IOPORT */
> }
>
> static int mmio_resource_enabled(struct pci_dev *pdev, int idx)
---8<---