Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Niklas Schnelle and committed by
Greg Kroah-Hartman
dc54ce3e be3d5a49

+18 -8
+1 -1
drivers/usb/host/uhci-hcd.c
··· 841 841 842 842 static const char hcd_name[] = "uhci_hcd"; 843 843 844 - #ifdef CONFIG_USB_PCI 844 + #if defined(CONFIG_USB_PCI) && defined(CONFIG_HAS_IOPORT) 845 845 #include "uhci-pci.c" 846 846 #define PCI_DRIVER uhci_pci_driver 847 847 #endif
+17 -7
drivers/usb/host/uhci-hcd.h
··· 505 505 * we use memory mapped registers. 506 506 */ 507 507 508 + #ifdef CONFIG_HAS_IOPORT 509 + #define UHCI_IN(x) x 510 + #define UHCI_OUT(x) x 511 + #else 512 + #define UHCI_IN(x) 0 513 + #define UHCI_OUT(x) do { } while (0) 514 + #endif 515 + 508 516 #ifndef CONFIG_USB_UHCI_SUPPORT_NON_PCI_HC 509 517 /* Support PCI only */ 510 518 static inline u32 uhci_readl(const struct uhci_hcd *uhci, int reg) ··· 547 539 548 540 #else 549 541 /* Support non-PCI host controllers */ 550 - #ifdef CONFIG_USB_PCI 542 + #if defined(CONFIG_USB_PCI) && defined(HAS_IOPORT) 551 543 /* Support PCI and non-PCI host controllers */ 552 544 #define uhci_has_pci_registers(u) ((u)->io_addr != 0) 553 545 #else ··· 595 587 static inline u32 uhci_readl(const struct uhci_hcd *uhci, int reg) 596 588 { 597 589 if (uhci_has_pci_registers(uhci)) 598 - return inl(uhci->io_addr + reg); 590 + return UHCI_IN(inl(uhci->io_addr + reg)); 599 591 else if (uhci_is_aspeed(uhci)) 600 592 return readl(uhci->regs + uhci_aspeed_reg(reg)); 601 593 #ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO ··· 609 601 static inline void uhci_writel(const struct uhci_hcd *uhci, u32 val, int reg) 610 602 { 611 603 if (uhci_has_pci_registers(uhci)) 612 - outl(val, uhci->io_addr + reg); 604 + UHCI_OUT(outl(val, uhci->io_addr + reg)); 613 605 else if (uhci_is_aspeed(uhci)) 614 606 writel(val, uhci->regs + uhci_aspeed_reg(reg)); 615 607 #ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO ··· 623 615 static inline u16 uhci_readw(const struct uhci_hcd *uhci, int reg) 624 616 { 625 617 if (uhci_has_pci_registers(uhci)) 626 - return inw(uhci->io_addr + reg); 618 + return UHCI_IN(inw(uhci->io_addr + reg)); 627 619 else if (uhci_is_aspeed(uhci)) 628 620 return readl(uhci->regs + uhci_aspeed_reg(reg)); 629 621 #ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO ··· 637 629 static inline void uhci_writew(const struct uhci_hcd *uhci, u16 val, int reg) 638 630 { 639 631 if (uhci_has_pci_registers(uhci)) 640 - outw(val, uhci->io_addr + reg); 632 + UHCI_OUT(outw(val, uhci->io_addr + reg)); 641 633 else if (uhci_is_aspeed(uhci)) 642 634 writel(val, uhci->regs + uhci_aspeed_reg(reg)); 643 635 #ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO ··· 651 643 static inline u8 uhci_readb(const struct uhci_hcd *uhci, int reg) 652 644 { 653 645 if (uhci_has_pci_registers(uhci)) 654 - return inb(uhci->io_addr + reg); 646 + return UHCI_IN(inb(uhci->io_addr + reg)); 655 647 else if (uhci_is_aspeed(uhci)) 656 648 return readl(uhci->regs + uhci_aspeed_reg(reg)); 657 649 #ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO ··· 665 657 static inline void uhci_writeb(const struct uhci_hcd *uhci, u8 val, int reg) 666 658 { 667 659 if (uhci_has_pci_registers(uhci)) 668 - outb(val, uhci->io_addr + reg); 660 + UHCI_OUT(outb(val, uhci->io_addr + reg)); 669 661 else if (uhci_is_aspeed(uhci)) 670 662 writel(val, uhci->regs + uhci_aspeed_reg(reg)); 671 663 #ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO ··· 676 668 writeb(val, uhci->regs + reg); 677 669 } 678 670 #endif /* CONFIG_USB_UHCI_SUPPORT_NON_PCI_HC */ 671 + #undef UHCI_IN 672 + #undef UHCI_OUT 679 673 680 674 /* 681 675 * The GRLIB GRUSBHC controller can use big endian format for its descriptors.