]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/mtrr: Use str_enabled_disabled() helper in print_mtrr_state()
authorThorsten Blum <thorsten.blum@linux.dev>
Fri, 17 Jan 2025 14:48:59 +0000 (15:48 +0100)
committerDave Hansen <dave.hansen@linux.intel.com>
Tue, 4 Feb 2025 17:59:40 +0000 (09:59 -0800)
Remove hard-coded strings by using the str_enabled_disabled() helper
function.

Suggested-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: https://lore.kernel.org/all/20250117144900.171684-2-thorsten.blum%40linux.dev
arch/x86/kernel/cpu/mtrr/generic.c

index 2fdfda2b60e4f8e44a3f2ed3203eac94e3d7cad5..6be3cade4134cc58ddaaee5ee9f3b5b35a6726c3 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/io.h>
 #include <linux/mm.h>
 #include <linux/cc_platform.h>
+#include <linux/string_choices.h>
 #include <asm/processor-flags.h>
 #include <asm/cacheinfo.h>
 #include <asm/cpufeature.h>
@@ -646,10 +647,10 @@ static void __init print_mtrr_state(void)
        pr_info("MTRR default type: %s\n",
                mtrr_attrib_to_str(mtrr_state.def_type));
        if (mtrr_state.have_fixed) {
-               pr_info("MTRR fixed ranges %sabled:\n",
-                       ((mtrr_state.enabled & MTRR_STATE_MTRR_ENABLED) &&
-                        (mtrr_state.enabled & MTRR_STATE_MTRR_FIXED_ENABLED)) ?
-                        "en" : "dis");
+               pr_info("MTRR fixed ranges %s:\n",
+                       str_enabled_disabled(
+                        (mtrr_state.enabled & MTRR_STATE_MTRR_ENABLED) &&
+                        (mtrr_state.enabled & MTRR_STATE_MTRR_FIXED_ENABLED)));
                print_fixed(0x00000, 0x10000, mtrr_state.fixed_ranges + 0);
                for (i = 0; i < 2; ++i)
                        print_fixed(0x80000 + i * 0x20000, 0x04000,
@@ -661,8 +662,8 @@ static void __init print_mtrr_state(void)
                /* tail */
                print_fixed_last();
        }
-       pr_info("MTRR variable ranges %sabled:\n",
-               mtrr_state.enabled & MTRR_STATE_MTRR_ENABLED ? "en" : "dis");
+       pr_info("MTRR variable ranges %s:\n",
+               str_enabled_disabled(mtrr_state.enabled & MTRR_STATE_MTRR_ENABLED));
        high_width = (boot_cpu_data.x86_phys_bits - (32 - PAGE_SHIFT) + 3) / 4;
 
        for (i = 0; i < num_var_ranges; ++i) {