diff mbox series

clk: zynqmp: warn always when a clock op fails

Message ID 20220112141229.700708-1-m.tretter@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series clk: zynqmp: warn always when a clock op fails | expand

Commit Message

Michael Tretter Jan. 12, 2022, 2:12 p.m. UTC
The warning that a clock operation failed is only printed once. However,
the function is called for various different clocks. The limit hides
warnings if different clock are affected by the failures.

Print the warning every time when a clock operation fails.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 drivers/clk/zynqmp/clk-gate-zynqmp.c | 12 +++++------
 drivers/clk/zynqmp/clk-mux-zynqmp.c  |  8 +++----
 drivers/clk/zynqmp/divider.c         | 12 +++++------
 drivers/clk/zynqmp/pll.c             | 32 ++++++++++++++--------------
 4 files changed, 32 insertions(+), 32 deletions(-)

Comments

Stephen Boyd Jan. 12, 2022, 8:29 p.m. UTC | #1
Quoting Michael Tretter (2022-01-12 06:12:29)
> The warning that a clock operation failed is only printed once. However,
> the function is called for various different clocks. The limit hides
> warnings if different clock are affected by the failures.
> 
> Print the warning every time when a clock operation fails.
> 
> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> ---
>  drivers/clk/zynqmp/clk-gate-zynqmp.c | 12 +++++------
>  drivers/clk/zynqmp/clk-mux-zynqmp.c  |  8 +++----
>  drivers/clk/zynqmp/divider.c         | 12 +++++------
>  drivers/clk/zynqmp/pll.c             | 32 ++++++++++++++--------------
>  4 files changed, 32 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/clk/zynqmp/clk-gate-zynqmp.c b/drivers/clk/zynqmp/clk-gate-zynqmp.c
> index 565ed67a0430..0d9a39110f29 100644
> --- a/drivers/clk/zynqmp/clk-gate-zynqmp.c
> +++ b/drivers/clk/zynqmp/clk-gate-zynqmp.c
> @@ -41,8 +41,8 @@ static int zynqmp_clk_gate_enable(struct clk_hw *hw)
>         ret = zynqmp_pm_clock_enable(clk_id);
>  
>         if (ret)
> -               pr_warn_once("%s() clock enabled failed for %s, ret = %d\n",
> -                            __func__, clk_name, ret);
> +               pr_warn("%s() clock enable failed for %s (id %d), ret = %d\n",
> +                       __func__, clk_name, clk_id, ret);

Can we just remove these prints entirely? The driver that calls
clk_enable() should be checking the return value and taking proper
action. What is the user going to do with these messages?
Michael Tretter Jan. 14, 2022, 8:14 a.m. UTC | #2
On Wed, 12 Jan 2022 12:29:35 -0800, Stephen Boyd wrote:
> Quoting Michael Tretter (2022-01-12 06:12:29)
> > The warning that a clock operation failed is only printed once. However,
> > the function is called for various different clocks. The limit hides
> > warnings if different clock are affected by the failures.
> > 
> > Print the warning every time when a clock operation fails.
> > 
> > Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> > ---
> >  drivers/clk/zynqmp/clk-gate-zynqmp.c | 12 +++++------
> >  drivers/clk/zynqmp/clk-mux-zynqmp.c  |  8 +++----
> >  drivers/clk/zynqmp/divider.c         | 12 +++++------
> >  drivers/clk/zynqmp/pll.c             | 32 ++++++++++++++--------------
> >  4 files changed, 32 insertions(+), 32 deletions(-)
> > 
> > diff --git a/drivers/clk/zynqmp/clk-gate-zynqmp.c b/drivers/clk/zynqmp/clk-gate-zynqmp.c
> > index 565ed67a0430..0d9a39110f29 100644
> > --- a/drivers/clk/zynqmp/clk-gate-zynqmp.c
> > +++ b/drivers/clk/zynqmp/clk-gate-zynqmp.c
> > @@ -41,8 +41,8 @@ static int zynqmp_clk_gate_enable(struct clk_hw *hw)
> >         ret = zynqmp_pm_clock_enable(clk_id);
> >  
> >         if (ret)
> > -               pr_warn_once("%s() clock enabled failed for %s, ret = %d\n",
> > -                            __func__, clk_name, ret);
> > +               pr_warn("%s() clock enable failed for %s (id %d), ret = %d\n",
> > +                       __func__, clk_name, clk_id, ret);
> 
> Can we just remove these prints entirely? The driver that calls
> clk_enable() should be checking the return value and taking proper
> action. What is the user going to do with these messages?
> 

The clocks are handled by a firmware, which checks if the Linux system has the
permission to change certain clocks. The warnings help users to identify an
unexpected configuration of the firmware. However, I guess it would make sense
to change the warnings to pr_debug.

Michael
Stephen Boyd Jan. 14, 2022, 10:20 p.m. UTC | #3
Quoting Michael Tretter (2022-01-14 00:14:42)
> On Wed, 12 Jan 2022 12:29:35 -0800, Stephen Boyd wrote:
> > Quoting Michael Tretter (2022-01-12 06:12:29)
> > > The warning that a clock operation failed is only printed once. However,
> > > the function is called for various different clocks. The limit hides
> > > warnings if different clock are affected by the failures.
> > > 
> > > Print the warning every time when a clock operation fails.
> > > 
> > > Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> > > ---
> > >  drivers/clk/zynqmp/clk-gate-zynqmp.c | 12 +++++------
> > >  drivers/clk/zynqmp/clk-mux-zynqmp.c  |  8 +++----
> > >  drivers/clk/zynqmp/divider.c         | 12 +++++------
> > >  drivers/clk/zynqmp/pll.c             | 32 ++++++++++++++--------------
> > >  4 files changed, 32 insertions(+), 32 deletions(-)
> > > 
> > > diff --git a/drivers/clk/zynqmp/clk-gate-zynqmp.c b/drivers/clk/zynqmp/clk-gate-zynqmp.c
> > > index 565ed67a0430..0d9a39110f29 100644
> > > --- a/drivers/clk/zynqmp/clk-gate-zynqmp.c
> > > +++ b/drivers/clk/zynqmp/clk-gate-zynqmp.c
> > > @@ -41,8 +41,8 @@ static int zynqmp_clk_gate_enable(struct clk_hw *hw)
> > >         ret = zynqmp_pm_clock_enable(clk_id);
> > >  
> > >         if (ret)
> > > -               pr_warn_once("%s() clock enabled failed for %s, ret = %d\n",
> > > -                            __func__, clk_name, ret);
> > > +               pr_warn("%s() clock enable failed for %s (id %d), ret = %d\n",
> > > +                       __func__, clk_name, clk_id, ret);
> > 
> > Can we just remove these prints entirely? The driver that calls
> > clk_enable() should be checking the return value and taking proper
> > action. What is the user going to do with these messages?
> > 
> 
> The clocks are handled by a firmware, which checks if the Linux system has the
> permission to change certain clocks. The warnings help users to identify an
> unexpected configuration of the firmware. However, I guess it would make sense
> to change the warnings to pr_debug.
> 

Sure pr_debug() sounds fine.
diff mbox series

Patch

diff --git a/drivers/clk/zynqmp/clk-gate-zynqmp.c b/drivers/clk/zynqmp/clk-gate-zynqmp.c
index 565ed67a0430..0d9a39110f29 100644
--- a/drivers/clk/zynqmp/clk-gate-zynqmp.c
+++ b/drivers/clk/zynqmp/clk-gate-zynqmp.c
@@ -41,8 +41,8 @@  static int zynqmp_clk_gate_enable(struct clk_hw *hw)
 	ret = zynqmp_pm_clock_enable(clk_id);
 
 	if (ret)
-		pr_warn_once("%s() clock enabled failed for %s, ret = %d\n",
-			     __func__, clk_name, ret);
+		pr_warn("%s() clock enable failed for %s (id %d), ret = %d\n",
+			__func__, clk_name, clk_id, ret);
 
 	return ret;
 }
@@ -61,8 +61,8 @@  static void zynqmp_clk_gate_disable(struct clk_hw *hw)
 	ret = zynqmp_pm_clock_disable(clk_id);
 
 	if (ret)
-		pr_warn_once("%s() clock disable failed for %s, ret = %d\n",
-			     __func__, clk_name, ret);
+		pr_warn("%s() clock disable failed for %s (id %d), ret = %d\n",
+			__func__, clk_name, clk_id, ret);
 }
 
 /**
@@ -80,8 +80,8 @@  static int zynqmp_clk_gate_is_enabled(struct clk_hw *hw)
 
 	ret = zynqmp_pm_clock_getstate(clk_id, &state);
 	if (ret) {
-		pr_warn_once("%s() clock get state failed for %s, ret = %d\n",
-			     __func__, clk_name, ret);
+		pr_warn("%s() clock get state failed for %s, ret = %d\n",
+			__func__, clk_name, ret);
 		return -EIO;
 	}
 
diff --git a/drivers/clk/zynqmp/clk-mux-zynqmp.c b/drivers/clk/zynqmp/clk-mux-zynqmp.c
index 17afce594f28..6bc16500231e 100644
--- a/drivers/clk/zynqmp/clk-mux-zynqmp.c
+++ b/drivers/clk/zynqmp/clk-mux-zynqmp.c
@@ -51,8 +51,8 @@  static u8 zynqmp_clk_mux_get_parent(struct clk_hw *hw)
 	ret = zynqmp_pm_clock_getparent(clk_id, &val);
 
 	if (ret) {
-		pr_warn_once("%s() getparent failed for clock: %s, ret = %d\n",
-			     __func__, clk_name, ret);
+		pr_warn("%s() getparent failed for clock: %s, ret = %d\n",
+			__func__, clk_name, ret);
 		/*
 		 * clk_core_get_parent_by_index() takes num_parents as incorrect
 		 * index which is exactly what I want to return here
@@ -80,8 +80,8 @@  static int zynqmp_clk_mux_set_parent(struct clk_hw *hw, u8 index)
 	ret = zynqmp_pm_clock_setparent(clk_id, index);
 
 	if (ret)
-		pr_warn_once("%s() set parent failed for clock: %s, ret = %d\n",
-			     __func__, clk_name, ret);
+		pr_warn("%s() set parent failed for clock: %s, ret = %d\n",
+			__func__, clk_name, ret);
 
 	return ret;
 }
diff --git a/drivers/clk/zynqmp/divider.c b/drivers/clk/zynqmp/divider.c
index cb49281f9cf9..c6d6a2fb5866 100644
--- a/drivers/clk/zynqmp/divider.c
+++ b/drivers/clk/zynqmp/divider.c
@@ -89,8 +89,8 @@  static unsigned long zynqmp_clk_divider_recalc_rate(struct clk_hw *hw,
 	ret = zynqmp_pm_clock_getdivider(clk_id, &div);
 
 	if (ret)
-		pr_warn_once("%s() get divider failed for %s, ret = %d\n",
-			     __func__, clk_name, ret);
+		pr_warn("%s() get divider failed for %s, ret = %d\n",
+			__func__, clk_name, ret);
 
 	if (div_type == TYPE_DIV1)
 		value = div & 0xFFFF;
@@ -177,8 +177,8 @@  static long zynqmp_clk_divider_round_rate(struct clk_hw *hw,
 		ret = zynqmp_pm_clock_getdivider(clk_id, &bestdiv);
 
 		if (ret)
-			pr_warn_once("%s() get divider failed for %s, ret = %d\n",
-				     __func__, clk_name, ret);
+			pr_warn("%s() get divider failed for %s, ret = %d\n",
+				__func__, clk_name, ret);
 		if (div_type == TYPE_DIV1)
 			bestdiv = bestdiv & 0xFFFF;
 		else
@@ -244,8 +244,8 @@  static int zynqmp_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
 	ret = zynqmp_pm_clock_setdivider(clk_id, div);
 
 	if (ret)
-		pr_warn_once("%s() set divider failed for %s, ret = %d\n",
-			     __func__, clk_name, ret);
+		pr_warn("%s() set divider failed for %s, ret = %d\n",
+			__func__, clk_name, ret);
 
 	return ret;
 }
diff --git a/drivers/clk/zynqmp/pll.c b/drivers/clk/zynqmp/pll.c
index 036e4ff64a2f..6c4dfae3df1d 100644
--- a/drivers/clk/zynqmp/pll.c
+++ b/drivers/clk/zynqmp/pll.c
@@ -56,8 +56,8 @@  static inline enum pll_mode zynqmp_pll_get_mode(struct clk_hw *hw)
 
 	ret = zynqmp_pm_get_pll_frac_mode(clk_id, ret_payload);
 	if (ret) {
-		pr_warn_once("%s() PLL get frac mode failed for %s, ret = %d\n",
-			     __func__, clk_name, ret);
+		pr_warn("%s() PLL get frac mode failed for %s, ret = %d\n",
+			__func__, clk_name, ret);
 		return PLL_MODE_ERROR;
 	}
 
@@ -84,8 +84,8 @@  static inline void zynqmp_pll_set_mode(struct clk_hw *hw, bool on)
 
 	ret = zynqmp_pm_set_pll_frac_mode(clk_id, mode);
 	if (ret)
-		pr_warn_once("%s() PLL set frac mode failed for %s, ret = %d\n",
-			     __func__, clk_name, ret);
+		pr_warn("%s() PLL set frac mode failed for %s, ret = %d\n",
+			__func__, clk_name, ret);
 	else
 		clk->set_pll_mode = true;
 }
@@ -145,8 +145,8 @@  static unsigned long zynqmp_pll_recalc_rate(struct clk_hw *hw,
 
 	ret = zynqmp_pm_clock_getdivider(clk_id, &fbdiv);
 	if (ret) {
-		pr_warn_once("%s() get divider failed for %s, ret = %d\n",
-			     __func__, clk_name, ret);
+		pr_warn("%s() get divider failed for %s, ret = %d\n",
+			__func__, clk_name, ret);
 		return 0ul;
 	}
 
@@ -200,8 +200,8 @@  static int zynqmp_pll_set_rate(struct clk_hw *hw, unsigned long rate,
 			WARN(1, "More than allowed devices are using the %s, which is forbidden\n",
 			     clk_name);
 		else if (ret)
-			pr_warn_once("%s() set divider failed for %s, ret = %d\n",
-				     __func__, clk_name, ret);
+			pr_warn("%s() set divider failed for %s, ret = %d\n",
+				__func__, clk_name, ret);
 		zynqmp_pm_set_pll_frac_data(clk_id, f);
 
 		return rate + frac;
@@ -211,8 +211,8 @@  static int zynqmp_pll_set_rate(struct clk_hw *hw, unsigned long rate,
 	fbdiv = clamp_t(u32, fbdiv, PLL_FBDIV_MIN, PLL_FBDIV_MAX);
 	ret = zynqmp_pm_clock_setdivider(clk_id, fbdiv);
 	if (ret)
-		pr_warn_once("%s() set divider failed for %s, ret = %d\n",
-			     __func__, clk_name, ret);
+		pr_warn("%s() set divider failed for %s, ret = %d\n",
+			__func__, clk_name, ret);
 
 	return parent_rate * fbdiv;
 }
@@ -233,8 +233,8 @@  static int zynqmp_pll_is_enabled(struct clk_hw *hw)
 
 	ret = zynqmp_pm_clock_getstate(clk_id, &state);
 	if (ret) {
-		pr_warn_once("%s() clock get state failed for %s, ret = %d\n",
-			     __func__, clk_name, ret);
+		pr_warn("%s() clock get state failed for %s, ret = %d\n",
+			__func__, clk_name, ret);
 		return -EIO;
 	}
 
@@ -265,8 +265,8 @@  static int zynqmp_pll_enable(struct clk_hw *hw)
 
 	ret = zynqmp_pm_clock_enable(clk_id);
 	if (ret)
-		pr_warn_once("%s() clock enable failed for %s, ret = %d\n",
-			     __func__, clk_name, ret);
+		pr_warn("%s() clock enable failed for %s, ret = %d\n",
+			__func__, clk_name, ret);
 
 	return ret;
 }
@@ -287,8 +287,8 @@  static void zynqmp_pll_disable(struct clk_hw *hw)
 
 	ret = zynqmp_pm_clock_disable(clk_id);
 	if (ret)
-		pr_warn_once("%s() clock disable failed for %s, ret = %d\n",
-			     __func__, clk_name, ret);
+		pr_warn("%s() clock disable failed for %s, ret = %d\n",
+			__func__, clk_name, ret);
 }
 
 static const struct clk_ops zynqmp_pll_ops = {