Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3822066iob; Mon, 2 May 2022 06:35:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQJAVcwYinzSjbtmNWLHKC4UKFJI/OppfMTnM3ZwmkB1xH1cH5YYNhtFcxcV5LvkpgJiA7 X-Received: by 2002:a17:902:ef50:b0:156:486f:b593 with SMTP id e16-20020a170902ef5000b00156486fb593mr11635178plx.104.1651498508932; Mon, 02 May 2022 06:35:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651498508; cv=none; d=google.com; s=arc-20160816; b=oUqfcJlatqtlphBtZ3Lfa8XWxD8ORx6RKdGv7UR0AFabQeDu5xpsiLxLPHuyz7NASe z3A7HgpbCm+/ZA1wyur2Zsdq2EGoW004WYUnD6+8wtXr8hwDi/4LZQULnTmcsqYrFNGd Xq2iZrEr8rGeRCZMUhrm55+mMFDd8sGnzRpLaujClFuWIa5zdpjBN1vF8CI2IonSFKCD q8RWOQP1ZUHoBYvBJEDLvcjP8uD2w35XQU++uOOL5lBzXCqSMCgDsCy4YZd9uue7GhAC 5sBOxntfIR7lKzpr3/ugeMs2gm7XA2DJC67DyxDaq3Bhb9y91PPOs93xAjjzeP6eQQZg NdhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Kr3MHWskrV9y/doDRSTprsZnqQnuDKQHdKN+2k+Ob1Q=; b=xN6EhKFRDbLGZIFWuHGwy936odSfyahJ0qov3B3IO14SQ/wMN0uJtfG0+SEp3rLD8Q TfMXiWvQjMlAW8R7H11ll3aDvtOQz8/w482y6NV7hXoYiRhwNGFFl9drGgNxfa3MkGND bemesFlL4dr2s7xVyn2XanH9hBrYFJaYergyIPyRaU5T0WEtG2Y6H25GA4Tp5K5n/CW1 b2jfGjJGOSQvaf2MqjqSTw6qLSXek5R7KIqPGPQEM0zlTpWsdYhaqJUbgR47Nxe1cIEZ 0XJ71xppXiFBLDanVGvNCUKzvp6e5H4DwywtnPZJ/jUfJ8BSp1Vo9P9kd9WcF/XXlHYX lyOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d11-20020a170903230b00b0015874dc3247si3358735plh.170.2022.05.02.06.34.50; Mon, 02 May 2022 06:35:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241936AbiD3NAG (ORCPT + 99 others); Sat, 30 Apr 2022 09:00:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242211AbiD3NAB (ORCPT ); Sat, 30 Apr 2022 09:00:01 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 1D0CB674F0 for ; Sat, 30 Apr 2022 05:56:38 -0700 (PDT) Received: (qmail 986304 invoked by uid 1000); 30 Apr 2022 08:56:38 -0400 Date: Sat, 30 Apr 2022 08:56:38 -0400 From: Alan Stern To: Niklas Schnelle Cc: Arnd Bergmann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-pci@vger.kernel.org, Arnd Bergmann , Mathias Nyman , "open list:USB SUBSYSTEM" Subject: Re: [RFC v2 35/39] usb: handle HAS_IOPORT dependencies Message-ID: References: <20220429135108.2781579-1-schnelle@linux.ibm.com> <20220429135108.2781579-65-schnelle@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220429135108.2781579-65-schnelle@linux.ibm.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 29, 2022 at 03:51:02PM +0200, Niklas Schnelle wrote: > 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. Similarly > drivers requiring these functions need to depend on HAS_IOPORT. > > Co-developed-by: Arnd Bergmann > Signed-off-by: Niklas Schnelle > --- ... > diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c > index ef08d68b9714..4fd06b48149d 100644 > --- a/drivers/usb/host/pci-quirks.c > +++ b/drivers/usb/host/pci-quirks.c > @@ -632,7 +590,53 @@ bool usb_amd_pt_check_port(struct device *device, int port) > return !(value & BIT(port_shift)); > } > EXPORT_SYMBOL_GPL(usb_amd_pt_check_port); > +#endif > @@ -1273,7 +1280,8 @@ static void quirk_usb_early_handoff(struct pci_dev *pdev) > "Can't enable PCI device, BIOS handoff failed.\n"); > return; > } > - if (pdev->class == PCI_CLASS_SERIAL_USB_UHCI) > + if (IS_ENABLED(CONFIG_USB_UHCI_HCD) && > + pdev->class == PCI_CLASS_SERIAL_USB_UHCI) > quirk_usb_handoff_uhci(pdev); We discussed this already. quirk_usb_handoff_uhci() is supposed to be called even when CONFIG_USB_UHCI_HCD isn't enabled. ... > diff --git a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h > index 8ae5ccd26753..be4aee1f0ca5 100644 > --- a/drivers/usb/host/uhci-hcd.h > +++ b/drivers/usb/host/uhci-hcd.h > @@ -505,36 +505,43 @@ 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) > +#endif Should have a blank line here. > #ifndef CONFIG_USB_UHCI_SUPPORT_NON_PCI_HC > /* Support PCI only */ > static inline u32 uhci_readl(const struct uhci_hcd *uhci, int reg) > { > - return inl(uhci->io_addr + reg); > + return UHCI_IN(inl(uhci->io_addr + reg)); > } > > static inline void uhci_writel(const struct uhci_hcd *uhci, u32 val, int reg) > { > - outl(val, uhci->io_addr + reg); > + UHCI_OUT(outl(val, uhci->io_addr + reg)); > } > > static inline u16 uhci_readw(const struct uhci_hcd *uhci, int reg) > { > - return inw(uhci->io_addr + reg); > + return UHCI_IN(inw(uhci->io_addr + reg)); > } > > static inline void uhci_writew(const struct uhci_hcd *uhci, u16 val, int reg) > { > - outw(val, uhci->io_addr + reg); > + UHCI_OUT(outw(val, uhci->io_addr + reg)); > } > > static inline u8 uhci_readb(const struct uhci_hcd *uhci, int reg) > { > - return inb(uhci->io_addr + reg); > + return UHCI_IN(inb(uhci->io_addr + reg)); > } > > static inline void uhci_writeb(const struct uhci_hcd *uhci, u8 val, int reg) > { > - outb(val, uhci->io_addr + reg); > + UHCI_OUT(outb(val, uhci->io_addr + reg)); > } > > #else I thought you were going to update the definition of uhci_has_pci_registers(). It shouldn't do a test at runtime if CONFIG_HAS_IOPORT is disabled. Alan Stern