Re: protected pins and debugfs
From: Linus Walleij
Date: Thu Oct 04 2018 - 04:34:19 EST
On Wed, Oct 3, 2018 at 2:38 PM Sodagudi Prasad <psodagud@xxxxxxxxxxxxxx> wrote:
> This is regarding the protected pins configuration reading and printing
> from non-secure operating systems.
I do not think anyone with security in mind should have debugfs
enabled. But maybe that is beside the point.
> 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);
Ah that is right. Because some drivers can inspect all pins whether they
are requested or not.
> 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().
In the msm case I think maybe you want to inspect the valid_mask
instead, so you display debugfs info for all pins you can inspect
in hardware but avoid the "invalid" ones which I half-guess is used
by ACPI in your case.
Yours,
Linus Walleij