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

Andy Shevchenko andy.shevchenko at gmail.com
Mon Jul 8 08:02:29 UTC 2019


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).

-- 
With Best Regards,
Andy Shevchenko


More information about the Linux-kernel-mentees mailing list