Received: by 10.223.185.116 with SMTP id b49csp7202414wrg; Thu, 1 Mar 2018 01:22:17 -0800 (PST) X-Google-Smtp-Source: AG47ELvUT5/R0VS34il2FIc27sPanDfndT2NrhRR1VsZ29a2xTE/lKOkPBrxcLT6qhdOrtPq7MEZ X-Received: by 2002:a17:902:b28b:: with SMTP id u11-v6mr1316135plr.146.1519896137185; Thu, 01 Mar 2018 01:22:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519896137; cv=none; d=google.com; s=arc-20160816; b=L+n7Y4Iyvv77UB6D8h4CYWY6FWb/UiFtLMCKXUh0Y1nCvw7WXM8CdSk3Ji7ArLDB5G QTS5o2SBVJVPWhczXoMBo3zY2PRzv9hCVta+2dqhPDOI2aUh7LYUA7Aw61Ampg9hhxEv sOOUjvXBCK2Kvs03kxpdS4e0pQnU2gs16Af9Bl3f1YobueP09dJg4i51uD4EdYunzy1/ YRwX/fU9x0/kEAKpH4gFNqwIX51a/PEFTvoTEJ/wRJ0dD1OSSvhCenYAXlQ0YUqU22PL iaBcXnQFxvr103Kb6LmadW/9O7Ggq0FVNT8vGRNKU+/i/sqq4HT8/mTqRbz2gosKQwwm 75ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=yOGFCl+gkZDhiUod0b7Dwmp/t7/a1CTAEKom0JdAxcs=; b=Y84BxEgAASW36tCrN9BouZt5FKFxEgCTAEooxfKoh5CpL+ghUQpSmhplnNxCUMeJ6B FGQt9v8JkV0BqTT0y7J928hL7Qm+EdbRYe5+fZTr0S1HNmY8vfRDCVBefBpIdZkXo4/z 7YVir+UFLmlnOvpj6sdhAz4oNbZKKhBhpMbfI6K79tEUDQ9z6mqngvRBDLxne4a5XCOA 6yQqoa6AeqPbRmwB2OKnwZPid0hQaw97bg/qN7CzDuigrx+lkiM69/urjhR6Wxf9nzoF asDLHWBegGjoDuIYqOC0dbHtasSWa4ys94hKVO5wPEqQsKFihkMQJnSUtogjJcSI9wCy g+LQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k9-v6si2823028plt.293.2018.03.01.01.22.02; Thu, 01 Mar 2018 01:22:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966828AbeCAJU6 (ORCPT + 99 others); Thu, 1 Mar 2018 04:20:58 -0500 Received: from guitar.tcltek.co.il ([192.115.133.116]:55193 "EHLO mx.tkos.co.il" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966724AbeCAJUz (ORCPT ); Thu, 1 Mar 2018 04:20:55 -0500 Received: from tarshish (unknown [10.0.8.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx.tkos.co.il (Postfix) with ESMTPS id A0815440524; Thu, 1 Mar 2018 11:20:51 +0200 (IST) Date: Thu, 1 Mar 2018 11:20:50 +0200 From: Baruch Siach To: Arnd Bergmann Cc: Linus Walleij , Stefan Wahren , Dave Stevenson , linux-gpio@vger.kernel.org, Linux Kernel Mailing List Subject: Re: [PATCH] gpio: raspberrypi-ext: fix firmware dependency Message-ID: <20180301092050.4yzfjmhvpwmhwzdn@tarshish> References: <20180228134822.2194009-1-arnd@arndb.de> <20180228214725.ewu3zt3l2xyxtxb2@tarshish> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnd, On Wed, Feb 28, 2018 at 11:08:54PM +0100, Arnd Bergmann wrote: > On Wed, Feb 28, 2018 at 10:47 PM, Baruch Siach wrote: > > Thanks for the fix. > > > > On Wed, Feb 28, 2018 at 02:48:08PM +0100, Arnd Bergmann wrote: > >> When the firmware driver is a loadable module, the gpio driver cannot be > >> built-in: > >> > >> drivers/gpio/gpio-raspberrypi-exp.o: In function `rpi_exp_gpio_set': > >> gpio-raspberrypi-exp.c:(.text+0xb4): undefined reference to `rpi_firmware_property' > >> drivers/gpio/gpio-raspberrypi-exp.o: In function `rpi_exp_gpio_get': > >> gpio-raspberrypi-exp.c:(.text+0x1ec): undefined reference to `rpi_firmware_property' > >> drivers/gpio/gpio-raspberrypi-exp.o: In function `rpi_exp_gpio_get_direction': > >> gpio-raspberrypi-exp.c:(.text+0x360): undefined reference to `rpi_firmware_property' > >> drivers/gpio/gpio-raspberrypi-exp.o: In function `rpi_exp_gpio_get_polarity': > >> gpio-raspberrypi-exp.c:(.text+0x4d4): undefined reference to `rpi_firmware_property' > >> drivers/gpio/gpio-raspberrypi-exp.o: In function `rpi_exp_gpio_dir_out': > >> gpio-raspberrypi-exp.c:(.text+0x670): undefined reference to `rpi_firmware_property' > >> drivers/gpio/gpio-raspberrypi-exp.o:gpio-raspberrypi-exp.c:(.text+0x7fc): more undefined references to `rpi_firmware_property' follow > >> drivers/gpio/gpio-raspberrypi-exp.o: In function `rpi_exp_gpio_dir_in': > >> drivers/gpio/gpio-raspberrypi-exp.o: In function `rpi_exp_gpio_probe': > >> gpio-raspberrypi-exp.c:(.text+0x93c): undefined reference to `rpi_firmware_get' > >> > >> We already have a Kconfig dependency for it, but when compile-testing, it > >> is disregarded. > >> > >> This changes the dependency so that compile-testing is only done when the > >> firmware driver is completely disabled. > > > > What about the CONFIG_ARCH_BCM2835=y case? The combination of > > CONFIG_GPIO_RASPBERRYPI_EXP=y and CONFIG_RASPBERRYPI_FIRMWARE=m is still > > valid. Wouldn't that break the build? > > > > Isn't there a way in Kconfig to force CONFIG_GPIO_RASPBERRYPI_EXP=m when > > CONFIG_RASPBERRYPI_FIRMWARE=m? > > The problem I ran into only happens with CONFIG_ARCH_BCM2835=y to > start with. My fix handles that case correctly, it forces > CONFIG_GPIO_RASPBERRYPI_EXP to be either 'n' or 'm' > when CONFIG_RASPBERRYPI_FIRMWARE=m. Thanks for the explanation. > > What about 'depends on m || RASPBERRYPI_FIRMWARE=y'? > > That would be (slightly) wrong, it would force CONFIG_GPIO_RASPBERRYPI_EXP > to be 'm' even if RASPBERRYPI_FIRMWARE=n. > > > Grepping around I also found this: > > > > drivers/power/supply/Kconfig: depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y' > > That is what I did here as well, except the !RASPBERRYPI_FIRMWARE > only applies for COMPILE_TEST. > > > And this: > > > > drivers/infiniband/Kconfig: depends on m || IPV6 != m > > This is a less common way to express it. The idiomatic > Kconfig expression here would be 'depends on IPV6 || !IPV6'. I find this way much easier to understand. Without the comment I would never have guessed what 'USB_GADGET || !USB_GADGET' actually means. And indeed no comment is needed in the infiniband case. > >> Fixes: a98d90e7d588 ("gpio: raspberrypi-exp: Driver for RPi3 GPIO expander via mailbox service") > >> Signed-off-by: Arnd Bergmann > >> --- > >> drivers/gpio/Kconfig | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig > >> index 2ecd2adbaec6..52a8b0a6f4e1 100644 > >> --- a/drivers/gpio/Kconfig > >> +++ b/drivers/gpio/Kconfig > >> @@ -126,7 +126,7 @@ config GPIO_RASPBERRYPI_EXP > >> tristate "Raspberry Pi 3 GPIO Expander" > >> default RASPBERRYPI_FIRMWARE > >> depends on OF_GPIO > >> - depends on (ARCH_BCM2835 && RASPBERRYPI_FIRMWARE) || COMPILE_TEST > >> + depends on (ARCH_BCM2835 && RASPBERRYPI_FIRMWARE) || (COMPILE_TEST && !RASPBERRYPI_FIRMWARE) > > > > This is really non-obvious. An inline comment here might help, IMO. > > How about > > # RASPBERRYPI_FIRMWARE is only available for ARCH_BCM2835, but we want to > # allow compile-testing when it is disabled > > ? The module vs built-in aspect is missing. That is the non-obvious part. baruch -- http://baruch.siach.name/blog/ ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -