[PATCH] powerpc: Use str_enabled_disabled() helper function

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE674d

3 messages, 3 authors, 2024-11-17 · open the first message on its own page

[PATCH] powerpc: Use str_enabled_disabled() helper function

From: Thorsten Blum <hidden>
Date: 2024-10-27 22:22:58

Remove hard-coded strings by using the str_enabled_disabled() helper
function.

Signed-off-by: Thorsten Blum <redacted>
---
 arch/powerpc/kernel/secure_boot.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/secure_boot.c b/arch/powerpc/kernel/secure_boot.c
index 9e0efb657f39..3a28795b4ed8 100644
--- a/arch/powerpc/kernel/secure_boot.c
+++ b/arch/powerpc/kernel/secure_boot.c
@@ -5,6 +5,7 @@
  */
 #include <linux/types.h>
 #include <linux/of.h>
+#include <linux/string_choices.h>
 #include <asm/secure_boot.h>
 
 static struct device_node *get_ppc_fw_sb_node(void)
@@ -38,7 +39,7 @@ bool is_ppc_secureboot_enabled(void)
 	of_node_put(node);
 
 out:
-	pr_info("Secure boot mode %s\n", enabled ? "enabled" : "disabled");
+	pr_info("Secure boot mode %s\n", str_enabled_disabled(enabled));
 
 	return enabled;
 }
@@ -62,7 +63,7 @@ bool is_ppc_trustedboot_enabled(void)
 	of_node_put(node);
 
 out:
-	pr_info("Trusted boot mode %s\n", enabled ? "enabled" : "disabled");
+	pr_info("Trusted boot mode %s\n", str_enabled_disabled(enabled));
 
 	return enabled;
 }
-- 
2.47.0

Re: [PATCH] powerpc: Use str_enabled_disabled() helper function

From: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Date: 2024-10-28 03:45:08

Thorsten Blum [off-list ref] writes:
Remove hard-coded strings by using the str_enabled_disabled() helper
function.
Looks like now a days LKP also reports this - e.g. [1] "opportunity for str_enabled_disabled(enable)" 

[1]: https://lore.kernel.org/all/202410071601.TFpXoqgW-lkp@intel.com/

I see more such oppotunities for later improvements in arch/powerpc/
root-> git grep "\"enabled\" : \"disabled\"" arch/powerpc/
arch/powerpc/kernel/secure_boot.c:      pr_info("Secure boot mode %s\n", enabled ? "enabled" : "disabled");
arch/powerpc/kernel/secure_boot.c:      pr_info("Trusted boot mode %s\n", enabled ? "enabled" : "disabled");
arch/powerpc/platforms/powermac/setup.c:                                        "enabled" : "disabled");
arch/powerpc/sysdev/mpic.c:             flags & HT_MSI_FLAGS_ENABLE ? "enabled" : "disabled", addr);
Signed-off-by: Thorsten Blum <redacted>
---
 arch/powerpc/kernel/secure_boot.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
For this patch it looks good to me. Please feel free to add - 

Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
quoted hunk
diff --git a/arch/powerpc/kernel/secure_boot.c b/arch/powerpc/kernel/secure_boot.c
index 9e0efb657f39..3a28795b4ed8 100644
--- a/arch/powerpc/kernel/secure_boot.c
+++ b/arch/powerpc/kernel/secure_boot.c
@@ -5,6 +5,7 @@
  */
 #include <linux/types.h>
 #include <linux/of.h>
+#include <linux/string_choices.h>
 #include <asm/secure_boot.h>
 
 static struct device_node *get_ppc_fw_sb_node(void)
@@ -38,7 +39,7 @@ bool is_ppc_secureboot_enabled(void)
 	of_node_put(node);
 
 out:
-	pr_info("Secure boot mode %s\n", enabled ? "enabled" : "disabled");
+	pr_info("Secure boot mode %s\n", str_enabled_disabled(enabled));
 
 	return enabled;
 }
@@ -62,7 +63,7 @@ bool is_ppc_trustedboot_enabled(void)
 	of_node_put(node);
 
 out:
-	pr_info("Trusted boot mode %s\n", enabled ? "enabled" : "disabled");
+	pr_info("Trusted boot mode %s\n", str_enabled_disabled(enabled));
 
 	return enabled;
 }
-- 
2.47.0

Re: [PATCH] powerpc: Use str_enabled_disabled() helper function

From: Michael Ellerman <hidden>
Date: 2024-11-17 12:25:38

On Sun, 27 Oct 2024 23:22:17 +0100, Thorsten Blum wrote:
Remove hard-coded strings by using the str_enabled_disabled() helper
function.
Applied to powerpc/next.

[1/1] powerpc: Use str_enabled_disabled() helper function
      https://git.kernel.org/powerpc/c/19e0a70e6c3c1bf800b8ce9eb45864aa9e1e2781

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help