All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dwaipayan Ray <dwaipayanray1@gmail.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [Linux-kernel-mentees] [PATCH] leds: convert symbolic permission bit macros to octal
Date: Sat, 12 Dec 2020 23:40:44 +0530	[thread overview]
Message-ID: <CABJPP5D=fti+4R6wYQnCH04uBPJgVThYAGTqO+t2C1CAVtQPTQ@mail.gmail.com> (raw)
In-Reply-To: <X9UDC9YNCnxCf0w/@kroah.com>

On Sat, Dec 12, 2020 at 11:19 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Sat, Dec 12, 2020 at 09:05:17PM +0530, Dwaipayan Ray wrote:
> > Symbolic macro names are hard to understand and should not be
> > used for permission bits.
> >
> > Convert all bad symbolic permission bit macro uses in led to just use
> > the octal numbers.
> >
> > Following macros were replaced:
> >
> > S_IRUGO => 0444
> > S_IWUSR => 0200
> > S_IRUGO | S_IWUSR => 0644
> >
> > Link: https://lore.kernel.org/lkml/CA+55aFw5v23T-zvDZp-MmD_EYxF8WbafwwB59934FV7g21uMGQ@mail.gmail.com/
> >
> > Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
> > ---
> >  drivers/leds/leds-blinkm.c        | 8 ++++----
> >  drivers/leds/leds-lm355x.c        | 2 +-
> >  drivers/leds/leds-lm3642.c        | 4 ++--
> >  drivers/leds/leds-lp55xx-common.h | 6 +++---
> >  4 files changed, 10 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/leds/leds-blinkm.c b/drivers/leds/leds-blinkm.c
> > index e11fe1788242..6b9b13f58d8a 100644
> > --- a/drivers/leds/leds-blinkm.c
> > +++ b/drivers/leds/leds-blinkm.c
> > @@ -209,7 +209,7 @@ static ssize_t store_red(struct device *dev, struct device_attribute *attr,
> >       return count;
> >  }
> >
> > -static DEVICE_ATTR(red, S_IRUGO | S_IWUSR, show_red, store_red);
> > +static DEVICE_ATTR(red, 0644, show_red, store_red);
>
> Why not use DEVICE_ATTR_RW() instead?  THat would handle all of this
> automatically for you, which is why they are recommended to be used
> instead.
>
> thanks,
>
> greg k-h

Thanks Greg, I will do that.

Seems like the led drivers are still using a lot of those old constructs.
leds$ git grep -P "DEVICE_ATTR\(" | wc -l
          31

Will correct them all.

Thank you,
Dwaipayan.
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

      reply	other threads:[~2020-12-12 18:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-12 15:35 [Linux-kernel-mentees] [PATCH] leds: convert symbolic permission bit macros to octal Dwaipayan Ray
2020-12-12 17:51 ` Greg KH
2020-12-12 18:10   ` Dwaipayan Ray [this message]

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='CABJPP5D=fti+4R6wYQnCH04uBPJgVThYAGTqO+t2C1CAVtQPTQ@mail.gmail.com' \
    --to=dwaipayanray1@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.