[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170913180310.27cbf1b1@archlinux>
Date: Wed, 13 Sep 2017 18:03:10 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Himanshi Jain <himshijain.hj@...il.com>
Cc: outreachy-kernel@...glegroups.com, lars@...afoo.de,
Michael.Hennerich@...log.com, knaack.h@....de, pmeerw@...erw.net,
gregkh@...uxfoundation.org, linux-iio@...r.kernel.org,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
nick.desaulniers@...il.com, daniel.baluta@...il.com
Subject: Re: [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro
On Wed, 13 Sep 2017 14:14:07 +0530
Himanshi Jain <himshijain.hj@...il.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@...il.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) },\
Powered by blists - more mailing lists