From adf6819278ba34be1d29ffcdca5c2ccd2123f667 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Wed, 26 Feb 2025 16:36:56 +0100 Subject: [PATCH] x86/bootflag: Micro-optimize sbf_write() 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" Signed-off-by: "H. Peter Anvin" Signed-off-by: Uros Bizjak Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20250226153709.6370-1-ubizjak@gmail.com --- arch/x86/kernel/bootflag.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/kernel/bootflag.c b/arch/x86/kernel/bootflag.c index 4d89a2d80d0f..b935c3e42bfd 100644 --- a/arch/x86/kernel/bootflag.c +++ b/arch/x86/kernel/bootflag.c @@ -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); -- 2.50.1