Don't use BIT() macro in UAPI headers
Status from this message: The following commit has been merged into the x86/misc branch of tip:
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest7 patches 4 repliesApplied
- v16 patches 12 repliesSuperseded
Changes in v2 from the cover letter
- Use _BITUL() macro instead of open-coding
- Fixup HWCAP2_RING3MWAIT as well
- Shorten commits and added "Fixes" per reviewer comments
- checkpatch: Broaden UAPI regex
- checkpatch: Reccomend _BITULL()/_BITUL() for UAPI headers
Patches in v2 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/7 | x86/elf: Use _BITUL() macro in UAPI headersarch/ | +4 | 0 replies | |
| 2/7 | KVM: X86: Use _BITUL() macro in UAPI headersinclude/ tools/ | +6 | 1 reply | |
| 3/7 | drivers: firmware: psci: Use _BITUL() macro in UAPI headersinclude/ | +3 | 1 reply | |
| 4/7 | uacce: Use _BITUL() macro in UAPI headersinclude/ | +2 | 1 reply | |
| 5/7 | media: vicodec: Use _BITUL() macro in UAPI headersinclude/ | +12 | 0 replies | |
| 6/7 | tools headers UAPI: Sync pkt_sched.h with the kernel sourcestools/ | +112 | 0 replies | |
| 7/7 | checkpatch: suggest _BITULL() and _BITUL() for UAPI headersscripts/ | +9 | 1 reply |
Reviews trailers per patch
2 of 7 patches have a Reviewed-by or Acked-by.
| Patch | Mark Rutland | Zhangfei Gao |
|---|---|---|
| 1/7 | ||
| 2/7 | ||
| 3/7 | A-b | |
| 4/7 | A-b | |
| 5/7 | ||
| 6/7 | ||
| 7/7 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 0/7] Don't use BIT() macro in UAPI headers
From: Joe Richey <[email protected]>
The BIT(n) macro is used in the kernel as an alias for (1 << n). However, it is not defined in the UAPI headers, they should instead use the _BITUL(n) macro. This patch chages all existing usages in UAPI headers and updates ./scripts/checkpatch.pl to properly reccomend the correct macro depending on context.
Running the below commands shows no more incorrect macro usages:
rg "BIT\(" **/uapi/**
rg "BIT_ULL\(" **/uapi/**Tested by building a basic kernel. Changes are trivial.
I encountered this issue when compiling the following program:
#include <sys/auxv.h>
#include <asm/hwcap2.h>
// Detect if FSGSBASE instructions are enabled
int main() {
unsigned long val = getauxval(AT_HWCAP2);
return !(val & HWCAP2_FSGSBASE);
}Resulting in the following likner error:
/usr/bin/ld: /tmp/cceFpAdR.o: in function `main':
gs.c:(.text+0x21): undefined reference to `BIT'
Changes from V1 to V2:
- Use _BITUL() macro instead of open-coding
- Fixup HWCAP2_RING3MWAIT as well
- Shorten commits and added "Fixes" per reviewer comments
- checkpatch: Broaden UAPI regex
- checkpatch: Reccomend _BITULL()/_BITUL() for UAPI headers
Joe Richey (7):
x86/elf: Use _BITUL() macro in UAPI headers
KVM: X86: Use _BITUL() macro in UAPI headers
drivers: firmware: psci: Use _BITUL() macro in UAPI headers
uacce: Use _BITUL() macro in UAPI headers
media: vicodec: Use _BITUL() macro in UAPI headers tools headers UAPI: Sync pkt_sched.h with the kernel sources
checkpatch: suggest _BITULL() and _BITUL() for UAPI headers
arch/x86/include/uapi/asm/hwcap2.h | 6 +- include/uapi/linux/kvm.h | 5 +- include/uapi/linux/psci.h | 4 +- include/uapi/linux/v4l2-controls.h | 23 ++--- include/uapi/misc/uacce/uacce.h | 3 +- scripts/checkpatch.pl | 16 ++-- tools/include/uapi/linux/kvm.h | 5 +- tools/include/uapi/linux/pkt_sched.h | 122 ++++++++++++++++++++++++--- 8 files changed, 148 insertions(+), 36 deletions(-)
Signature · 1 line
2.31.1