From: Pawan Gupta <writetopawan@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>, linux-gpio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Drew Fustini <drew@beagleboard.org>
Subject: [PATCH] pinctrl: core: Fix unused variable build warnings
Date: Mon, 23 Nov 2020 14:33:33 -0800 [thread overview]
Message-ID: <d1a71663e96239ced28509980ea484cadc10c80a.1606170299.git.writetopawan@gmail.com> (raw)
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 <writetopawan@gmail.com>
---
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
next reply other threads:[~2020-11-23 22:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-23 22:33 Pawan Gupta [this message]
2020-11-24 5:06 ` [PATCH] pinctrl: core: Fix unused variable build warnings Drew Fustini
2020-11-24 7:51 ` Pawan Gupta
2020-11-26 4:19 ` Drew Fustini
2020-12-01 23:06 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d1a71663e96239ced28509980ea484cadc10c80a.1606170299.git.writetopawan@gmail.com \
--to=writetopawan@gmail.com \
--cc=drew@beagleboard.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).