Re: [PATCH] staging: fbtft: Replace a bit shift by a use of BIT.
From: Andy Shevchenko
Date: Wed Mar 22 2017 - 12:30:07 EST
On Wed, Mar 22, 2017 at 6:18 PM, Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
> On Wed, Mar 22, 2017 at 4:37 AM, Arushi Singhal
> <arushisinghal19971997@xxxxxxxxx> wrote:
>> This patch replaces bit shifting on 1 with the BIT(x) macro.
>> This was done with coccinelle:
>> @@
>> constant c;
>> @@
>>
>> -1 << c
>> +BIT(c)
>>
>
> While using BIT() macro is a good idea, you make it inconsistent here.
> There are at least two options:
> - do nothing
> - define _MASK:s with GENMASK() and reuse in the code (looking at the
> code they are masks, not just separate bits).
Looking a bit more, not masks, but values.
So, best would be define for bits and values like 0x17.
One more thing, you don't need extra parens surround BIT() macro.
--
With Best Regards,
Andy Shevchenko