Re: [PATCH v2 4/6] bitops: define const_*() versions of the non-atomics
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Alexander Lobakin <alexandr.lobakin@xxxxxxxxx>
- Subject: Re: [PATCH v2 4/6] bitops: define const_*() versions of the non-atomics
- From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
- Date: Fri, 10 Jun 2022 16:56:28 +0300
- Cc: Arnd Bergmann <arnd@xxxxxxxx>, Yury Norov <yury.norov@xxxxxxxxx>, Mark Rutland <mark.rutland@xxxxxxx>, Matt Turner <mattst88@xxxxxxxxx>, Brian Cain <bcain@xxxxxxxxxxx>, Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>, Yoshinori Sato <ysato@xxxxxxxxxxxxx>, Rich Felker <dalias@xxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, Kees Cook <keescook@xxxxxxxxxxxx>, "Peter Zijlstra (Intel)" <peterz@xxxxxxxxxxxxx>, Marco Elver <elver@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxx>, Tony Luck <tony.luck@xxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, linux-alpha@xxxxxxxxxxxxxxx, linux-hexagon@xxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-m68k@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, linux-arch@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
- In-reply-to: <20220610113427.908751-5-alexandr.lobakin@intel.com>
- Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo
- References: <20220610113427.908751-1-alexandr.lobakin@intel.com> <20220610113427.908751-5-alexandr.lobakin@intel.com>
On Fri, Jun 10, 2022 at 01:34:25PM +0200, Alexander Lobakin wrote:
> Define const_*() variants of the non-atomic bitops to be used when
> the input arguments are compile-time constants, so that the compiler
> will be always to resolve those to compile-time constants as well.
> Those are mostly direct aliases for generic_*() with one exception
> for const_test_bit(): the original one is declared atomic-safe and
> thus doesn't discard the `volatile` qualifier, so in order to let
> optimize the code, define it separately disregarding the qualifier.
> Add them to the compile-time type checks as well just in case.
...
> /* Check that the bitops prototypes are sane */
> #define __check_bitop_pr(name) \
> - static_assert(__same_type(arch_##name, generic_##name) && \
> + static_assert(__same_type(const_##name, generic_##name) && \
> + __same_type(arch_##name, generic_##name) && \
> __same_type(name, generic_##name))
Can't it be a one line change and actually keeping ordering at the same time?
--
With Best Regards,
Andy Shevchenko
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]