diff mbox series

[08/13] powerpc/rtas: define pr_fmt and convert printk call sites

Message ID 20221118150751.469393-9-nathanl@linux.ibm.com (mailing list archive)
State Accepted
Commit f975b6559bac510f1b1b39637997bb240f0a9969
Headers show
Series RTAS maintenance | expand

Commit Message

Nathan Lynch Nov. 18, 2022, 3:07 p.m. UTC
Set pr_fmt to "rtas: " and convert the handful of printk() uses in
rtas.c, adjusting the messages to remove now-redundant "RTAS"
strings.

Note that rtas_restart(), rtas_power_off(), and rtas_halt() all
currently use printk() without specifying a log level. These have been
changed to use pr_emerg(), which matches the behavior of
rtas_os_term().

Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
---
 arch/powerpc/kernel/rtas.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

Comments

Andrew Donnellan Nov. 22, 2022, 4:07 a.m. UTC | #1
On Fri, 2022-11-18 at 09:07 -0600, Nathan Lynch wrote:
> Set pr_fmt to "rtas: " and convert the handful of printk() uses in
> rtas.c, adjusting the messages to remove now-redundant "RTAS"
> strings.
> 
> Note that rtas_restart(), rtas_power_off(), and rtas_halt() all
> currently use printk() without specifying a log level. These have
> been
> changed to use pr_emerg(), which matches the behavior of
> rtas_os_term().
> 
> Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>

Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>

> ---
>  arch/powerpc/kernel/rtas.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
> index 7a5812624e11..c3142d352f41 100644
> --- a/arch/powerpc/kernel/rtas.c
> +++ b/arch/powerpc/kernel/rtas.c
> @@ -7,6 +7,8 @@
>   * Copyright (C) 2001 IBM.
>   */
>  
> +#define pr_fmt(fmt)    "rtas: " fmt
> +
>  #include <linux/capability.h>
>  #include <linux/delay.h>
>  #include <linux/export.h>
> @@ -718,8 +720,7 @@ static int rtas_error_rc(int rtas_rc)
>                         rc = -ENODEV;
>                         break;
>                 default:
> -                       printk(KERN_ERR "%s: unexpected RTAS error
> %d\n",
> -                                       __func__, rtas_rc);
> +                       pr_err("%s: unexpected error %d\n", __func__,
> rtas_rc);
>                         rc = -ERANGE;
>                         break;
>         }
> @@ -923,8 +924,8 @@ void __noreturn rtas_restart(char *cmd)
>  {
>         if (rtas_flash_term_hook)
>                 rtas_flash_term_hook(SYS_RESTART);
> -       printk("RTAS system-reboot returned %d\n",
> -              rtas_call(rtas_token("system-reboot"), 0, 1, NULL));
> +       pr_emerg("system-reboot returned %d\n",
> +                rtas_call(rtas_token("system-reboot"), 0, 1, NULL));
>         for (;;);
>  }
>  
> @@ -933,8 +934,8 @@ void rtas_power_off(void)
>         if (rtas_flash_term_hook)
>                 rtas_flash_term_hook(SYS_POWER_OFF);
>         /* allow power on only with power button press */
> -       printk("RTAS power-off returned %d\n",
> -              rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -
> 1));
> +       pr_emerg("power-off returned %d\n",
> +                rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -
> 1));
>         for (;;);
>  }
>  
> @@ -943,8 +944,8 @@ void __noreturn rtas_halt(void)
>         if (rtas_flash_term_hook)
>                 rtas_flash_term_hook(SYS_HALT);
>         /* allow power on only with power button press */
> -       printk("RTAS power-off returned %d\n",
> -              rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -
> 1));
> +       pr_emerg("power-off returned %d\n",
> +                rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -
> 1));
>         for (;;);
>  }
>  
> @@ -979,7 +980,7 @@ void rtas_os_term(char *str)
>         } while (rtas_busy_delay_time(status));
>  
>         if (status != 0)
> -               printk(KERN_EMERG "ibm,os-term call failed %d\n",
> status);
> +               pr_emerg("ibm,os-term call failed %d\n", status);
>  }
>  
>  /**
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 7a5812624e11..c3142d352f41 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -7,6 +7,8 @@ 
  * Copyright (C) 2001 IBM.
  */
 
+#define pr_fmt(fmt)	"rtas: " fmt
+
 #include <linux/capability.h>
 #include <linux/delay.h>
 #include <linux/export.h>
@@ -718,8 +720,7 @@  static int rtas_error_rc(int rtas_rc)
 			rc = -ENODEV;
 			break;
 		default:
-			printk(KERN_ERR "%s: unexpected RTAS error %d\n",
-					__func__, rtas_rc);
+			pr_err("%s: unexpected error %d\n", __func__, rtas_rc);
 			rc = -ERANGE;
 			break;
 	}
@@ -923,8 +924,8 @@  void __noreturn rtas_restart(char *cmd)
 {
 	if (rtas_flash_term_hook)
 		rtas_flash_term_hook(SYS_RESTART);
-	printk("RTAS system-reboot returned %d\n",
-	       rtas_call(rtas_token("system-reboot"), 0, 1, NULL));
+	pr_emerg("system-reboot returned %d\n",
+		 rtas_call(rtas_token("system-reboot"), 0, 1, NULL));
 	for (;;);
 }
 
@@ -933,8 +934,8 @@  void rtas_power_off(void)
 	if (rtas_flash_term_hook)
 		rtas_flash_term_hook(SYS_POWER_OFF);
 	/* allow power on only with power button press */
-	printk("RTAS power-off returned %d\n",
-	       rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1));
+	pr_emerg("power-off returned %d\n",
+		 rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1));
 	for (;;);
 }
 
@@ -943,8 +944,8 @@  void __noreturn rtas_halt(void)
 	if (rtas_flash_term_hook)
 		rtas_flash_term_hook(SYS_HALT);
 	/* allow power on only with power button press */
-	printk("RTAS power-off returned %d\n",
-	       rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1));
+	pr_emerg("power-off returned %d\n",
+		 rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1));
 	for (;;);
 }
 
@@ -979,7 +980,7 @@  void rtas_os_term(char *str)
 	} while (rtas_busy_delay_time(status));
 
 	if (status != 0)
-		printk(KERN_EMERG "ibm,os-term call failed %d\n", status);
+		pr_emerg("ibm,os-term call failed %d\n", status);
 }
 
 /**