Re: [PATCH 3/3] device property: of_property_read_string_array() returns number of strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 14, 2017 at 8:17 AM, Sakari Ailus
<sakari.ailus@xxxxxxxxxxxxxxx> wrote:
> Hi Rafael,
>
> On 03/14/17 00:24, Rafael J. Wysocki wrote:
>> On Monday, March 06, 2017 03:26:31 PM Sakari Ailus wrote:
>>> of_property_read_string_array() returns number of strings read if the
>>> target array of pointers is non-NULL. fwnode_property_read_string_array()
>>> is documented to return 0 in that case. Fix this.
>>
>> Well, if we want people to use fwnode_property_read_string_array() instead of
>> of_property_read_string_array(), it should better behave analogously, shouldn't it?
>
> Not necessarily.
>
> The documentation states that fwnode_property_read_string_array()
> returns 0 on success. That makes sense since the callers often check
> whether the return value is non-zero and then return based on that.
> Returning zero on success is just simpler for the caller.
>
> Often the number of elements to read from an array is known beforehand,
> so there's little use for the actual number read.
>
> Besides the fwnode variants, also the OF integer array access functions
> return zero on success.
>
> Rob had a similar comment but the discussion did not continue after my
> initial reply. I can sure change that if you still think it's better the
> other way.

I understand the argumentation, but if X is supposed to be an easy
replacement for Y, it really should stick to the return value
conventions used by the latter or it is not easy any more.

So yes, please.

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux