All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Himanshi Jain <himshijain.hj@gmail.com>
Cc: outreachy-kernel@googlegroups.com, lars@metafoo.de,
	Michael.Hennerich@analog.com, knaack.h@gmx.de, pmeerw@pmeerw.net,
	gregkh@linuxfoundation.org, linux-iio@vger.kernel.org,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	nick.desaulniers@gmail.com, daniel.baluta@gmail.com
Subject: Re: [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro
Date: Wed, 13 Sep 2017 18:03:10 +0100	[thread overview]
Message-ID: <20170913180310.27cbf1b1@archlinux> (raw)
In-Reply-To: <2bc7a124ab925dd2c50aa8c778745d179777d50d.1505291907.git.himshijain.hj@gmail.com>

On Wed, 13 Sep 2017 14:14:07 +0530
Himanshi Jain <himshijain.hj@gmail.com> wrote:

> Add __ATTR_NAMED macro similar to __ATTR but taking name as a
> string instead of implicit conversion of argument to string using
> the macro _stringify(_name).
> 
> Signed-off-by: Himanshi Jain <himshijain.hj@gmail.com>
> ---
>  include/linux/sysfs.h | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
> index aa02c32..20321cf 100644
> --- a/include/linux/sysfs.h
> +++ b/include/linux/sysfs.h
> @@ -104,6 +104,13 @@ struct attribute_group {
>  	.store	= _store,						\
>  }
>  
> +#define __ATTR_NAMED(_name, _mode, _show, _store) {			\

I'm not sure about the naming here.  The normal __ATTR macro is also
'named'.  Maybe something as awful as

__ATTR_STRING_NAME ? 

Greg what do you think?

This is all to allow us to have names with operators in them without
checkpatch complaining about them... A worthwhile aim just to stop
more people wasting time trying to 'fix' those cases by adding spaces.

Jonathan

> +	.attr = {.name = _name,						\
> +		 .mode = VERIFY_OCTAL_PERMISSIONS(_mode) },		\
> +	.show = _show,							\
> +	.store = _store,						\
> +}
> +
>  #define __ATTR_PREALLOC(_name, _mode, _show, _store) {			\
>  	.attr = {.name = __stringify(_name),				\
>  		 .mode = SYSFS_PREALLOC | VERIFY_OCTAL_PERMISSIONS(_mode) },\


  parent reply	other threads:[~2017-09-13 17:03 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-13  8:42 [PATCH v2 0/2] Rewrite the IIO_DEVICE_ATTR_NAMED API to pass name as string Himanshi Jain
2017-09-13  8:55 ` Himanshi Jain
2017-09-13  8:44 ` [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro Himanshi Jain
2017-09-13  8:44   ` [PATCH v2 2/2] iio: Change to __ATTR_NAMED() Himanshi Jain
2017-09-13 17:03   ` Jonathan Cameron [this message]
2017-09-13 18:58     ` [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro Greg KH
2017-09-13 19:23       ` Lars-Peter Clausen
2017-09-13 20:50         ` Jonathan Cameron
2017-09-13 20:50           ` Jonathan Cameron
2017-09-18 10:49           ` Himanshi Jain
2017-09-21 13:54             ` Jonathan Cameron
2017-09-21 14:07               ` [Outreachy kernel] " Julia Lawall
2017-09-21 14:07                 ` Julia Lawall
2017-09-13 21:29         ` Greg KH
2017-09-13 21:43           ` Dan Carpenter
2017-09-13 21:58             ` Joe Perches
2017-09-13 23:16               ` Jonathan Cameron
2017-09-13 23:16                 ` Jonathan Cameron
2017-09-13 23:16                 ` Jonathan Cameron
2017-09-14  5:10               ` [Outreachy kernel] " Julia Lawall
2017-09-19 12:13           ` Lars-Peter Clausen
2017-09-13  8:46 ` [Outreachy kernel] [PATCH v2 0/2] Rewrite the IIO_DEVICE_ATTR_NAMED API to pass name as string Julia Lawall
2017-09-13 17:04   ` Jonathan Cameron

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=20170913180310.27cbf1b1@archlinux \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=daniel.baluta@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=himshijain.hj@gmail.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nick.desaulniers@gmail.com \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=pmeerw@pmeerw.net \
    /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.