lkml.org 
[lkml]   [2021]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v1 7/7] ACPI: property: Allow counting a single value as an array of 1 element
On Wed, Feb 10, 2021 at 4:42 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Wed, Feb 10, 2021 at 04:01:16PM +0100, Rafael J. Wysocki wrote:
> > On Wed, Feb 10, 2021 at 3:48 PM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > > On Wed, Feb 10, 2021 at 02:48:09PM +0100, Rafael J. Wysocki wrote:
> > > > On Wednesday, February 10, 2021 2:31:48 PM CET Rafael J. Wysocki wrote:
> > > > > On Wednesday, February 10, 2021 1:36:00 PM CET Rafael J. Wysocki wrote:
> > > > > > On Wed, Feb 10, 2021 at 12:51 PM Andy Shevchenko
> > > > > > <andriy.shevchenko@linux.intel.com> wrote:
>
> ...
>
> > > > > > > - if (val && nval == 1) {
> > > > > > > + /* Try to read as a single value first */
> > > > > > > + if (!val || nval == 1) {
> > > > > > > ret = acpi_data_prop_read_single(data, propname, proptype, val);
> > > > > >
> > > > > > This returns -EINVAL if val is NULL.
> > >
> > > Nope. That's why it's a patch 7. Patch 6 solves this.
> >
> > That's my point. Patch 7 should be the first one in the series.
>
> Ah, okay. Since you want this let me rebase.

Thanks!

> > > > > > > if (ret >= 0)
> > > > > > > - return ret;
> > > > > > > + return val ? ret : 1;
> > > > > >
> > > > > > So val cannot be NULL here.
> > >
> > > Why not? I have changed conditional.
> > >
> > > > > > > }
> > >
> > > > > > To me, acpi_fwnode_property_read_string_array() needs to special-case
> > > > > > val == NULL and nval == 0.
> > >
> > > nval can be anything in the case of val==NULL. So far neither of your proposals
> > > conform this.
> >
> > That is if !val and nval != 0 is regarded as a valid combination of
> > arguments, but is it?
>
> I believe nobody tested that.
>
> > If that is the case, the check in acpi_data_prop_read() in the last
> > patch that I posted needs to be (!val || nval == 1), but that would be
> > it, no?
>
> I think it also needs the conditional at return as in my patch.

I'm not sure why.

acpi_data_prop_read_single() would return 1 for !val if it finds the
property with a single value and that should be sufficient, shouldn't
it?

\
 
 \ /
  Last update: 2021-02-10 16:46    [W:0.076 / U:0.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site