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


Groups > linux.kernel > #1606285

Re: staging: iio: Replace a bit shift by a use of BIT.

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: staging: iio: Replace a bit shift by a use of BIT.
Date 2017-03-22 10:00 +0100
Message-ID <tnKhz-85F-5@gated-at.bofh.it> (permalink)
References <tnEFb-40q-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Mar 22, 2017 at 3:49 AM, Arushi Singhal
<arushisinghal19971997@gmail.com> wrote:

> @@ -232,7 +232,7 @@ static int ad7150_write_event_config(struct iio_dev *indio_dev,
>         if (ret < 0)
>                 goto error_ret;
>
> -       cfg = ret & ~((0x03 << 5) | (0x1 << 7));
> +       cfg = ret & ~((0x03 << 5) | (BIT(7)));
>
>         switch (type) {
>         case IIO_EV_TYPE_MAG_ADAPTIVE:

While the change in the #defines is not unusual, this particular change
here makes it harder to read, so I'd recommend leaving it alone, or changing
it to use symbolic names instead of the bit masks.

>  /* Voltage/Temperature Setup Register Bit Designations (AD7746_REG_VT_SETUP) */
> -#define AD7746_VTSETUP_VTEN            (1 << 7)
> +#define AD7746_VTSETUP_VTEN            (BIT(7))
>  #define AD7746_VTSETUP_VTMD_INT_TEMP   (0 << 5)
> -#define AD7746_VTSETUP_VTMD_EXT_TEMP   (1 << 5)
> +#define AD7746_VTSETUP_VTMD_EXT_TEMP   (BIT(5))

Why did you leave one of them unchanged?

    Arnd

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


Thread

staging: iio: Replace a bit shift by a use of BIT. Arushi Singhal <arushisinghal19971997@gmail.com> - 2017-03-22 04:00 +0100
  Re: staging: iio: Replace a bit shift by a use of BIT. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-22 07:10 +0100
  Re: staging: iio: Replace a bit shift by a use of BIT. Arnd Bergmann <arnd@arndb.de> - 2017-03-22 10:00 +0100
  Re: staging: iio: Replace a bit shift by a use of BIT. Dan Carpenter <dan.carpenter@oracle.com> - 2017-03-22 10:50 +0100

csiph-web