All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] clk: Print the clock name and warning cause
@ 2018-01-16 12:50 Fabio Estevam
  2018-01-17  8:14 ` Geert Uytterhoeven
  2018-03-16 23:29 ` Stephen Boyd
  0 siblings, 2 replies; 4+ messages in thread
From: Fabio Estevam @ 2018-01-16 12:50 UTC (permalink / raw)
  To: sboyd; +Cc: mturquette, geert, festevam, linux-clk, Fabio Estevam

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>
---
Changes since v1:
- Also add the warning cause (Geert)

 drivers/clk/clk.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 0f686a9..c95dc09 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -548,7 +548,8 @@ static void clk_core_rate_unprotect(struct clk_core *core)
 	if (!core)
 		return;
 
-	if (WARN_ON(core->protect_count == 0))
+	if (WARN(core->protect_count == 0,
+	    "%s already unprotected\n", core->name))
 		return;
 
 	if (--core->protect_count > 0)
@@ -681,16 +682,18 @@ static void clk_core_unprepare(struct clk_core *core)
 	if (!core)
 		return;
 
-	if (WARN_ON(core->prepare_count == 0))
+	if (WARN(core->prepare_count == 0,
+	    "%s already unprepared\n", core->name))
 		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;
 
 	if (--core->prepare_count > 0)
 		return;
 
-	WARN_ON(core->enable_count > 0);
+	WARN(core->enable_count > 0, "Unpreparing enabled %s\n", core->name);
 
 	trace_clk_unprepare(core);
 
@@ -808,10 +811,11 @@ static void clk_core_disable(struct clk_core *core)
 	if (!core)
 		return;
 
-	if (WARN_ON(core->enable_count == 0))
+	if (WARN(core->enable_count == 0, "%s already disabled\n", core->name))
 		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;
 
 	if (--core->enable_count > 0)
@@ -866,7 +870,8 @@ static int clk_core_enable(struct clk_core *core)
 	if (!core)
 		return 0;
 
-	if (WARN_ON(core->prepare_count == 0))
+	if (WARN(core->prepare_count == 0,
+	    "Enabling unprepared %s\n", core->name))
 		return -ESHUTDOWN;
 
 	if (core->enable_count == 0) {
-- 
2.7.4

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

* Re: [PATCH v2] clk: Print the clock name and warning cause
  2018-01-16 12:50 [PATCH v2] clk: Print the clock name and warning cause Fabio Estevam
@ 2018-01-17  8:14 ` Geert Uytterhoeven
  2018-03-14 11:54   ` Fabio Estevam
  2018-03-16 23:29 ` Stephen Boyd
  1 sibling, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2018-01-17  8:14 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Stephen Boyd, Michael Turquette, Fabio Estevam, linux-clk

On Tue, Jan 16, 2018 at 1:50 PM, Fabio Estevam <fabio.estevam@nxp.com> wrote:
> 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>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v2] clk: Print the clock name and warning cause
  2018-01-17  8:14 ` Geert Uytterhoeven
@ 2018-03-14 11:54   ` Fabio Estevam
  0 siblings, 0 replies; 4+ messages in thread
From: Fabio Estevam @ 2018-03-14 11:54 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Fabio Estevam, Michael Turquette, linux-clk, Geert Uytterhoeven

Hi Stephen,

On Wed, Jan 17, 2018 at 6:14 AM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> On Tue, Jan 16, 2018 at 1:50 PM, Fabio Estevam <fabio.estevam@nxp.com> wrote:
>> 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>

Any comments, please?

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

* Re: [PATCH v2] clk: Print the clock name and warning cause
  2018-01-16 12:50 [PATCH v2] clk: Print the clock name and warning cause Fabio Estevam
  2018-01-17  8:14 ` Geert Uytterhoeven
@ 2018-03-16 23:29 ` Stephen Boyd
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2018-03-16 23:29 UTC (permalink / raw)
  To: Fabio Estevam, sboyd
  Cc: mturquette, geert, festevam, linux-clk, Fabio Estevam

Quoting Fabio Estevam (2018-01-16 04:50:34)
> 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_d=
isable+0xd4/0xf8
> [    2.396658] uart4_ipg_gate already disabled
> =

> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---

Applied to clk-next

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

end of thread, other threads:[~2018-03-16 23:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-16 12:50 [PATCH v2] clk: Print the clock name and warning cause Fabio Estevam
2018-01-17  8:14 ` Geert Uytterhoeven
2018-03-14 11:54   ` Fabio Estevam
2018-03-16 23:29 ` Stephen Boyd

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.