From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F974C63777 for ; Thu, 26 Nov 2020 04:19:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2653F21973 for ; Thu, 26 Nov 2020 04:19:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=beagleboard-org.20150623.gappssmtp.com header.i=@beagleboard-org.20150623.gappssmtp.com header.b="KzfA6Uix" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387564AbgKZETN (ORCPT ); Wed, 25 Nov 2020 23:19:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387554AbgKZETM (ORCPT ); Wed, 25 Nov 2020 23:19:12 -0500 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 494B4C0613D4 for ; Wed, 25 Nov 2020 20:19:11 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id l17so629630pgk.1 for ; Wed, 25 Nov 2020 20:19:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beagleboard-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=Rpn93xyHdtfENnB9aPQg9YqgzSxRxwjIcf8Cx2Aw6ww=; b=KzfA6UixuIRy9YpElltDdqwk2yfBpMvK4InTPHVxb2DKTdzm+T/3lMkDfNP090J/US aG5r4XgrvAQ4V1USt6D6FcvRATGhVHudbruItrARRWt4jU450scBjIvNcXmXCpTGsj6f 0XgpTRs6ipDfObLv2CaNcIGeGPHWoql6is/qw6Mkxl2lzxJ4tL6Dhq/H7jMkQmWPj2dX SxCVQETd/9zLvcfaUoSrsuPTnJ3r7tyq8NlCAzL/ngYncJ8D+3FUS6ghjzWYLpz2L2i3 0DxOl98ryJI8wHAAVOPR0+hY4iG9lyb7OCiUQay/fUOsiAbTWPa+yoHDoRtpgjHPmLye gS+Q== 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:content-transfer-encoding :in-reply-to; bh=Rpn93xyHdtfENnB9aPQg9YqgzSxRxwjIcf8Cx2Aw6ww=; b=lB2wdjATjEbALedXK94rzztaeD2nVhCA+5BmQW7kT58H1o6J6OmQSIrizoCiNJOrpm UaLXtIryi7xBWc19npVHZl/HdsV+Y4SO/pvN25twWv0c4EXAr12xHHgh1Q0NE3+P1+5A r1axFaXYKuiMbas6fL3eG2xON8RMnlZ8LpiSUcuGcQPtPpEZMOHVwrq62gmieD3KisZ0 sQ75P1AHdzDPhIfQLFi97vCDBpU96r9kfDBC46eQ/wdZ2FFmhzmE+nRSq4nf6O/5epMO Mg9L5tJujEVbKB1eIuMRul+aCKUimpW7zOjB/U4hSes3C8R4rvt7RsRNG+6iM5J7XbLE uKUA== X-Gm-Message-State: AOAM5305zBZaxWhCOh0TqyPt1NchIM1FceaffWQr9VsZVjRo/BQCPoCa gzpJFSLr4rFhHW5LCERoZ7WAPz2rqVofmw== X-Google-Smtp-Source: ABdhPJwFW97K6R+OFJRII5EMZIBZoUx7TnX2r1rh+kuNeSDWcHFbYBYkyIWy5rzp5848SCALwZ9bKA== X-Received: by 2002:a17:90a:2c47:: with SMTP id p7mr1428721pjm.48.1606364350732; Wed, 25 Nov 2020 20:19:10 -0800 (PST) Received: from x1 ([2601:1c0:4701:ae70:df19:3df8:ea8b:660d]) by smtp.gmail.com with ESMTPSA id p14sm4320595pjo.53.2020.11.25.20.19.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2020 20:19:10 -0800 (PST) Date: Wed, 25 Nov 2020 20:19:08 -0800 From: Drew Fustini To: Pawan Gupta Cc: Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] pinctrl: core: Fix unused variable build warnings Message-ID: <20201126041908.GA420140@x1> References: <20201124050618.GA337876@x1> <20201124075129.GA1339@guptapadev.amr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201124075129.GA1339@guptapadev.amr> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 23, 2020 at 11:51:29PM -0800, Pawan Gupta wrote: > On Mon, Nov 23, 2020 at 09:06:18PM -0800, Drew Fustini wrote: > > On Mon, Nov 23, 2020 at 02:33:33PM -0800, Pawan Gupta wrote: > > > A recent commit f1b206cf7c57 ("pinctrl: core: print gpio in pins debugfs > > > file") added build warnings when CONFIG_GPIOLIB=n. Offcourse the kernel > > > fails to build when warnings are treated as errors. Below is the error > > > message: > > > > > > $ make CFLAGS_KERNEL+=-Werror > > > > > > drivers/pinctrl/core.c: In function ‘pinctrl_pins_show’: > > > drivers/pinctrl/core.c:1607:20: error: unused variable ‘chip’ [-Werror=unused-variable] > > > 1607 | struct gpio_chip *chip; > > > | ^~~~ > > > drivers/pinctrl/core.c:1606:15: error: unused variable ‘gpio_num’ [-Werror=unused-variable] > > > 1606 | unsigned int gpio_num; > > > | ^~~~~~~~ > > > drivers/pinctrl/core.c:1605:29: error: unused variable ‘range’ [-Werror=unused-variable] > > > 1605 | struct pinctrl_gpio_range *range; > > > | ^~~~~ > > > cc1: all warnings being treated as errors > > > > > > These variables are only used inside #ifdef CONFIG_GPIOLIB, fix the > > > build warnings by wrapping the definition inside the config. > > > > > > Fixes: f1b206cf7c57 ("pinctrl: core: print gpio in pins debugfs file") > > > Signed-off-by: Pawan Gupta > > > --- > > > drivers/pinctrl/core.c | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c > > > index 3663d87f51a0..1bb371a5cf8d 100644 > > > --- a/drivers/pinctrl/core.c > > > +++ b/drivers/pinctrl/core.c > > > @@ -1602,10 +1602,11 @@ static int pinctrl_pins_show(struct seq_file *s, void *what) > > > struct pinctrl_dev *pctldev = s->private; > > > const struct pinctrl_ops *ops = pctldev->desc->pctlops; > > > unsigned i, pin; > > > +#ifdef CONFIG_GPIOLIB > > > struct pinctrl_gpio_range *range; > > > unsigned int gpio_num; > > > struct gpio_chip *chip; > > > - > > > +#endif > > > seq_printf(s, "registered pins: %d\n", pctldev->desc->npins); > > > > > > mutex_lock(&pctldev->mutex); > > > -- > > > 2.21.3 > > > > > > > Thanks for pointing this out. I don't have any systems where I build > > without CONFIG_GPIOLIB so I missed this. > > > > I'm having trouble figuring out a .config that will reproduce this. I > > tried tinyconfig but it compiled clean. > > Just setting CONFIG_GPIOLIB=n via menuconfig is not an option? Have you > tried x86? There were other options related to pinctrl both for my ARM board and my laptop that were forcing GPIOLIB to stay on. > > > Could you share your .config? > > Attaching the .config that reproduces the build warning. Thanks. I was able to reproduce the error with your config. I applied your patch and it did resolve the error for me. Reviewed-by: Drew Fustini