lkml.org 
[lkml]   [2018]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] Staging: iio: Prefer using BIT macro
On Sat, Jan 6, 2018 at 2:42 PM, Jonathan Cameron <jic23@kernel.org> wrote:
> On Thu, 4 Jan 2018 22:06:31 +0530

>> /* Setup Register Bit Designations (AD7152_REG_CHx_SETUP) */
>> -#define AD7152_SETUP_CAPDIFF (1 << 5)
>> +#define AD7152_SETUP_CAPDIFF BIT(5)
>
> This is indeed a 1 bit field so fine.

But shouldn't we prevent style over the module? Otherwise it might be
hard to decode one field from the other because of style differences.

>> #define AD7152_SETUP_RANGE_2pF (0 << 6)
>> -#define AD7152_SETUP_RANGE_0_5pF (1 << 6)
>> +#define AD7152_SETUP_RANGE_0_5pF BIT(6)
> This is clearly putting the value 1 in a 2 bit field within
> the register - BIT macro obscures this compeltely.

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2018-01-14 23:16    [W:0.054 / U:0.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site