linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Alexandru Ardelean <alexandru.ardelean@analog.com>,
	linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
	alexander.shishkin@linux.intel.com, ndesaulniers@google.com
Subject: Re: [PATCH][V4] lib: fix __sysfs_match_string() helper when n != -1
Date: Tue, 25 Jun 2019 12:42:41 -0700	[thread overview]
Message-ID: <20190625124241.8b963a256ebaa056d489bb15@linux-foundation.org> (raw)
In-Reply-To: <20190625132812.GB9224@smile.fi.intel.com>

On Tue, 25 Jun 2019 16:28:12 +0300 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Tue, Jun 25, 2019 at 04:01:04PM +0300, Alexandru Ardelean wrote:
> > The documentation the `__sysfs_match_string()` helper mentions that `n`
> > (the size of the given array) should be:
> >  * @n: number of strings in the array or -1 for NULL terminated arrays
> > 
> > The behavior of the function is different, in the sense that it exits on
> > the first NULL element in the array.
> > 
> > This patch changes the behavior, to exit the loop when a NULL element is
> > found, and the size of the array is provided as -1.
> > 
> > All current users of __sysfs_match_string() & sysfs_match_string() provide
> > contiguous arrays of strings, so this behavior change doesn't influence
> > anything (at this point in time).
> > 
> > This behavior change allows for an array of strings to have NULL elements
> > within the array, which will be ignored. This is particularly useful when
> > creating mapping of strings and integers (as bitfields or other HW
> > description).
> 
> Since it does nothing for current users and comes without an example,
> it's hard to justify the need.

Presumably "split this patch away from series" means there's some code
which uses this.  A reference to this in the changelog would be good.

> The code itself looks good to me.

Sure.  But the kerneldoc description of __sysfs_match_string() could do
with an update.



  reply	other threads:[~2019-06-25 19:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08 11:19 [PATCH 1/3][V3] lib: fix __sysfs_match_string() helper when n != -1 Alexandru Ardelean
2019-05-08 11:19 ` [PATCH 2/3][V3] scsi: sd: remove sysfs_match_string() dense array comment Alexandru Ardelean
2019-05-08 11:19 ` [PATCH 3/3][V3] iio: Handle enumerated properties with gaps Alexandru Ardelean
2019-05-08 13:17   ` Andy Shevchenko
2019-05-09  7:31     ` Ardelean, Alexandru
2019-07-05 13:35       ` Ardelean, Alexandru
2019-05-28  7:18 ` [PATCH 1/3][V3] lib: fix __sysfs_match_string() helper when n != -1 Ardelean, Alexandru
2019-06-25 13:01 ` [PATCH][V4] " Alexandru Ardelean
2019-06-25 13:28   ` Andy Shevchenko
2019-06-25 19:42     ` Andrew Morton [this message]
2019-06-26  7:57       ` Ardelean, Alexandru
2019-07-14 10:12 ` [PATCH 1/3][V3] " 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=20190625124241.8b963a256ebaa056d489bb15@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexandru.ardelean@analog.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ndesaulniers@google.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 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).