All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: "Emilio López" <emilio.lopez@collabora.co.uk>,
	"Greg KH" <gregkh@linuxfoundation.org>
Cc: olof@lixom.net, kgene@kernel.org, k.kozlowski@samsung.com,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH 1/3] sysfs: Fix is_visible() support for binary attributes
Date: Wed, 09 Sep 2015 06:30:42 -0700	[thread overview]
Message-ID: <55F03482.4030104@roeck-us.net> (raw)
In-Reply-To: <55F030C6.80504@collabora.co.uk>

On 09/09/2015 06:14 AM, Emilio López wrote:
> On 09/09/15 01:12, Guenter Roeck wrote:
>> On 09/08/2015 08:58 PM, Greg KH wrote:
>>> On Tue, Sep 08, 2015 at 06:10:16PM -0700, Guenter Roeck wrote:
>>>> Hi Emilio,
>>>>
>>>> On 09/08/2015 05:51 PM, Emilio López wrote:
>>>>> Hi Greg & Guenter,
>>>>>
>>>> [ ... ]
>>>>>>>>
>>>>>>>> Unless I am missing something, this is not explained anywhere,
>>>>>>>> but it is
>>>>>>>> not entirely trivial to understand. I think it should be documented.
>>>>>
>>>>> I agree. I couldn't find any mention of what this int was supposed
>>>>> to be by looking at Documentation/ (is_visible is not even mentioned
>>>>> :/) or include/linux/sysfs.h. Once we settle on something I'll
>>>>> document it before sending a v2.
>>>>>
>>>> In the include file ? No strong preference, though.
>>>>
>>>>> By the way, I wrote a quick coccinelle script to match is_visible()
>>>>> users which reference the index (included below), and it found
>>>>> references to drivers which do not seem to use any binary
>>>>> attributes, so I believe changing the index meaning shouldn't be an
>>>>> issue.
>>>>>
>>>> Good.
>>>>
>>>>>>> I agree, make i the number of the bin attribute and that should solve
>>>>>>> this issue.
>>>>>>>
>>>>>> No, that would conflict with the "normal" use of is_visible for
>>>>>> non-binary
>>>>>> attributes, and make the index all but useless, since the
>>>>>> is_visible function
>>>>>> would have to search through all the attributes anyway to figure
>>>>>> out which one
>>>>>> is being checked.
>>>>>
>>>>> Yeah, using the same indexes would be somewhat pointless, although
>>>>> not many seem to be using it anyway (only 14 files matched). Others
>>>>> seem to be comparing the attr* instead. An alternative would be to
>>>>> use negative indexes for binary attributes and positive indexes for
>>>>> normal attributes.
>>>>>
>>>> ... and I probably wrote or reviewed a significant percentage of
>>>> those ;-).
>>>>
>>>> Using negative numbers for binary attributes is an interesting idea.
>>>> Kind of unusual, though. Greg, any thoughts on that ?
>>>
>>> Ick, no, that's a mess, maybe we just could drop the index alltogether?
>>>
>>
>> No, please don't. Having to manually compare dozens of index pointers
>> would be
>> even more of a mess.
>
> So, what about keeping it the way it is in the patch, and documenting it thoroughly? Otherwise, we could introduce another "is_bin_visible" function to do this same thing but just on binary attributes, but I'd rather not add a new function pointer if possible.
>

I would prefer to keep and document it.

Guenter

WARNING: multiple messages have this Message-ID (diff)
From: linux@roeck-us.net (Guenter Roeck)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] sysfs: Fix is_visible() support for binary attributes
Date: Wed, 09 Sep 2015 06:30:42 -0700	[thread overview]
Message-ID: <55F03482.4030104@roeck-us.net> (raw)
In-Reply-To: <55F030C6.80504@collabora.co.uk>

On 09/09/2015 06:14 AM, Emilio L?pez wrote:
> On 09/09/15 01:12, Guenter Roeck wrote:
>> On 09/08/2015 08:58 PM, Greg KH wrote:
>>> On Tue, Sep 08, 2015 at 06:10:16PM -0700, Guenter Roeck wrote:
>>>> Hi Emilio,
>>>>
>>>> On 09/08/2015 05:51 PM, Emilio L?pez wrote:
>>>>> Hi Greg & Guenter,
>>>>>
>>>> [ ... ]
>>>>>>>>
>>>>>>>> Unless I am missing something, this is not explained anywhere,
>>>>>>>> but it is
>>>>>>>> not entirely trivial to understand. I think it should be documented.
>>>>>
>>>>> I agree. I couldn't find any mention of what this int was supposed
>>>>> to be by looking at Documentation/ (is_visible is not even mentioned
>>>>> :/) or include/linux/sysfs.h. Once we settle on something I'll
>>>>> document it before sending a v2.
>>>>>
>>>> In the include file ? No strong preference, though.
>>>>
>>>>> By the way, I wrote a quick coccinelle script to match is_visible()
>>>>> users which reference the index (included below), and it found
>>>>> references to drivers which do not seem to use any binary
>>>>> attributes, so I believe changing the index meaning shouldn't be an
>>>>> issue.
>>>>>
>>>> Good.
>>>>
>>>>>>> I agree, make i the number of the bin attribute and that should solve
>>>>>>> this issue.
>>>>>>>
>>>>>> No, that would conflict with the "normal" use of is_visible for
>>>>>> non-binary
>>>>>> attributes, and make the index all but useless, since the
>>>>>> is_visible function
>>>>>> would have to search through all the attributes anyway to figure
>>>>>> out which one
>>>>>> is being checked.
>>>>>
>>>>> Yeah, using the same indexes would be somewhat pointless, although
>>>>> not many seem to be using it anyway (only 14 files matched). Others
>>>>> seem to be comparing the attr* instead. An alternative would be to
>>>>> use negative indexes for binary attributes and positive indexes for
>>>>> normal attributes.
>>>>>
>>>> ... and I probably wrote or reviewed a significant percentage of
>>>> those ;-).
>>>>
>>>> Using negative numbers for binary attributes is an interesting idea.
>>>> Kind of unusual, though. Greg, any thoughts on that ?
>>>
>>> Ick, no, that's a mess, maybe we just could drop the index alltogether?
>>>
>>
>> No, please don't. Having to manually compare dozens of index pointers
>> would be
>> even more of a mess.
>
> So, what about keeping it the way it is in the patch, and documenting it thoroughly? Otherwise, we could introduce another "is_bin_visible" function to do this same thing but just on binary attributes, but I'd rather not add a new function pointer if possible.
>

I would prefer to keep and document it.

Guenter

  parent reply	other threads:[~2015-09-09 13:30 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-08 12:07 [PATCH 0/3] platform/chrome: vboot context support Emilio López
2015-09-08 12:07 ` Emilio López
2015-09-08 12:07 ` [PATCH 1/3] sysfs: Fix is_visible() support for binary attributes Emilio López
2015-09-08 12:07   ` Emilio López
2015-09-08 15:30   ` Guenter Roeck
2015-09-08 15:30     ` Guenter Roeck
2015-09-08 19:10     ` Greg KH
2015-09-08 19:10       ` Greg KH
2015-09-08 19:30       ` Guenter Roeck
2015-09-08 19:30         ` Guenter Roeck
2015-09-09  0:51         ` Emilio López
2015-09-09  0:51           ` Emilio López
2015-09-09  1:10           ` Guenter Roeck
2015-09-09  1:10             ` Guenter Roeck
2015-09-09  3:58             ` Greg KH
2015-09-09  3:58               ` Greg KH
2015-09-09  4:12               ` Guenter Roeck
2015-09-09  4:12                 ` Guenter Roeck
2015-09-09 13:14                 ` Emilio López
2015-09-09 13:14                   ` Emilio López
2015-09-09 13:30                   ` Greg KH
2015-09-09 13:30                     ` Greg KH
2015-09-09 13:30                   ` Guenter Roeck [this message]
2015-09-09 13:30                     ` Guenter Roeck
2015-09-08 12:07 ` [PATCH 2/3] platform/chrome: Support reading/writing the vboot context Emilio López
2015-09-08 12:07   ` Emilio López
2015-09-08 12:07 ` [PATCH 3/3] ARM: dts: Enable EC vboot context support on Peach boards Emilio López
2015-09-08 12:07   ` Emilio López

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=55F03482.4030104@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=devicetree@vger.kernel.org \
    --cc=emilio.lopez@collabora.co.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=k.kozlowski@samsung.com \
    --cc=kgene@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=olof@lixom.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.