Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1606729

Re: [PATCH] staging: fbtft: Replace a bit shift by a use of BIT.

From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] staging: fbtft: Replace a bit shift by a use of BIT.
Date 2017-03-22 17:40 +0100
Message-ID <tnRsJ-5on-15@gated-at.bofh.it> (permalink)
References <tnElP-3TW-7@gated-at.bofh.it> <tnR9n-5eZ-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Mar 22, 2017 at 6:18 PM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Wed, Mar 22, 2017 at 4:37 AM, Arushi Singhal
> <arushisinghal19971997@gmail.com> 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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] staging: fbtft: Replace a bit shift by a use of BIT. Arushi Singhal <arushisinghal19971997@gmail.com> - 2017-03-22 03:40 +0100
  Re: [PATCH] staging: fbtft: Replace a bit shift by a use of BIT. Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-03-22 17:20 +0100
    Re: [PATCH] staging: fbtft: Replace a bit shift by a use of BIT. Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-03-22 17:40 +0100

csiph-web