mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
usb: uhci: handle HAS_IOPORT dependencies
In a future patch HAS_IOPORT=n will result in inb()/outb() and friends not being declared. We thus need to guard sections of code calling them as alternative access methods with CONFIG_HAS_IOPORT checks. For uhci-hcd there are a lot of I/O port uses that do have MMIO alternatives all selected by uhci_has_pci_registers() so this can be handled by UHCI_IN/OUT macros and making uhci_has_pci_registers() constant 0 if CONFIG_HAS_IOPORT is unset. Co-developed-by: Arnd Bergmann <arnd@kernel.org> Signed-off-by: Arnd Bergmann <arnd@kernel.org> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> Reviewed-by: Alan Stern <stern@rowland.harvard.edu> Link: https://lore.kernel.org/r/20230522105049.1467313-38-schnelle@linux.ibm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
be3d5a493b
commit
dc54ce3e60
@ -841,7 +841,7 @@ static int uhci_count_ports(struct usb_hcd *hcd)
|
||||
|
||||
static const char hcd_name[] = "uhci_hcd";
|
||||
|
||||
#ifdef CONFIG_USB_PCI
|
||||
#if defined(CONFIG_USB_PCI) && defined(CONFIG_HAS_IOPORT)
|
||||
#include "uhci-pci.c"
|
||||
#define PCI_DRIVER uhci_pci_driver
|
||||
#endif
|
||||
|
@ -505,6 +505,14 @@ static inline bool uhci_is_aspeed(const struct uhci_hcd *uhci)
|
||||
* we use memory mapped registers.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_HAS_IOPORT
|
||||
#define UHCI_IN(x) x
|
||||
#define UHCI_OUT(x) x
|
||||
#else
|
||||
#define UHCI_IN(x) 0
|
||||
#define UHCI_OUT(x) do { } while (0)
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_USB_UHCI_SUPPORT_NON_PCI_HC
|
||||
/* Support PCI only */
|
||||
static inline u32 uhci_readl(const struct uhci_hcd *uhci, int reg)
|
||||
@ -539,7 +547,7 @@ static inline void uhci_writeb(const struct uhci_hcd *uhci, u8 val, int reg)
|
||||
|
||||
#else
|
||||
/* Support non-PCI host controllers */
|
||||
#ifdef CONFIG_USB_PCI
|
||||
#if defined(CONFIG_USB_PCI) && defined(HAS_IOPORT)
|
||||
/* Support PCI and non-PCI host controllers */
|
||||
#define uhci_has_pci_registers(u) ((u)->io_addr != 0)
|
||||
#else
|
||||
@ -587,7 +595,7 @@ static inline int uhci_aspeed_reg(unsigned int reg)
|
||||
static inline u32 uhci_readl(const struct uhci_hcd *uhci, int reg)
|
||||
{
|
||||
if (uhci_has_pci_registers(uhci))
|
||||
return inl(uhci->io_addr + reg);
|
||||
return UHCI_IN(inl(uhci->io_addr + reg));
|
||||
else if (uhci_is_aspeed(uhci))
|
||||
return readl(uhci->regs + uhci_aspeed_reg(reg));
|
||||
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
|
||||
@ -601,7 +609,7 @@ static inline u32 uhci_readl(const struct uhci_hcd *uhci, int reg)
|
||||
static inline void uhci_writel(const struct uhci_hcd *uhci, u32 val, int reg)
|
||||
{
|
||||
if (uhci_has_pci_registers(uhci))
|
||||
outl(val, uhci->io_addr + reg);
|
||||
UHCI_OUT(outl(val, uhci->io_addr + reg));
|
||||
else if (uhci_is_aspeed(uhci))
|
||||
writel(val, uhci->regs + uhci_aspeed_reg(reg));
|
||||
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
|
||||
@ -615,7 +623,7 @@ static inline void uhci_writel(const struct uhci_hcd *uhci, u32 val, int reg)
|
||||
static inline u16 uhci_readw(const struct uhci_hcd *uhci, int reg)
|
||||
{
|
||||
if (uhci_has_pci_registers(uhci))
|
||||
return inw(uhci->io_addr + reg);
|
||||
return UHCI_IN(inw(uhci->io_addr + reg));
|
||||
else if (uhci_is_aspeed(uhci))
|
||||
return readl(uhci->regs + uhci_aspeed_reg(reg));
|
||||
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
|
||||
@ -629,7 +637,7 @@ static inline u16 uhci_readw(const struct uhci_hcd *uhci, int reg)
|
||||
static inline void uhci_writew(const struct uhci_hcd *uhci, u16 val, int reg)
|
||||
{
|
||||
if (uhci_has_pci_registers(uhci))
|
||||
outw(val, uhci->io_addr + reg);
|
||||
UHCI_OUT(outw(val, uhci->io_addr + reg));
|
||||
else if (uhci_is_aspeed(uhci))
|
||||
writel(val, uhci->regs + uhci_aspeed_reg(reg));
|
||||
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
|
||||
@ -643,7 +651,7 @@ static inline void uhci_writew(const struct uhci_hcd *uhci, u16 val, int reg)
|
||||
static inline u8 uhci_readb(const struct uhci_hcd *uhci, int reg)
|
||||
{
|
||||
if (uhci_has_pci_registers(uhci))
|
||||
return inb(uhci->io_addr + reg);
|
||||
return UHCI_IN(inb(uhci->io_addr + reg));
|
||||
else if (uhci_is_aspeed(uhci))
|
||||
return readl(uhci->regs + uhci_aspeed_reg(reg));
|
||||
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
|
||||
@ -657,7 +665,7 @@ static inline u8 uhci_readb(const struct uhci_hcd *uhci, int reg)
|
||||
static inline void uhci_writeb(const struct uhci_hcd *uhci, u8 val, int reg)
|
||||
{
|
||||
if (uhci_has_pci_registers(uhci))
|
||||
outb(val, uhci->io_addr + reg);
|
||||
UHCI_OUT(outb(val, uhci->io_addr + reg));
|
||||
else if (uhci_is_aspeed(uhci))
|
||||
writel(val, uhci->regs + uhci_aspeed_reg(reg));
|
||||
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
|
||||
@ -668,6 +676,8 @@ static inline void uhci_writeb(const struct uhci_hcd *uhci, u8 val, int reg)
|
||||
writeb(val, uhci->regs + reg);
|
||||
}
|
||||
#endif /* CONFIG_USB_UHCI_SUPPORT_NON_PCI_HC */
|
||||
#undef UHCI_IN
|
||||
#undef UHCI_OUT
|
||||
|
||||
/*
|
||||
* The GRLIB GRUSBHC controller can use big endian format for its descriptors.
|
||||
|
Loading…
Reference in New Issue
Block a user