linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] intel_idle: Use more common logging style
@ 2017-06-09 19:29 Joe Perches
  2017-06-09 19:36 ` Andy Shevchenko
  2017-06-12 16:18 ` Jacob Pan
  0 siblings, 2 replies; 3+ messages in thread
From: Joe Perches @ 2017-06-09 19:29 UTC (permalink / raw)
  To: Jacob Pan, Len Brown; +Cc: linux-pm, linux-kernel

Remove #define PREFIX and add #define pr_fmt to use more common logging.

Miscellanea:

o Add missing newline to format
o Convert a single printk without KERN_<LEVEL> to pr_info

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/idle/intel_idle.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index 216d7ec88c0c..c2ae819a871c 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -51,6 +51,8 @@
 /* un-comment DEBUG to enable pr_debug() statements */
 #define DEBUG
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/kernel.h>
 #include <linux/cpuidle.h>
 #include <linux/tick.h>
@@ -65,7 +67,6 @@
 #include <asm/msr.h>
 
 #define INTEL_IDLE_VERSION "0.4.1"
-#define PREFIX "intel_idle: "
 
 static struct cpuidle_driver intel_idle_driver = {
 	.name = "intel_idle",
@@ -1111,7 +1112,7 @@ static int __init intel_idle_probe(void)
 	const struct x86_cpu_id *id;
 
 	if (max_cstate == 0) {
-		pr_debug(PREFIX "disabled\n");
+		pr_debug("disabled\n");
 		return -EPERM;
 	}
 
@@ -1119,8 +1120,8 @@ static int __init intel_idle_probe(void)
 	if (!id) {
 		if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
 		    boot_cpu_data.x86 == 6)
-			pr_debug(PREFIX "does not run on family %d model %d\n",
-				boot_cpu_data.x86, boot_cpu_data.x86_model);
+			pr_debug("does not run on family %d model %d\n",
+				 boot_cpu_data.x86, boot_cpu_data.x86_model);
 		return -ENODEV;
 	}
 
@@ -1134,13 +1135,13 @@ static int __init intel_idle_probe(void)
 	    !mwait_substates)
 			return -ENODEV;
 
-	pr_debug(PREFIX "MWAIT substates: 0x%x\n", mwait_substates);
+	pr_debug("MWAIT substates: 0x%x\n", mwait_substates);
 
 	icpu = (const struct idle_cpu *)id->driver_data;
 	cpuidle_state_table = icpu->state_table;
 
-	pr_debug(PREFIX "v" INTEL_IDLE_VERSION
-		" model 0x%X\n", boot_cpu_data.x86_model);
+	pr_debug("v" INTEL_IDLE_VERSION " model 0x%X\n",
+		 boot_cpu_data.x86_model);
 
 	return 0;
 }
@@ -1340,8 +1341,7 @@ static void __init intel_idle_cpuidle_driver_init(void)
 			break;
 
 		if (cstate + 1 > max_cstate) {
-			printk(PREFIX "max_cstate %d reached\n",
-				max_cstate);
+			pr_info("max_cstate %d reached\n", max_cstate);
 			break;
 		}
 
@@ -1358,8 +1358,8 @@ static void __init intel_idle_cpuidle_driver_init(void)
 
 		/* if state marked as disabled, skip it */
 		if (cpuidle_state_table[cstate].disabled != 0) {
-			pr_debug(PREFIX "state %s is disabled",
-				cpuidle_state_table[cstate].name);
+			pr_debug("state %s is disabled\n",
+				 cpuidle_state_table[cstate].name);
 			continue;
 		}
 
@@ -1395,7 +1395,7 @@ static int intel_idle_cpu_init(unsigned int cpu)
 	dev->cpu = cpu;
 
 	if (cpuidle_register_device(dev)) {
-		pr_debug(PREFIX "cpuidle_register_device %d failed!\n", cpu);
+		pr_debug("cpuidle_register_device %d failed!\n", cpu);
 		return -EIO;
 	}
 
@@ -1447,8 +1447,8 @@ static int __init intel_idle_init(void)
 	retval = cpuidle_register_driver(&intel_idle_driver);
 	if (retval) {
 		struct cpuidle_driver *drv = cpuidle_get_driver();
-		printk(KERN_DEBUG PREFIX "intel_idle yielding to %s",
-			drv ? drv->name : "none");
+		printk(KERN_DEBUG pr_fmt("intel_idle yielding to %s\n"),
+		       drv ? drv->name : "none");
 		goto init_driver_fail;
 	}
 
@@ -1460,8 +1460,8 @@ static int __init intel_idle_init(void)
 	if (retval < 0)
 		goto hp_setup_fail;
 
-	pr_debug(PREFIX "lapic_timer_reliable_states 0x%x\n",
-		lapic_timer_reliable_states);
+	pr_debug("lapic_timer_reliable_states 0x%x\n",
+		 lapic_timer_reliable_states);
 
 	return 0;
 
-- 
2.10.0.rc2.1.g053435c

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] intel_idle: Use more common logging style
  2017-06-09 19:29 [PATCH] intel_idle: Use more common logging style Joe Perches
@ 2017-06-09 19:36 ` Andy Shevchenko
  2017-06-12 16:18 ` Jacob Pan
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2017-06-09 19:36 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jacob Pan, Len Brown, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org

On Fri, Jun 9, 2017 at 10:29 PM, Joe Perches <joe@perches.com> wrote:
> Remove #define PREFIX and add #define pr_fmt to use more common logging.
>
> Miscellanea:
>
> o Add missing newline to format
> o Convert a single printk without KERN_<LEVEL> to pr_info
>

FWIW,
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  drivers/idle/intel_idle.c | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
> index 216d7ec88c0c..c2ae819a871c 100644
> --- a/drivers/idle/intel_idle.c
> +++ b/drivers/idle/intel_idle.c
> @@ -51,6 +51,8 @@
>  /* un-comment DEBUG to enable pr_debug() statements */
>  #define DEBUG
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/kernel.h>
>  #include <linux/cpuidle.h>
>  #include <linux/tick.h>
> @@ -65,7 +67,6 @@
>  #include <asm/msr.h>
>
>  #define INTEL_IDLE_VERSION "0.4.1"
> -#define PREFIX "intel_idle: "
>
>  static struct cpuidle_driver intel_idle_driver = {
>         .name = "intel_idle",
> @@ -1111,7 +1112,7 @@ static int __init intel_idle_probe(void)
>         const struct x86_cpu_id *id;
>
>         if (max_cstate == 0) {
> -               pr_debug(PREFIX "disabled\n");
> +               pr_debug("disabled\n");
>                 return -EPERM;
>         }
>
> @@ -1119,8 +1120,8 @@ static int __init intel_idle_probe(void)
>         if (!id) {
>                 if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
>                     boot_cpu_data.x86 == 6)
> -                       pr_debug(PREFIX "does not run on family %d model %d\n",
> -                               boot_cpu_data.x86, boot_cpu_data.x86_model);
> +                       pr_debug("does not run on family %d model %d\n",
> +                                boot_cpu_data.x86, boot_cpu_data.x86_model);
>                 return -ENODEV;
>         }
>
> @@ -1134,13 +1135,13 @@ static int __init intel_idle_probe(void)
>             !mwait_substates)
>                         return -ENODEV;
>
> -       pr_debug(PREFIX "MWAIT substates: 0x%x\n", mwait_substates);
> +       pr_debug("MWAIT substates: 0x%x\n", mwait_substates);
>
>         icpu = (const struct idle_cpu *)id->driver_data;
>         cpuidle_state_table = icpu->state_table;
>
> -       pr_debug(PREFIX "v" INTEL_IDLE_VERSION
> -               " model 0x%X\n", boot_cpu_data.x86_model);
> +       pr_debug("v" INTEL_IDLE_VERSION " model 0x%X\n",
> +                boot_cpu_data.x86_model);
>
>         return 0;
>  }
> @@ -1340,8 +1341,7 @@ static void __init intel_idle_cpuidle_driver_init(void)
>                         break;
>
>                 if (cstate + 1 > max_cstate) {
> -                       printk(PREFIX "max_cstate %d reached\n",
> -                               max_cstate);
> +                       pr_info("max_cstate %d reached\n", max_cstate);
>                         break;
>                 }
>
> @@ -1358,8 +1358,8 @@ static void __init intel_idle_cpuidle_driver_init(void)
>
>                 /* if state marked as disabled, skip it */
>                 if (cpuidle_state_table[cstate].disabled != 0) {
> -                       pr_debug(PREFIX "state %s is disabled",
> -                               cpuidle_state_table[cstate].name);
> +                       pr_debug("state %s is disabled\n",
> +                                cpuidle_state_table[cstate].name);
>                         continue;
>                 }
>
> @@ -1395,7 +1395,7 @@ static int intel_idle_cpu_init(unsigned int cpu)
>         dev->cpu = cpu;
>
>         if (cpuidle_register_device(dev)) {
> -               pr_debug(PREFIX "cpuidle_register_device %d failed!\n", cpu);
> +               pr_debug("cpuidle_register_device %d failed!\n", cpu);
>                 return -EIO;
>         }
>
> @@ -1447,8 +1447,8 @@ static int __init intel_idle_init(void)
>         retval = cpuidle_register_driver(&intel_idle_driver);
>         if (retval) {
>                 struct cpuidle_driver *drv = cpuidle_get_driver();
> -               printk(KERN_DEBUG PREFIX "intel_idle yielding to %s",
> -                       drv ? drv->name : "none");
> +               printk(KERN_DEBUG pr_fmt("intel_idle yielding to %s\n"),
> +                      drv ? drv->name : "none");
>                 goto init_driver_fail;
>         }
>
> @@ -1460,8 +1460,8 @@ static int __init intel_idle_init(void)
>         if (retval < 0)
>                 goto hp_setup_fail;
>
> -       pr_debug(PREFIX "lapic_timer_reliable_states 0x%x\n",
> -               lapic_timer_reliable_states);
> +       pr_debug("lapic_timer_reliable_states 0x%x\n",
> +                lapic_timer_reliable_states);
>
>         return 0;
>
> --
> 2.10.0.rc2.1.g053435c
>



-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] intel_idle: Use more common logging style
  2017-06-09 19:29 [PATCH] intel_idle: Use more common logging style Joe Perches
  2017-06-09 19:36 ` Andy Shevchenko
@ 2017-06-12 16:18 ` Jacob Pan
  1 sibling, 0 replies; 3+ messages in thread
From: Jacob Pan @ 2017-06-12 16:18 UTC (permalink / raw)
  To: Joe Perches; +Cc: Len Brown, linux-pm, linux-kernel, jacob.jun.pan

On Fri,  9 Jun 2017 12:29:20 -0700
Joe Perches <joe@perches.com> wrote:

> Remove #define PREFIX and add #define pr_fmt to use more common
> logging.
> 
> Miscellanea:
> 
> o Add missing newline to format
> o Convert a single printk without KERN_<LEVEL> to pr_info
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com>

Thanks,
> ---
>  drivers/idle/intel_idle.c | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
> index 216d7ec88c0c..c2ae819a871c 100644
> --- a/drivers/idle/intel_idle.c
> +++ b/drivers/idle/intel_idle.c
> @@ -51,6 +51,8 @@
>  /* un-comment DEBUG to enable pr_debug() statements */
>  #define DEBUG
>  
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/kernel.h>
>  #include <linux/cpuidle.h>
>  #include <linux/tick.h>
> @@ -65,7 +67,6 @@
>  #include <asm/msr.h>
>  
>  #define INTEL_IDLE_VERSION "0.4.1"
> -#define PREFIX "intel_idle: "
>  
>  static struct cpuidle_driver intel_idle_driver = {
>  	.name = "intel_idle",
> @@ -1111,7 +1112,7 @@ static int __init intel_idle_probe(void)
>  	const struct x86_cpu_id *id;
>  
>  	if (max_cstate == 0) {
> -		pr_debug(PREFIX "disabled\n");
> +		pr_debug("disabled\n");
>  		return -EPERM;
>  	}
>  
> @@ -1119,8 +1120,8 @@ static int __init intel_idle_probe(void)
>  	if (!id) {
>  		if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
>  		    boot_cpu_data.x86 == 6)
> -			pr_debug(PREFIX "does not run on family %d
> model %d\n",
> -				boot_cpu_data.x86,
> boot_cpu_data.x86_model);
> +			pr_debug("does not run on family %d model
> %d\n",
> +				 boot_cpu_data.x86,
> boot_cpu_data.x86_model); return -ENODEV;
>  	}
>  
> @@ -1134,13 +1135,13 @@ static int __init intel_idle_probe(void)
>  	    !mwait_substates)
>  			return -ENODEV;
>  
> -	pr_debug(PREFIX "MWAIT substates: 0x%x\n", mwait_substates);
> +	pr_debug("MWAIT substates: 0x%x\n", mwait_substates);
>  
>  	icpu = (const struct idle_cpu *)id->driver_data;
>  	cpuidle_state_table = icpu->state_table;
>  
> -	pr_debug(PREFIX "v" INTEL_IDLE_VERSION
> -		" model 0x%X\n", boot_cpu_data.x86_model);
> +	pr_debug("v" INTEL_IDLE_VERSION " model 0x%X\n",
> +		 boot_cpu_data.x86_model);
>  
>  	return 0;
>  }
> @@ -1340,8 +1341,7 @@ static void __init
> intel_idle_cpuidle_driver_init(void) break;
>  
>  		if (cstate + 1 > max_cstate) {
> -			printk(PREFIX "max_cstate %d reached\n",
> -				max_cstate);
> +			pr_info("max_cstate %d reached\n",
> max_cstate); break;
>  		}
>  
> @@ -1358,8 +1358,8 @@ static void __init
> intel_idle_cpuidle_driver_init(void) 
>  		/* if state marked as disabled, skip it */
>  		if (cpuidle_state_table[cstate].disabled != 0) {
> -			pr_debug(PREFIX "state %s is disabled",
> -				cpuidle_state_table[cstate].name);
> +			pr_debug("state %s is disabled\n",
> +				 cpuidle_state_table[cstate].name);
>  			continue;
>  		}
>  
> @@ -1395,7 +1395,7 @@ static int intel_idle_cpu_init(unsigned int cpu)
>  	dev->cpu = cpu;
>  
>  	if (cpuidle_register_device(dev)) {
> -		pr_debug(PREFIX "cpuidle_register_device %d
> failed!\n", cpu);
> +		pr_debug("cpuidle_register_device %d failed!\n",
> cpu); return -EIO;
>  	}
>  
> @@ -1447,8 +1447,8 @@ static int __init intel_idle_init(void)
>  	retval = cpuidle_register_driver(&intel_idle_driver);
>  	if (retval) {
>  		struct cpuidle_driver *drv = cpuidle_get_driver();
> -		printk(KERN_DEBUG PREFIX "intel_idle yielding to %s",
> -			drv ? drv->name : "none");
> +		printk(KERN_DEBUG pr_fmt("intel_idle yielding to
> %s\n"),
> +		       drv ? drv->name : "none");
>  		goto init_driver_fail;
>  	}
>  
> @@ -1460,8 +1460,8 @@ static int __init intel_idle_init(void)
>  	if (retval < 0)
>  		goto hp_setup_fail;
>  
> -	pr_debug(PREFIX "lapic_timer_reliable_states 0x%x\n",
> -		lapic_timer_reliable_states);
> +	pr_debug("lapic_timer_reliable_states 0x%x\n",
> +		 lapic_timer_reliable_states);
>  
>  	return 0;
>  

[Jacob Pan]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-12 16:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-09 19:29 [PATCH] intel_idle: Use more common logging style Joe Perches
2017-06-09 19:36 ` Andy Shevchenko
2017-06-12 16:18 ` Jacob Pan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).