Re: [PATCH] pwm: core: Use octal permission

From: Soham Biswas
Date: Wed Nov 18 2020 - 12:40:37 EST


On Wed, 18 Nov 2020 at 22:26, Uwe Kleine-König
<u.kleine-koenig@xxxxxxxxxxxxxx> wrote:
>
> On Wed, Nov 18, 2020 at 02:46:54PM +0000, Lee Jones wrote:
> > On Wed, 18 Nov 2020, Uwe Kleine-König wrote:
> >
> > > On Wed, Nov 18, 2020 at 07:36:28PM +0530, Soham Biswas wrote:
> > > > On Wed, 18 Nov 2020 at 19:29, Soham Biswas <sohambiswas41@xxxxxxxxx> wrote:
> > > > >
> > > > > Permission bits are easier readable in octal than with using the symbolic names.
> > > > >
> > > > > Fixes the following warning generated by checkpatch:
> > > > >
> > > > > drivers/pwm/core.c:1341: WARNING: Symbolic permissions 'S_IRUGO' are not preferred.
> > > > > Consider using octal permissions '0444'.
> > > > >
> > > > > +debugfs_create_file("pwm", S_IFREG | S_IRUGO, NULL, NULL,
> > > > > &pwm_debugfs_fops);
> > > > >
> > > > > Signed-off-by: Soham Biswas <sohambiswas41@xxxxxxxxx>
> > > > > ---
> > > > > drivers/pwm/core.c | 2 +-
> > > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
> > > > > index 1f16f5365d3c..a8eff4b3ee36 100644
> > > > > --- a/drivers/pwm/core.c
> > > > > +++ b/drivers/pwm/core.c
> > > > > @@ -1338,7 +1338,7 @@ DEFINE_SEQ_ATTRIBUTE(pwm_debugfs);
> > > > >
> > > > > static int __init pwm_debugfs_init(void)
> > > > > {
> > > > > - debugfs_create_file("pwm", S_IFREG | S_IRUGO, NULL, NULL,
> > > > > + debugfs_create_file("pwm", S_IFREG | 0444, NULL, NULL,
> > > > > &pwm_debugfs_fops);
> > > > >
> > > > > return 0;
> > > > >
> > > >
> > > > I passed -v3 to git-send-email but it didn't work it seems.
> > >
> > > It only works if you use it with a commit range I guess, i.e. when it
> > > calls git-format-patch itself.
> > >
> > > Also I think if you call checkpatch on your own patch (e.g. using:
> > >
> > > git format-patch -v3 --stdout | scripts/checkpatch.pl
> > >
> > > ) it will tell you to break the long line in the commit log.
> >
> > That's funny! Although you can safely ignore that one.
> >
> > I find it's better to keep errors/warnings whole.
>
> Yes, so please don't ignore that warning for:
>
> Permission bits are easier readable in octal than with using the symbolic names.
>
> Best regards
> Uwe
>
> --
> Pengutronix e.K. | Uwe Kleine-König |
> Industrial Linux Solutions | https://www.pengutronix.de/ |

I did fix that warning and ran the checkpatch script on my patch and
it said that there were no errors or style problems.