* [RESEND PATCH] x86/mtrr: Use str_enabled_disabled() helper in print_mtrr_state()
@ 2025-01-17 14:48 Thorsten Blum
2025-01-17 16:45 ` Dave Hansen
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2025-01-17 14:48 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Kirill A. Shutemov, Tom Lendacky, Michael Roth,
Ashish Kalra
Cc: Thorsten Blum, Christophe JAILLET, Dave Hansen, Michael Kelley,
linux-kernel
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>
---
arch/x86/kernel/cpu/mtrr/generic.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index 2fdfda2b60e4..6be3cade4134 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -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) {
--
2.48.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RESEND PATCH] x86/mtrr: Use str_enabled_disabled() helper in print_mtrr_state()
2025-01-17 14:48 [RESEND PATCH] x86/mtrr: Use str_enabled_disabled() helper in print_mtrr_state() Thorsten Blum
@ 2025-01-17 16:45 ` Dave Hansen
0 siblings, 0 replies; 2+ messages in thread
From: Dave Hansen @ 2025-01-17 16:45 UTC (permalink / raw)
To: Thorsten Blum, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, H. Peter Anvin, Kirill A. Shutemov,
Tom Lendacky, Michael Roth, Ashish Kalra
Cc: Christophe JAILLET, Michael Kelley, linux-kernel
On 1/17/25 06:48, Thorsten Blum wrote:
> Remove hard-coded strings by using the str_enabled_disabled() helper
> function.
Hey Thorsten,
I'll throw this in the pile of things to apply after the merge window.
This is a pretty simple one, but it's not like it fixes a bug or
actually makes the code massively more understandable.
So if you're looking for a good time to send this kind of thing, I'd
suggest as early as possible after an -rc1 drops.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-01-17 16:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-17 14:48 [RESEND PATCH] x86/mtrr: Use str_enabled_disabled() helper in print_mtrr_state() Thorsten Blum
2025-01-17 16:45 ` Dave Hansen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox