Re: [PATCH v3 6/6] iio: light: ltr501: Fix sorting order of device arrays

Esben Haabendal <[email protected]>
Newsgroups org.kernel.vger.linux-iio,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
"Andy Shevchenko" <[email protected]> writes:

> On Fri, Aug 07, 2026 at 09:57:17AM +0200, Esben Haabendal wrote:
>> "Andy Shevchenko" <[email protected]> writes:
>> > On Tue, Aug 04, 2026 at 07:02:17PM +0200, Esben Haabendal wrote:
>
> ...
>
>> >>  enum {
>> >> -	ltr501 = 0,
>> >> -	ltr559,
>> >> -	ltr301,
>> >
>> >> +	ltr301 = 0,
>> >
>> > Is the 0 required? Why?
>>
>> As for the code produced, it should not make any difference.
>>
>> I assume it was put here for improved code readability, and I did not
>> see any reason to change that.
>>
>> I don't care about it myself, so will be happy to remove it if that is
>> the preferred style now.
>
> It's not about the style, it's about understanding the C language.
> As per style, we have only one requirement in IIO, if the value is used
> in communication with HW (part of protocol or a bitfield) *all* enum
> values must be explicitly assigned, otherwise (Linux only case) none
> (with, of course some exceptions, which are not the case here).

Ok. I will amend the patch with this change, so that we get rid of this
unneeded and unwanted assignment.

>> >>  	ltr303,
>> >>  	ltr329,
>> >> +	ltr501,
>> >> +	ltr559,
>> >>  };

/Esben
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.