瀏覽代碼

clk: Print the clock name and warning cause

When getting the clock related warnings, it is useful to know what
is the clock name that is causing the problem and the cause of the
problem.

Add the clock name and the the warning cause to the log, so that the
output becomes clearer like this:

[    2.383969] ------------[ cut here ]------------
[    2.388720] WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:814 clk_core_disable+0xd4/0xf8
[    2.396658] uart4_ipg_gate already disabled

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Fabio Estevam 7 年之前
父節點
當前提交
ab525dcccf
共有 1 個文件被更改,包括 12 次插入7 次删除
  1. 12 7
      drivers/clk/clk.c

+ 12 - 7
drivers/clk/clk.c

@@ -548,7 +548,8 @@ static void clk_core_rate_unprotect(struct clk_core *core)
 	if (!core)
 	if (!core)
 		return;
 		return;
 
 
-	if (WARN_ON(core->protect_count == 0))
+	if (WARN(core->protect_count == 0,
+	    "%s already unprotected\n", core->name))
 		return;
 		return;
 
 
 	if (--core->protect_count > 0)
 	if (--core->protect_count > 0)
@@ -681,16 +682,18 @@ static void clk_core_unprepare(struct clk_core *core)
 	if (!core)
 	if (!core)
 		return;
 		return;
 
 
-	if (WARN_ON(core->prepare_count == 0))
+	if (WARN(core->prepare_count == 0,
+	    "%s already unprepared\n", core->name))
 		return;
 		return;
 
 
-	if (WARN_ON(core->prepare_count == 1 && core->flags & CLK_IS_CRITICAL))
+	if (WARN(core->prepare_count == 1 && core->flags & CLK_IS_CRITICAL,
+	    "Unpreparing critical %s\n", core->name))
 		return;
 		return;
 
 
 	if (--core->prepare_count > 0)
 	if (--core->prepare_count > 0)
 		return;
 		return;
 
 
-	WARN_ON(core->enable_count > 0);
+	WARN(core->enable_count > 0, "Unpreparing enabled %s\n", core->name);
 
 
 	trace_clk_unprepare(core);
 	trace_clk_unprepare(core);
 
 
@@ -808,10 +811,11 @@ static void clk_core_disable(struct clk_core *core)
 	if (!core)
 	if (!core)
 		return;
 		return;
 
 
-	if (WARN_ON(core->enable_count == 0))
+	if (WARN(core->enable_count == 0, "%s already disabled\n", core->name))
 		return;
 		return;
 
 
-	if (WARN_ON(core->enable_count == 1 && core->flags & CLK_IS_CRITICAL))
+	if (WARN(core->enable_count == 1 && core->flags & CLK_IS_CRITICAL,
+	    "Disabling critical %s\n", core->name))
 		return;
 		return;
 
 
 	if (--core->enable_count > 0)
 	if (--core->enable_count > 0)
@@ -866,7 +870,8 @@ static int clk_core_enable(struct clk_core *core)
 	if (!core)
 	if (!core)
 		return 0;
 		return 0;
 
 
-	if (WARN_ON(core->prepare_count == 0))
+	if (WARN(core->prepare_count == 0,
+	    "Enabling unprepared %s\n", core->name))
 		return -ESHUTDOWN;
 		return -ESHUTDOWN;
 
 
 	if (core->enable_count == 0) {
 	if (core->enable_count == 0) {