bitops: Reshuffle bitops.h and wordpart,h
Subsystems (2)
v2 cover bitops: Reshuffle bitops.h and wordpart,h
Move word part related macros to the respective header. While at it, fix the inclusion mess in lib/usercopy.h.
Andy Shevchenko (2):
bitops: Move aligned_byte_mask() to wordpart.h
usercopy: Don't use "proxy" headers
include/linux/bitops.h | 7 ------- include/linux/wordpart.h | 7 +++++++ lib/usercopy.c | 9 +++++++-- 3 files changed, 14 insertions(+), 9 deletions(-)
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
PATCH v2 1/2 bitops: Move aligned_byte_mask() to wordpart.h
The bitops.h is for bit related operations. The aligned_byte_mask() is about byte (or part of the machine word) operations, for which we have a separate header, move the mentioned macro to wordpart.h to consolidate similar operations.
--- include/linux/bitops.h | 7 ------- include/linux/wordpart.h | 7 +++++++ lib/usercopy.c | 1 + 3 files changed, 8 insertions(+), 7 deletions(-)
include/linux/bitops.h +0 -7
@@ -8,13 +8,6 @@#include <uapi/linux/kernel.h> -/* Set bits in the first 'n' bytes when loaded from memory */ -#ifdef __LITTLE_ENDIAN -# define aligned_byte_mask (n) ((1UL << 8*(n))-1) -#else -# define aligned_byte_mask (n) (~0xffUL << (BITS_PER_LONG - 8 - 8*(n))) -#endif -#define BITS_PER_TYPE (type) (sizeof(type) * BITS_PER_BYTE)#define BITS_TO_LONGS (nr) __KERNEL_DIV_ROUND_UP(nr, BITS_PER_TYPE(long))#define BITS_TO_U64 (nr) __KERNEL_DIV_ROUND_UP(nr, BITS_PER_TYPE(u64))
include/linux/wordpart.h +7 -0
@@ -39,4 +39,11 @@*/ #define REPEAT_BYTE (x) ((~0ul / 0xff) * (x)) +/* Set bits in the first 'n' bytes when loaded from memory */ +#ifdef __LITTLE_ENDIAN +# define aligned_byte_mask (n) ((1UL << 8*(n))-1) +#else +# define aligned_byte_mask (n) (~0xffUL << (BITS_PER_LONG - 8 - 8*(n))) +#endif +#endif // _LINUX_WORDPART_H
lib/usercopy.c +1 -0
@@ -3,6 +3,7 @@#include <linux/fault-inject-usercopy.h> #include <linux/instrumented.h> #include <linux/uaccess.h> +#include <linux/wordpart.h> #include <linux/nospec.h> /* out-of-line parts */
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
PATCH v2 2/2 usercopy: Don't use "proxy" headers
In reply to Andy ShevchenkoUpdate header inclusions to follow IWYU (Include What You Use) principle.
--- lib/usercopy.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
lib/usercopy.c +6 -2
@@ -1,10 +1,14 @@// SPDX-License-Identifier: GPL-2.0 -#include <linux/bitops.h> +#include <linux/compiler.h> +#include <linux/errno.h> +#include <linux/export.h> #include <linux/fault-inject-usercopy.h> #include <linux/instrumented.h> +#include <linux/kernel.h> +#include <linux/nospec.h> +#include <linux/string.h> #include <linux/uaccess.h> #include <linux/wordpart.h> -#include <linux/nospec.h> /* out-of-line parts */
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Yury Norov
maintainerQuoted 11 lines · Andy Shevchenko
Move word part related macros to the respective header. While at it, fix the inclusion mess in
lib/usercopy.h.Andy Shevchenko (2):
bitops: Movealigned_byte_mask()towordpart.h
usercopy: Don't use "proxy" headersinclude/linux/bitops.h | 7 ------- include/linux/wordpart.h | 7 +++++++ lib/usercopy.c | 9 +++++++-- 3 files changed, 14 insertions(+), 9 deletions(-)
Thanks, adding it in bitmap-for-next for testing.