From: Sodagudi Prasad <psodagud@codeaurora.org>
To: linus.walleij@linaro.org, sboyd@codeaurora.org,
bjorn.andersson@linaro.org
Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-gpio@vger.kernel.org
Subject: protected pins and debugfs
Date: Wed, 03 Oct 2018 05:38:24 -0700 [thread overview]
Message-ID: <9aec322678417753fe4022691f4bfdbe@codeaurora.org> (raw)
Hi All,
This is regarding the protected pins configuration reading and printing
from non-secure operating systems.
GPIO framework is checking whether pin is in use(flag FLAG_REQUESTED) or
not in gpiolib_dbg_show().
If GPIO chip drivers are overriding the dbg_show callback, drivers are
not checking whether a pin is really in use or not to print
configuration details.
if (chip->dbg_show)
chip->dbg_show(s, chip);
else
gpiolib_dbg_show(s, gdev);
I think, reserved-gpio-ranges solution may move the problem to dts
settings maintenance as they change from platform to platform.
https://lore.kernel.org/patchwork/patch/878107/
https://lore.kernel.org/patchwork/patch/878106/
https://lore.kernel.org/patchwork/patch/878109/
Can we use a simple/common solution like below? It will check whether a
pin is in use or not before printing configuration data with the help of
gpiochip_is_requested().
index fef0970..2ca1440 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -579,16 +579,20 @@ static void msm_gpio_dbg_show_one(struct seq_file
*s,
seq_printf(s, " %-8s: %-3s %d", g->name, is_out ? "out" : "in",
func);
seq_printf(s, " %dmA", msm_regval_to_drive(drive));
seq_printf(s, " %s", pulls[pull]);
+ seq_puts(s, "\n");
}
static void msm_gpio_dbg_show(struct seq_file *s, struct gpio_chip
*chip)
{
unsigned gpio = chip->base;
unsigned i;
+ const char *label;
for (i = 0; i < chip->ngpio; i++, gpio++) {
+ label = gpiochip_is_requested(chip, i);
+ if (!label)
+ continue;
msm_gpio_dbg_show_one(s, NULL, chip, i, gpio);
- seq_puts(s, "\n");
}
}
-Thanks, Prasad
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum,
Linux Foundation Collaborative Project
next reply other threads:[~2018-10-03 12:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-03 12:38 Sodagudi Prasad [this message]
2018-10-04 8:34 ` protected pins and debugfs Linus Walleij
2018-10-08 6:04 ` Stephen Boyd
2018-10-10 19:40 ` Sodagudi Prasad
2018-10-17 2:00 ` Sodagudi Prasad
2018-10-17 7:28 ` Stephen Boyd
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=9aec322678417753fe4022691f4bfdbe@codeaurora.org \
--to=psodagud@codeaurora.org \
--cc=bjorn.andersson@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sboyd@codeaurora.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).