From: Lars-Peter Clausen <lars@metafoo.de>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Jonathan Cameron <jic23@kernel.org>,
devel@driverdev.osuosl.org, daniel.baluta@gmail.com,
pmeerw@pmeerw.net, Michael.Hennerich@analog.com,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
nick.desaulniers@gmail.com, outreachy-kernel@googlegroups.com,
Himanshi Jain <himshijain.hj@gmail.com>,
knaack.h@gmx.de
Subject: Re: [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro
Date: Tue, 19 Sep 2017 14:13:40 +0200 [thread overview]
Message-ID: <50ec5543-bb7d-1e9c-b735-224f39d454d0@metafoo.de> (raw)
In-Reply-To: <20170913212952.GD9288@kroah.com>
On 09/13/2017 11:29 PM, Greg KH wrote:
> On Wed, Sep 13, 2017 at 09:23:31PM +0200, Lars-Peter Clausen wrote:
>> On 09/13/2017 08:58 PM, Greg KH wrote:
>>> On Wed, Sep 13, 2017 at 06:03:10PM +0100, Jonathan Cameron wrote:
>>>> 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?
>>>
>>> ick ick ick.
>>>
>>>> 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.
>>>
>>> Yeah, but this really seems "heavy" for just a crazy sysfs name in a
>>> macro. Adding a whole new "core" define for that is a hard sell...
>>>
>>> I also want to get rid of the "generic" __ATTR type macros, and force
>>> people to use the proper _RW and friends instead. I don't want to add
>>> another new one that people will start to use that I later have to
>>> change...
>>>
>>> So no, I don't like this, how about just changing your macros instead?
>>> No one else has this problem :)
>>
>> Nobody else realized they have this problem yet. E.g. there are a few users
>> of __ATTR in block/genhd.c that have the same issue and are likely to
>> generate the same false positives from static checkers.
>
> Then fix the broken static checkers :)
The static checkers aren't broken, the macro is. It takes a string
parameter, but instead of a string it is passed as an expression and then
transformed to string using preprocessor magic in the macro. That's not very
good semantics. And hence this gets detected as a false positive, because
nobody expects such strange behavior.
next prev parent reply other threads:[~2017-09-19 12:13 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-13 8:55 [PATCH v2 0/2] Rewrite the IIO_DEVICE_ATTR_NAMED API to pass name as string 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 ` [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro Jonathan Cameron
2017-09-13 18:58 ` Greg KH
2017-09-13 19:23 ` Lars-Peter Clausen
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-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-14 5:10 ` [Outreachy kernel] " Julia Lawall
2017-09-19 12:13 ` Lars-Peter Clausen [this message]
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=50ec5543-bb7d-1e9c-b735-224f39d454d0@metafoo.de \
--to=lars@metafoo.de \
--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=jic23@kernel.org \
--cc=knaack.h@gmx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).