Re: [PATCH] drivers: staging: vme: Changed (1 << n) to BIT(n)

From: Greg KH
Date: Tue Nov 24 2015 - 18:28:51 EST


On Mon, Nov 09, 2015 at 08:03:18AM +0000, Martyn Welch wrote:
>
> On 8 Nov 2015 23:22, "Andy Shevchenko" <andy.shevchenko@xxxxxxxxx> wrote:
> >
> > On Sun, Nov 8, 2015 at 10:39 PM, Egor Uleyskiy <egor.ulieiskii@xxxxxxxxx>
> wrote:
> > > From: Egor Uleyskiy <egor.ulieiskii@xxxxxxxxx>
> > >
> > > Signed-off-by: Egor Uleyskiy <egor.ulieiskii@xxxxxxxxx>
> > > ---
> > >  drivers/staging/vme/devices/vme_pio2.h | 93
> ++++++++++++++++------------------
> > >  1 file changed, 45 insertions(+), 48 deletions(-)
> > >
> > > diff --git a/drivers/staging/vme/devices/vme_pio2.h b/drivers/staging/vme/
> devices/vme_pio2.h
> > > index d5d94c4..29d7a58 100644
> > > --- a/drivers/staging/vme/devices/vme_pio2.h
> > > +++ b/drivers/staging/vme/devices/vme_pio2.h
>
> <snip>
>
> > > @@ -182,7 +181,7 @@ static const int PIO2_CNTR_CTRL[6] = {
> PIO2_REGS_CTRL_WRD0,
> > >                                         PIO2_REGS_CTRL_WRD1 };
> > >
> > >  #define PIO2_CNTR_SC_DEV0              0
> > > -#define PIO2_CNTR_SC_DEV1              (1 << 6)
> > > +#define PIO2_CNTR_SC_DEV1              BIT(6)
> > >  #define PIO2_CNTR_SC_DEV2              (2 << 6)
> > >  #define PIO2_CNTR_SC_RDBACK            (3 << 6)
> >
> > With the first parts which are an excellent clean up, this one makes
> > two styles out of one.
> > Greg, what would you suggest to do? For my opinion in such cases
> > direct values or previous syntax looks better.
> >
>
> If BIT() can't be applied uniformly, I'm afraid I don't see the value in using
> it.
>
> Has there been some general push to use BIT(x) rather than (1 << x) that I've
> missed?
>
> I'm not sure how I feel about these macros, is there some advantage that I'm
> missing?

It's easier to understand for the most part, so yes, it is good to do
where it makes sense (hint, not for this last chunk...)

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/