Skip to content

Commit

Permalink
x86/bootflag: Micro-optimize sbf_write()
Browse files Browse the repository at this point in the history
Change parity bit with XOR when !parity instead of masking bit out
and conditionally setting it when !parity.

Saves a couple of bytes in the object file.

Co-developed-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20250226153709.6370-1-ubizjak@gmail.com
  • Loading branch information
Uros Bizjak authored and Ingo Molnar committed Feb 27, 2025
1 parent 7d8f03f commit adf6819
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions arch/x86/kernel/bootflag.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ static void __init sbf_write(u8 v)
unsigned long flags;

if (sbf_port != -1) {
v &= ~SBF_PARITY;
if (!parity(v))
v |= SBF_PARITY;
v ^= SBF_PARITY;

printk(KERN_INFO "Simple Boot Flag at 0x%x set to 0x%x\n",
sbf_port, v);
Expand Down

0 comments on commit adf6819

Please sign in to comment.