[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180108113237.0000080d@huawei.com>
Date: Mon, 8 Jan 2018 11:32:37 +0000
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
CC: Jonathan Cameron <jic23@...nel.org>,
Sumit Pundir <pundirsumit11@...il.com>,
Lars-Peter Clausen <lars@...afoo.de>,
"Michael Hennerich" <Michael.Hennerich@...log.com>,
Hartmut Knaack <knaack.h@....de>,
Peter Meerwald <pmeerw@...erw.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
<linux-iio@...r.kernel.org>, <devel@...verdev.osuosl.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] Staging: iio: Prefer using BIT macro
On Mon, 8 Jan 2018 01:30:29 +0200
Andy Shevchenko <andy.shevchenko@...il.com> wrote:
> On Sat, Jan 6, 2018 at 2:42 PM, Jonathan Cameron <jic23@...nel.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.
I'm not sure using BIT for single bit fields really makes it much harder
to read, but perhaps you are right. Anyhow, can't say I feel strongly
about this one either way!
Jonathan
>
> >> #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.
>
Powered by blists - more mailing lists