2021-01-26 23:30:08

by Drew Fustini

[permalink] [raw]
Subject: [PATCH] pinctrl: use to octal permissions for debugfs files

Switch over pinctrl debugfs files to use octal permissions as they are
preferred over symbolic permissions. Refer to commit f90774e1fd27
("checkpatch: look for symbolic permissions and suggest octal instead").

Signed-off-by: Drew Fustini <[email protected]>
---
Patch note:
- I learned about this preference of octal over symbolic when I created
an RFC to add a new debugfs file ("pinmux-select"). I am submitting
this patch to switch existing entries in pinctrl over to octal before
I submit a proper PATCH for the "pinmux-select" functionality in which
I will use octal permissions for the new file.

drivers/pinctrl/core.c | 6 +++---
drivers/pinctrl/pinconf.c | 4 ++--
drivers/pinctrl/pinmux.c | 4 ++--
3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 9fc4433fece4..791736b2de77 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -1916,11 +1916,11 @@ static void pinctrl_init_debugfs(void)
return;
}

- debugfs_create_file("pinctrl-devices", S_IFREG | S_IRUGO,
+ debugfs_create_file("pinctrl-devices", 0400,
debugfs_root, NULL, &pinctrl_devices_fops);
- debugfs_create_file("pinctrl-maps", S_IFREG | S_IRUGO,
+ debugfs_create_file("pinctrl-maps", 0400,
debugfs_root, NULL, &pinctrl_maps_fops);
- debugfs_create_file("pinctrl-handles", S_IFREG | S_IRUGO,
+ debugfs_create_file("pinctrl-handles", 0400,
debugfs_root, NULL, &pinctrl_fops);
}

diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
index 02c075cc010b..f005921bb49e 100644
--- a/drivers/pinctrl/pinconf.c
+++ b/drivers/pinctrl/pinconf.c
@@ -370,9 +370,9 @@ DEFINE_SHOW_ATTRIBUTE(pinconf_groups);
void pinconf_init_device_debugfs(struct dentry *devroot,
struct pinctrl_dev *pctldev)
{
- debugfs_create_file("pinconf-pins", S_IFREG | S_IRUGO,
+ debugfs_create_file("pinconf-pins", 0400,
devroot, pctldev, &pinconf_pins_fops);
- debugfs_create_file("pinconf-groups", S_IFREG | S_IRUGO,
+ debugfs_create_file("pinconf-groups", 0400,
devroot, pctldev, &pinconf_groups_fops);
}

diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index bab888fe3f8e..7f6190eaedbb 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -676,9 +676,9 @@ DEFINE_SHOW_ATTRIBUTE(pinmux_pins);
void pinmux_init_device_debugfs(struct dentry *devroot,
struct pinctrl_dev *pctldev)
{
- debugfs_create_file("pinmux-functions", S_IFREG | S_IRUGO,
+ debugfs_create_file("pinmux-functions", 0400,
devroot, pctldev, &pinmux_functions_fops);
- debugfs_create_file("pinmux-pins", S_IFREG | S_IRUGO,
+ debugfs_create_file("pinmux-pins", 0400,
devroot, pctldev, &pinmux_pins_fops);
}

--
2.25.1


2021-02-12 08:03:51

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH] pinctrl: use to octal permissions for debugfs files

On Tue, Jan 26, 2021 at 5:55 AM Drew Fustini <[email protected]> wrote:

> Switch over pinctrl debugfs files to use octal permissions as they are
> preferred over symbolic permissions. Refer to commit f90774e1fd27
> ("checkpatch: look for symbolic permissions and suggest octal instead").
>
> Signed-off-by: Drew Fustini <[email protected]>

That's right. Patch applied!

Yours,
Linus Walleij

2021-02-12 17:39:37

by Drew Fustini

[permalink] [raw]
Subject: Re: [PATCH] pinctrl: use to octal permissions for debugfs files

On Fri, Feb 12, 2021 at 08:58:58AM +0100, Linus Walleij wrote:
> On Tue, Jan 26, 2021 at 5:55 AM Drew Fustini <[email protected]> wrote:
>
> > Switch over pinctrl debugfs files to use octal permissions as they are
> > preferred over symbolic permissions. Refer to commit f90774e1fd27
> > ("checkpatch: look for symbolic permissions and suggest octal instead").
> >
> > Signed-off-by: Drew Fustini <[email protected]>
>
> That's right. Patch applied!
>
> Yours,
> Linus Walleij

Thanks, Linus. However, Andy suggested I make this a series as it was
prep for my patch to add 'pinmux-select' to debugfs. I posted it as
part of a 2 patch series [1]. In addition, Joe Perches noticed I forgot
3 instances of debugfs_create_file() in core.c so I was about to fix
that in v5 of the patch series. v5 is mostly addressing comments on the
pinmux-select feature.

Thank you,
Drew

[1] https://lore.kernel.org/linux-gpio/[email protected]/

2021-02-17 18:21:47

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH] pinctrl: use to octal permissions for debugfs files

On Fri, Feb 12, 2021 at 6:37 PM Drew Fustini <[email protected]> wrote:
> On Fri, Feb 12, 2021 at 08:58:58AM +0100, Linus Walleij wrote:
> > On Tue, Jan 26, 2021 at 5:55 AM Drew Fustini <[email protected]> wrote:
> >
> > > Switch over pinctrl debugfs files to use octal permissions as they are
> > > preferred over symbolic permissions. Refer to commit f90774e1fd27
> > > ("checkpatch: look for symbolic permissions and suggest octal instead").
> > >
> > > Signed-off-by: Drew Fustini <[email protected]>
> >
> > That's right. Patch applied!
> >
> > Yours,
> > Linus Walleij
>
> Thanks, Linus. However, Andy suggested I make this a series as it was
> prep for my patch to add 'pinmux-select' to debugfs. I posted it as
> part of a 2 patch series [1]. In addition, Joe Perches noticed I forgot
> 3 instances of debugfs_create_file() in core.c so I was about to fix
> that in v5 of the patch series. v5 is mostly addressing comments on the
> pinmux-select feature.

Oh I saw that and pulled it out again, no big deal.

Yours,
Linus Walleij