Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3850608pxj; Mon, 21 Jun 2021 07:59:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx532gHewtd5CEqPH/Xi/ECqQzDiV/lIS0Epj1Sj7dkvr2DE0DV1nNB+lXj244JdY16Rw64 X-Received: by 2002:a05:6402:11cc:: with SMTP id j12mr22351816edw.114.1624287550809; Mon, 21 Jun 2021 07:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624287550; cv=none; d=google.com; s=arc-20160816; b=AV/HbtpbyKX0dUl8OMru1wAr+9yv3q6Ek038D6b8p+ky/iQS3fyIqPugSDTc94l+VY 6HfOhnzVQidgYuVdduTexqplueAkvQPKWe8wnDZXY0e5mkYuaosv5TJx/UBiCy1c/X5x aWSYFpSiC1XRlaHk44Ptp/qo58DSfXsGKpXzb2w5rSYTZKHYNtTMWXyVq7VsOORxftxa 6tgj/S31HCQJpwJ4Y/fpmUkGiVGuVKwxZRq78SUp2mYUyTUpWALXT+DUCYSo+CbgBdf/ Ugy8sUiE4xb0zEgETBWpzFCQt5+r/DHzD+6Waqoh+JM9SQ2UBPwtjKYctYNILtnUiswp FFvQ== 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:dkim-signature; bh=YKWX9E78t5VwiKzBY9j3I258nFLcqGeYwXCUvNxpHeY=; b=fLSJ1tjifYOcXtClpK3Ie/d1KgSk4JEGIejr8qeTNjxb+RHBdk99HQIinQ8F8EY+a0 WdXwleYh1FyZ/K6XQNk8el+khX8dkQbgQq0oaMgoYvZvf3TqeMmj4kijuCJbJxjuBYVt 7peU4Gr/JmBInTEKlFQLduA9VD9UNobQ/1FzPCB+o4dYAbk2XwM3dohnQ9dw8Ze5nwFQ f0cKxb6DQzCQ5GBo1bsNoQjsSK56fJ40ymB6i6RIgPAVudNBvEV4z+8O5vvWMlmiREqq EvuaMmF2usXReUpWOQd7eFn2VcEoArdOUmNdb7Fr7D7NX+khMJOUwuvi4k8X4vlj2UF5 q9/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NNtwhS+q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t12si19467131edc.333.2021.06.21.07.58.47; Mon, 21 Jun 2021 07:59:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NNtwhS+q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229789AbhFUO5s (ORCPT + 99 others); Mon, 21 Jun 2021 10:57:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229747AbhFUO5r (ORCPT ); Mon, 21 Jun 2021 10:57:47 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C62FC061756 for ; Mon, 21 Jun 2021 07:55:33 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id n12so5624915pgs.13 for ; Mon, 21 Jun 2021 07:55:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=YKWX9E78t5VwiKzBY9j3I258nFLcqGeYwXCUvNxpHeY=; b=NNtwhS+qRYpytkcyBCNgt1UcEVyjek7CJcDS70ngdaOxQCQZYiARvL2e+MfvoluGGO zsg2Jnufj4cxJ6nbEz06tmc5TppuVBOnAXhqKA5Yp4ObhepOEEBDEML1wdXNkA98SEmn Bw3jYtj8nxec7iq+S0kz63VqyxO/odwOLup6M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=YKWX9E78t5VwiKzBY9j3I258nFLcqGeYwXCUvNxpHeY=; b=O9RCxjiW96Md3RJgo09ENOKhKx1I1uWAFzfLCeW2rX0tOOR0oME22xu/b/IO/W3Xns erG/DeL+0FaE5e4lkm70TpH1bvYTWiktaLsYmAZ6TL2E/tupBmJKTfZl+9BUo49BAiLA Obv90H6Dy5UQaM3C/oO8hdJMq+sh1MFQO1RkW7iplyS8WcWLa1JeUKiMxWvyUkERO/n9 EkopDZkQYU70bOUrnCtXdF5wc9kxD6cbnyvYIz6BW25sU0d+FV8Q9wwKy7+dQEeKJRof 1n7IguZ/zoEifExaQtoOWKgd7E4BnsyCdx9iAnRglLX3eYTej6Yr51UA2NOxykfoAFCo RpZg== X-Gm-Message-State: AOAM533GmuNw0dMfw8SIJcnzkD+tK+WHNtuVPI5lahvAL+H4sjTS161G csxXZFkk/bWS+S1diywCHmOzXw== X-Received: by 2002:a63:4b52:: with SMTP id k18mr24663845pgl.190.1624287332943; Mon, 21 Jun 2021 07:55:32 -0700 (PDT) Received: from localhost ([2620:15c:202:201:9f0f:4fd2:adeb:6f55]) by smtp.gmail.com with UTF8SMTPSA id u1sm15418681pfu.160.2021.06.21.07.55.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Jun 2021 07:55:32 -0700 (PDT) Date: Mon, 21 Jun 2021 07:55:30 -0700 From: Matthias Kaehlcke To: Masahiro Yamada Cc: Linux Kbuild mailing list , Linux Kernel Mailing List , Greg Kroah-Hartman , Douglas Anderson Subject: Re: Looking for help with Kconfig dependencies Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 19, 2021 at 10:30:22AM +0900, Masahiro Yamada wrote: > On Sat, Jun 19, 2021 at 2:05 AM Matthias Kaehlcke wrote: > > > > Hi, > > > > I'm adding a new driver and have an issue with Kconfig dependencies > > that I coulnd't sort out so far. > > > > Patch https://lore.kernel.org/patchwork/patch/1444212/ adds the new > > onboard_usb_hub driver which exports two functions, > > onboard_hub_create_pdevs() and onboard_hub_destroy_pdevs(). It also > > provides stubs for these functions which are used when the driver > > is not selected (CONFIG_USB_ONBOARD_HUB=n). > > > > The new exported functions are called by the xhci-plat driver > > (https://lore.kernel.org/patchwork/patch/1444215/). Since xhci-plat > > now depends on symbols from the onboard_hub_driver the following > > dependency was added to its Kconfig entry: > > > > config USB_XHCI_PLATFORM > > tristate "Generic xHCI driver for a platform device" > > select USB_XHCI_RCAR if ARCH_RENESAS > > + depends on USB_ONBOARD_HUB || !USB_ONBOARD_HUB > > > > This generally seems to work, however when USB_XHCI_PLATFORM is > > forced to be builtin by another driver that depends on it (e.g. > > USB_DWC3) it is still possible to build the onboard_hub driver > > as a module, which results in unresolved symbols: > > > > aarch64-linux-gnu-ld: drivers/usb/host/xhci-plat.o: in function > > `xhci_plat_remove': > > drivers/usb/host/xhci-plat.c:427: undefined reference to > > `onboard_hub_destroy_pdevs' > > drivers/usb/host/xhci-plat.c:427:(.text+0x82c): relocation truncated > > to fit: R_AARCH64_CALL26 against undefined symbol > > `onboard_hub_destroy_pdevs' > > aarch64-linux-gnu-ld: drivers/usb/host/xhci-plat.o: in function > > `xhci_plat_probe': > > drivers/usb/host/xhci-plat.c:379: undefined reference to > > `onboard_hub_create_pdevs' > > drivers/usb/host/xhci-plat.c:379:(.text+0x131c): relocation truncated > > to fit: R_AARCH64_CALL26 against undefined symbol > > `onboard_hub_create_pdevs' > > > > Kconfig generates the following warning with this configuration: > > > > WARNING: unmet direct dependencies detected for USB_XHCI_PLATFORM > > Depends on [m]: USB_SUPPORT [=y] && USB [=y] && USB_XHCI_HCD [=y] && (USB_ONBOARD_HUB [=m] || !USB_ONBOARD_HUB [=m]) > > Selected by [y]: > > - USB_DWC3 [=y] && USB_SUPPORT [=y] && (USB [=y] || USB_GADGET [=y]) && HAS_DMA [=y] && USB_XHCI_HCD [=y] > > Selected by [m]: > > - USB_CDNS_SUPPORT [=m] && USB_SUPPORT [=y] && (USB [=y] || USB_GADGET [=y]) && HAS_DMA [=y] && USB_XHCI_HCD [=y] > > - USB_BRCMSTB [=m] && USB_SUPPORT [=y] && USB [=y] && (ARCH_BRCMSTB [=y] && PHY_BRCM_USB [=m] || COMPILE_TEST [=y]) && USB_XHCI_HCD [=y] > > - USB_XHCI_MVEBU [=m] && USB_SUPPORT [=y] && USB [=y] && USB_XHCI_HCD [=y] && HAS_IOMEM [=y] && (ARCH_MVEBU [=y] || COMPILE_TEST [=y]) > > > > I read through kconfig-language.rst and experimented a fair bit, > > but haven't found a working solution. Any advice would be > > appreciated. > > > > Thanks > > > > Matthias > > > > This issue should be discussed in the USB ML, That's where it was initially brought up, but it didn't get the attention of anyone in the position to give advice. Since the issue is more about kbuild dependencies than USB specifically I brought it up here. The driver already landed in the USB tree but was reverted due to this issue, I'm stuck on this problem and really don't want the driver to die on the finish line. A workaround could be to make the driver 'bool' rather than 'tristate', but I'm not sure if that would be acceptable. > but probably 'depends on USB_XHCI_PLATFORM' should be used everywhere instead of > 'depends on USB_XHCI_PLATFORM'. Did you mean 'select USB_XHCI_PLATFORM' rather than 'depends on USB_XHCI_PLATFORM'? In general that sounds reasonable, since the drivers don't actually depend on USB_XHCI_PLATFORM from a build perspective, and it's what some drivers actually do. However it doesn't fix the problem, apparently a 'select X' from CONFIG_Y still results in CONFIG_X being 'y' if CONFIG_Y is 'y' (see the USB_DWC3 case above).