[Linux-kernel-mentees] [PATCH] cs5535: use BIT() macro for defining bit-flags

Andy Shevchenko andy.shevchenko at gmail.com
Mon Jul 8 15:02:05 UTC 2019


On Mon, Jul 8, 2019 at 11:57 AM Amol Surati <suratiamol at gmail.com> wrote:
>
> On Mon, Jul 08, 2019 at 11:02:29AM +0300, Andy Shevchenko wrote:
> > On Sun, Jul 7, 2019 at 2:30 PM Amol Surati <suratiamol at gmail.com> wrote:
> > >
> > > The BIT() macro is available for defining the required bit-flags.
> >
> > Shouldn't bits.h be added?
> >
> > > Since it operates on an unsigned value and expands to an unsigned result,
> > > using it, instead of an expression like (1 << x), also fixes the problem
> > > of shifting a signed 32-bit value by 31 bits. (e.g. 1 << 31. See
> > > CS5536_GPIOM7_PME_FLAG and CS5536_GPIOM7_PME_EN).
> >
> > What problem?
> > You need to describe that (UB by the standard, though gcc works fine,
> > I never heard it utilizes such).
>
> Yes. I will send a new version. I also missed including
> <linux/bitops.h>, although the compilation with the default
> configuration of my distro still succeeds without it, by chance.
>
It's now in a separate bits.h. No need to include complete bitops.h.

> Thank you,
> -amol
>
> >
> > --
> > With Best Regards,
> > Andy Shevchenko



-- 
With Best Regards,
Andy Shevchenko


More information about the Linux-kernel-mentees mailing list