Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp4340518rwb; Mon, 16 Jan 2023 22:40:38 -0800 (PST) X-Google-Smtp-Source: AMrXdXs+uhjntl6FJvqi4GL5AAyBe5eAH1TiIj8hxr2moWUgKYlhBU/lfZ0acbK0zBiA3eQBrm9t X-Received: by 2002:a17:90b:3b4a:b0:229:91f7:8476 with SMTP id ot10-20020a17090b3b4a00b0022991f78476mr3223150pjb.10.1673937638447; Mon, 16 Jan 2023 22:40:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673937638; cv=none; d=google.com; s=arc-20160816; b=quL6jbiSX+SDJ0oGUirrnjmvCuKapAisJvUd6ygbkqDX5BbpxJIR+wLXIDGbSjXFMH LHFKVhFIVKFKyLK8Dmlyf9GWYGeZ+8v1zHTlO62ztnriZnXgioUs8vtbNeyKy8/epUdB /IQqQJUcwdW24LnhHLvt4QywzcBER3lF2N9W1F0D5jerDl+dGTMkC7q+SZHp7Zs+j+bb O2XH4Yl9WQoH/ZVziZIo2DcuGtwqJJtKaYKLYL27UbJ2dtMzBMme0izzaf0jOxBbI/oO ErBhu7Yv15zJa0Nc7hAxKj7WhPRlqzFOC/6UI29i62BvElzmALYBQVG17uZaGoekJ2w+ sG3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature:dkim-signature; bh=jWGEQrSNu7n2i51Jq6UVFISoxARap5AIdYbs2OqP5L0=; b=QKnO/zfCTJohwmnvJj/5DOqLpvaEc3FRlFJaAMHydlce8yEEJR78vIVfEatdDJJw8+ Ou0GcpSozdW2I23fzud4ANIrpMzW0kwqvwT7qKZeNKPbhIJvWIv/+u/V9wKQ6SCtrUCI eZ+pZvn1xXeaikIJleCcOh5tJRirSBHdyCKEMRr143EsULB+cNB1b6DurjFBPi9C+ysM OtiVWEOQTcaP0Hch/5T6zcKVALcJENpHwEA4YBBG+uCrJsWkBiPo47m6WzkMaGfGeAaR A+2oM+h887dESlm6UiltrpAOpre3HLtnk97otQvn7nxTz1STPTP+3D3zBlYxyNeGkWVu rw9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=FlqlV5nz; dkim=pass header.i=@tq-group.com header.s=key1 header.b=m0be11Co; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oj10-20020a17090b4d8a00b00225c0b4ebdfsi10188257pjb.148.2023.01.16.22.40.32; Mon, 16 Jan 2023 22:40:38 -0800 (PST) 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; dkim=pass header.i=@tq-group.com header.s=key1 header.b=FlqlV5nz; dkim=pass header.i=@tq-group.com header.s=key1 header.b=m0be11Co; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235245AbjAQG0N (ORCPT + 50 others); Tue, 17 Jan 2023 01:26:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235730AbjAQGZx (ORCPT ); Tue, 17 Jan 2023 01:25:53 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE2D728870; Mon, 16 Jan 2023 22:23:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1673936634; x=1705472634; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jWGEQrSNu7n2i51Jq6UVFISoxARap5AIdYbs2OqP5L0=; b=FlqlV5nzu8DHgxwOe1OvB/0Y6YBH9fgKU1dMaErLxiLNAbACwg8g1cNJ QfvuyhrnRfCN9YqCeg8sbD8jwfda1zkE9iotPV4F2vS0i3JQv9fQYCcfs SkY5Sa2eWQgHJuvWrm7XYLDnkQjlHvNI8tZJOTUXsaSlJry8IiLeMpbeu CNk3KYL1+drVxMp/FlS3mvD7U41+UA97Nsnesu8n5aCZrqjuSqzos6hkG uCA2hjVbBwP+rK6sAslMtMuXdWQV2kfug+uq5Rwd6PRG4vz03V7r2y1Ig 2EjSBZnKhwyV9mvQ5n1gwF9MuQ/3VnwgzH9KfzNuQPvUZkRWZbKL4HO4/ A==; X-IronPort-AV: E=Sophos;i="5.97,222,1669071600"; d="scan'208";a="28463337" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 17 Jan 2023 07:23:51 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Tue, 17 Jan 2023 07:23:52 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Tue, 17 Jan 2023 07:23:52 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1673936632; x=1705472632; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jWGEQrSNu7n2i51Jq6UVFISoxARap5AIdYbs2OqP5L0=; b=m0be11CoRRQvfhuFAVnvJisVlfyuZq66KFfztmTheD6PXddQ+mr7FP8l lEUDnDhEicsDg25cyGhlrbx487d/5Mr/+CBgardLiiaj4NG8bEihTQHM0 wjjvzehvFyXFPPodM3F2okPP4XDZVXVHv7k6XyDkPEmPO0IK4soMHQpKD fX0ZO1hjMMN9nbMwZ7wyuxbifWSIqPN0Gwk3KaQxcCLoQjqPFCz+Kwlcc nz/UjNzrQcWD5V3ShKUoqOnO6V1HJk+pRu+w51S8Q2m2pQjOzNFsPEJdU 5MQRWym3IndWjPYvnj1uMog5kLBGgzi9jzmTADDsNF+o2RwLk6jG8pvYY A==; X-IronPort-AV: E=Sophos;i="5.97,222,1669071600"; d="scan'208";a="28463336" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 17 Jan 2023 07:23:51 +0100 Received: from steina-w.localnet (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id ADEDF280056; Tue, 17 Jan 2023 07:23:51 +0100 (CET) From: Alexander Stein To: linus.walleij@linaro.org, brgl@bgdev.pl, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Pierluigi Passaro Cc: eran.m@variscite.com, nate.d@variscite.com, francesco.f@variscite.com, pierluigi.p@variscite.com, pierluigi.passaro@gmail.com, kernel test robot Subject: Re: [PATCH] gpiolib: fix linker errors when GPIOLIB is disabled Date: Tue, 17 Jan 2023 07:23:50 +0100 Message-ID: <2403894.jE0xQCEvom@steina-w> Organization: TQ-Systems GmbH In-Reply-To: <20230116140811.27201-1-pierluigi.p@variscite.com> References: <20230116140811.27201-1-pierluigi.p@variscite.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Hi, Am Montag, 16. Januar 2023, 15:08:11 CET schrieb Pierluigi Passaro: > Both the functions gpiochip_request_own_desc and > gpiochip_free_own_desc are exported from > drivers/gpio/gpiolib.c > but this file is compiled only when CONFIG_GPIOLIB is enabled. > Move the protototypes under "#ifdef CONFIG_GPIOLIB" and provide > reasonable definitions in the "#else" branch. > > Signed-off-by: Pierluigi Passaro > Reported-by: kernel test robot > --- > include/linux/gpio/driver.h | 20 ++++++++++++++++++-- > 1 file changed, 18 insertions(+), 2 deletions(-) > > diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h > index 44783fc16125..ed77c6fc0beb 100644 > --- a/include/linux/gpio/driver.h > +++ b/include/linux/gpio/driver.h > @@ -758,6 +758,8 @@ gpiochip_remove_pin_ranges(struct gpio_chip *gc) > > #endif /* CONFIG_PINCTRL */ > > +#ifdef CONFIG_GPIOLIB > + > struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *gc, > unsigned int hwnum, > const char *label, > @@ -765,8 +767,6 @@ struct gpio_desc *gpiochip_request_own_desc(struct > gpio_chip *gc, enum gpiod_flags dflags); > void gpiochip_free_own_desc(struct gpio_desc *desc); > > -#ifdef CONFIG_GPIOLIB > - > /* lock/unlock as IRQ */ > int gpiochip_lock_as_irq(struct gpio_chip *gc, unsigned int offset); > void gpiochip_unlock_as_irq(struct gpio_chip *gc, unsigned int offset); > @@ -776,6 +776,22 @@ struct gpio_chip *gpiod_to_chip(const struct gpio_desc > *desc); > > #else /* CONFIG_GPIOLIB */ > > +static inline struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip > *gc, + unsigned int hwnum, > + const char *label, > + enum gpio_lookup_flags lflags, > + enum gpiod_flags dflags) > +{ > + /* GPIO can never have been requested */ > + WARN_ON(1); This will raise the warning on each invocation. How about using WARN_ON_ONCE(1), or even WARN_ONCE("Kernel compiled without CONFIG_GPIOLIB support")? > + return ERR_PTR(-ENODEV); > +} > + > +static inline void gpiochip_free_own_desc(struct gpio_desc *desc) > +{ > + WARN_ON(1); Same as above. Best regards, Alexander > +} > + > static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc) > { > /* GPIO can never have been requested */