Re: [PATCH v2 24/27] thunderbolt: Add support for Internal Connection Manager (ICM)
From: Andy Shevchenko
Date: Sun May 28 2017 - 06:13:59 EST
On 5/28/17, Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx> wrote:
> On Sat, May 27, 2017 at 11:45:21PM +0300, Andy Shevchenko wrote:
>> On Fri, May 26, 2017 at 7:09 PM, Mika Westerberg
>> <mika.westerberg@xxxxxxxxxxxxxxx> wrote:
>>
>> > +static inline u8 dual_link_from_link(u8 link)
>> > +{
>> > + return link ? ((link - 1) ^ 0x01) + 1 : 0;
>> > +}
>>
>> I have got better one (IIUC):
>>
>> return (link + 1) ^ 0x01) - 1;
>
> Unfortunately this does not work if link is 0.
>
Yeah, it needs same null check.
--
With Best Regards,
Andy Shevchenko