[V2,1/4] PM / OPP: Improve debug print messages with pr_fmt

Message ID d3072ab1f6665e63d2e26db75a3d598b241d423e.1444925400.git.viresh.kumar@linaro.org
State New
Headers show

Commit Message

Viresh Kumar Oct. 15, 2015, 4:12 p.m.
With debug options on, it is difficult to locate OPP core's debug
prints. Fix this by prefixing OPP debug prints with KBUILD_MODNAME.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/base/power/opp/core.c | 2 ++
 drivers/base/power/opp/cpu.c  | 3 +++
 2 files changed, 5 insertions(+)

Comments

Stephen Boyd Oct. 15, 2015, 7:04 p.m. | #1
On 10/15, Viresh Kumar wrote:
> With debug options on, it is difficult to locate OPP core's debug
> prints. Fix this by prefixing OPP debug prints with KBUILD_MODNAME.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

Why not use dynamic debug's m flag to turn on KBUILD_MODNAME when
debugging?

From Documentation/dynamic-debug-howto.txt

  m    Include module name in the printed message
Viresh Kumar Oct. 16, 2015, 5:37 a.m. | #2
On 15-10-15, 12:04, Stephen Boyd wrote:
> On 10/15, Viresh Kumar wrote:
> > With debug options on, it is difficult to locate OPP core's debug
> > prints. Fix this by prefixing OPP debug prints with KBUILD_MODNAME.
> > 
> > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> 
> Why not use dynamic debug's m flag to turn on KBUILD_MODNAME when
> debugging?
> 
> >From Documentation/dynamic-debug-howto.txt
> 
>   m    Include module name in the printed message

It wasn't just about debug messages but pr_info and pr_err as well.
And so I defined pr_fmt instead.
Stephen Boyd Oct. 16, 2015, 7:20 p.m. | #3
On 10/16, Viresh Kumar wrote:
> On 15-10-15, 12:04, Stephen Boyd wrote:
> > On 10/15, Viresh Kumar wrote:
> > > With debug options on, it is difficult to locate OPP core's debug
> > > prints. Fix this by prefixing OPP debug prints with KBUILD_MODNAME.
> > > 
> > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> > 
> > Why not use dynamic debug's m flag to turn on KBUILD_MODNAME when
> > debugging?
> > 
> > >From Documentation/dynamic-debug-howto.txt
> > 
> >   m    Include module name in the printed message
> 
> It wasn't just about debug messages but pr_info and pr_err as well.
> And so I defined pr_fmt instead.
> 

Ok, well the commit text exclusively mentions debug, leading me
to believe this is all about making the debug prints (i.e.
pr_debug) have KBUILD_MODNAME.

Patch hide | download patch | download mbox

diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c
index d5c1149ff123..a422ebf2501f 100644
--- a/drivers/base/power/opp/core.c
+++ b/drivers/base/power/opp/core.c
@@ -11,6 +11,8 @@ 
  * published by the Free Software Foundation.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/errno.h>
 #include <linux/err.h>
 #include <linux/slab.h>
diff --git a/drivers/base/power/opp/cpu.c b/drivers/base/power/opp/cpu.c
index 7654c5606307..c27a1cdffec9 100644
--- a/drivers/base/power/opp/cpu.c
+++ b/drivers/base/power/opp/cpu.c
@@ -10,6 +10,9 @@ 
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/cpu.h>
 #include <linux/cpufreq.h>
 #include <linux/err.h>