[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171214062117.GA8758@mordor.localdomain>
Date: Thu, 14 Dec 2017 11:51:17 +0530
From: Aishwarya Pant <aishpant@...il.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
julia.lawall@...6.fr
Subject: Re: [PATCH] staging: fbtft: replace __ATTR() with DEVICE_ATTR()
On Wed, Dec 13, 2017 at 12:50:00PM +0100, Greg Kroah-Hartman wrote:
> On Mon, Dec 11, 2017 at 03:24:30PM +0530, Aishwarya Pant wrote:
> > This is a clean-up patch which replaces the uses of raw __ATTR(...)
> > macro with the more conventional DEVICE_ATTR(...) for defining device
> > attributes.
> >
> > Done using coccinelle-
> >
> > @r@
> > identifier foo, n;
> > @@
> >
> > struct device_attribute foo = __ATTR(n, ...);
> >
> > @script:python p@
> > id;
> > foo << r.foo;
> > n << r.n;
> > @@
> >
> > // standardise the variable name to dev_attr_{name}
> > coccinelle.id = "dev_attr_" + n
> >
> > @@
> > identifier r.foo;
> > declarer name DEVICE_ATTR;
> > @@
> >
> > //change definition
> > - struct device_attribute foo = __ATTR
> > + DEVICE_ATTR
> > (...);
> >
> > @depends on r@
> > identifier r.foo, p.id;
> > @@
> >
> > // replace usages everywhere
> > - foo
> > + id
> >
> > Signed-off-by: Aishwarya Pant <aishpant@...il.com>
> > ---
> > drivers/staging/fbtft/fbtft-sysfs.c | 7 +++----
> > 1 file changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/staging/fbtft/fbtft-sysfs.c b/drivers/staging/fbtft/fbtft-sysfs.c
> > index 712096659aa0..506d604d01bb 100644
> > --- a/drivers/staging/fbtft/fbtft-sysfs.c
> > +++ b/drivers/staging/fbtft/fbtft-sysfs.c
> > @@ -197,19 +197,18 @@ static ssize_t show_debug(struct device *device,
> > return snprintf(buf, PAGE_SIZE, "%lu\n", par->debug);
> > }
> >
> > -static struct device_attribute debug_device_attr =
> > - __ATTR(debug, 0660, show_debug, store_debug);
> > +static DEVICE_ATTR(debug, 0660, show_debug, store_debug);
>
> This should be DEVICE_ATTR_RW(), right? 0660 makes no sense...
If it doesn't make sense here, I can replace it with DEVICE_ATTR_RW.
Though, 0660 has more open permissions than 0644.
>
> thanks,
>
> greg k-h
Powered by blists - more mailing lists