[alsa-devel] [PATCH 5/7] ASoC: wm5100: remove bitwise operations involving GPIO level value

Vladimir Zapolskiy vz at mleia.com
Thu Jun 4 00:58:37 CEST 2015


Hello Trent,

On 04.06.2015 00:51, Trent Piepho wrote:
> On Wed, Jun 3, 2015 at 12:13 PM, Vladimir Zapolskiy <vz at mleia.com> wrote:
>>>
>>> BTW, with a little C algebra:
>>> const unsigned int val = value ?  0x1 << WM5100_GP1_LVL_SHIFT : 0;
>>> const unsigned int val = (value ?  0x1 : 0) << WM5100_GP1_LVL_SHIFT;
>>> const unsigned int val = (!!value) << WM5100_GP1_LVL_SHIFT;  //
>>> definition of ! operator
>>>
>>> And now we're back to where we started, so I don't really see why this
>>> is even necessary.  The semantics of the ! operator will be changed in a
>>> future C version?
>>
>> I don't think it makes sense to discuss technical aspects of the
>> proposed change, as I mentioned in the discussion yesterday I see no
>> technical issues at this point, and my changes are described as
>> nonfunctional.
>>
>> The _nontechnical_ problem I see (well, may be I'm just blowing it up)
>> is a Linux kernel code style policy problem, to my knowledge the policy
>> of using bitwise and arithmetic operations on bool type variables and
>> constants is not defined, and since the policy is not yet defined I'm
>> glad to take part in its discussion now.
> 
> I don't believe this is the case.

please excuse me for possible misunderstanding, you don't believe that
I'm interested in discussing a _nontechnical_ problem stated above?

>  From C99, section 6.5.3.3, paragraph 5:

C99 is a strict superset over Linux coding style (e.g. remember //
comments or "register" specifier), so let's forget about.

--
With best wishes,
Vladimir


More information about the Alsa-devel mailing list