All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Aishwarya Pant <aishpant@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	julia.lawall@lip6.fr
Subject: Re: [PATCH] staging: fbtft: replace __ATTR() with DEVICE_ATTR()
Date: Wed, 13 Dec 2017 12:50:00 +0100	[thread overview]
Message-ID: <20171213115000.GA3963@kroah.com> (raw)
In-Reply-To: <20171211095430.GA2158@mordor.localdomain>

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@gmail.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...

thanks,

greg k-h

  reply	other threads:[~2017-12-13 11:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-11  9:54 [PATCH] staging: fbtft: replace __ATTR() with DEVICE_ATTR() Aishwarya Pant
2017-12-13 11:50 ` Greg Kroah-Hartman [this message]
2017-12-14  6:21   ` Aishwarya Pant
2017-12-14  7:27     ` Greg Kroah-Hartman

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=20171213115000.GA3963@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=aishpant@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas.petazzoni@free-electrons.com \
    /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.