diff mbox series

clk: Add more information to debug messages

Message ID 20200320055316.746438-1-seanga2@gmail.com
State New
Headers show
Series clk: Add more information to debug messages | expand

Commit Message

Sean Anderson March 20, 2020, 5:53 a.m. UTC
Some of the debug messages in the clock subsystem can be made more
informative by adding the clock name or adding the explicit error.

Signed-off-by: Sean Anderson <seanga2 at gmail.com>
---

 drivers/clk/clk-uclass.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

Comments

Lukasz Majewski March 20, 2020, 7:10 a.m. UTC | #1
On Fri, 20 Mar 2020 01:53:16 -0400
Sean Anderson <seanga2 at gmail.com> wrote:

> Some of the debug messages in the clock subsystem can be made more
> informative by adding the clock name or adding the explicit error.
> 
> Signed-off-by: Sean Anderson <seanga2 at gmail.com>
> ---
> 
>  drivers/clk/clk-uclass.c | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
> index 71878474eb..d44df05680 100644
> --- a/drivers/clk/clk-uclass.c
> +++ b/drivers/clk/clk-uclass.c
> @@ -237,8 +237,8 @@ static int clk_set_default_parents(struct udevice
> *dev, int stage) continue;
>  
>  		if (ret < 0) {
> -			debug("%s: failed to reparent clock %d for
> %s\n",
> -			      __func__, index, dev_read_name(dev));
> +			debug("%s: failed to reparent clock %d for
> %s (err = %d)\n",
> +			      __func__, index, dev_read_name(dev),
> ret); return ret;
>  		}
>  	}
> @@ -295,8 +295,8 @@ static int clk_set_default_rates(struct udevice
> *dev, int stage) ret = clk_set_rate(&clk, rates[index]);
>  
>  		if (ret < 0) {
> -			debug("%s: failed to set rate on clock index
> %d (%ld) for %s\n",
> -			      __func__, index, clk.id,
> dev_read_name(dev));
> +			debug("%s: failed to set rate on clock index
> %d (%ld) for %s (err = %d)\n",
> +			      __func__, index, clk.id,
> dev_read_name(dev), ret); break;
>  		}
>  	}
> @@ -436,7 +436,7 @@ ulong clk_get_rate(struct clk *clk)
>  {
>  	const struct clk_ops *ops;
>  
> -	debug("%s(clk=%p)\n", __func__, clk);
> +	debug("%s(clk=%p \"%s\")\n", __func__, clk, clk->dev->name);
>  	if (!clk_valid(clk))
>  		return 0;
>  	ops = clk_dev_ops(clk->dev);
> @@ -452,7 +452,7 @@ struct clk *clk_get_parent(struct clk *clk)
>  	struct udevice *pdev;
>  	struct clk *pclk;
>  
> -	debug("%s(clk=%p)\n", __func__, clk);
> +	debug("%s(clk=%p) \"%s\"\n", __func__, clk, clk->dev->name);
>  	if (!clk_valid(clk))
>  		return NULL;
>  
> @@ -469,7 +469,7 @@ long long clk_get_parent_rate(struct clk *clk)
>  	const struct clk_ops *ops;
>  	struct clk *pclk;
>  
> -	debug("%s(clk=%p)\n", __func__, clk);
> +	debug("%s(clk=%p \"%s\")\n", __func__, clk, clk->dev->name);
>  	if (!clk_valid(clk))
>  		return 0;
>  
> @@ -492,7 +492,8 @@ ulong clk_set_rate(struct clk *clk, ulong rate)
>  {
>  	const struct clk_ops *ops;
>  
> -	debug("%s(clk=%p, rate=%lu)\n", __func__, clk, rate);
> +	debug("%s(clk=%p \"%s\", rate=%lu)\n", __func__, clk,
> clk->dev->name,
> +	      rate);
>  	if (!clk_valid(clk))
>  		return 0;
>  	ops = clk_dev_ops(clk->dev);
> @@ -507,7 +508,8 @@ int clk_set_parent(struct clk *clk, struct clk
> *parent) {
>  	const struct clk_ops *ops;
>  
> -	debug("%s(clk=%p, parent=%p)\n", __func__, clk, parent);
> +	debug("%s(clk=%p \"%s\", parent=%p \"%s\")\n", __func__, clk,
> +	      clk->dev->name, parent, parent->dev->name);
>  	if (!clk_valid(clk))
>  		return 0;
>  	ops = clk_dev_ops(clk->dev);
> @@ -524,7 +526,7 @@ int clk_enable(struct clk *clk)
>  	struct clk *clkp = NULL;
>  	int ret;
>  
> -	debug("%s(clk=%p)\n", __func__, clk);
> +	debug("%s(clk=%p \"%s\")\n", __func__, clk, clk->dev->name);
>  	if (!clk_valid(clk))
>  		return 0;
>  	ops = clk_dev_ops(clk->dev);
> @@ -584,7 +586,7 @@ int clk_disable(struct clk *clk)
>  	struct clk *clkp = NULL;
>  	int ret;
>  
> -	debug("%s(clk=%p)\n", __func__, clk);
> +	debug("%s(clk=%p) \"%s\"\n", __func__, clk, clk->dev->name);
>  	if (!clk_valid(clk))
>  		return 0;
>  	ops = clk_dev_ops(clk->dev);

Acked-by: Lukasz Majewski <lukma at denx.de>


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200320/2d932705/attachment.sig>
Sean Anderson Sept. 9, 2020, 8:39 p.m. UTC | #2
On 6/30/20 5:55 AM, Sean Anderson wrote:
> On 3/20/20 3:10 AM, Lukasz Majewski wrote:

>> On Fri, 20 Mar 2020 01:53:16 -0400

>> Sean Anderson <seanga2@gmail.com> wrote:

>>

>>> Some of the debug messages in the clock subsystem can be made more

>>> informative by adding the clock name or adding the explicit error.

>>>

>>> Signed-off-by: Sean Anderson <seanga2@gmail.com>

>>> ---

>>>

>>>  drivers/clk/clk-uclass.c | 24 +++++++++++++-----------

>>>  1 file changed, 13 insertions(+), 11 deletions(-)

>>>

>>> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c

>>> index 71878474eb..d44df05680 100644

>>> --- a/drivers/clk/clk-uclass.c

>>> +++ b/drivers/clk/clk-uclass.c

>>> @@ -237,8 +237,8 @@ static int clk_set_default_parents(struct udevice

>>> *dev, int stage) continue;

>>>  

>>>  		if (ret < 0) {

>>> -			debug("%s: failed to reparent clock %d for

>>> %s\n",

>>> -			      __func__, index, dev_read_name(dev));

>>> +			debug("%s: failed to reparent clock %d for

>>> %s (err = %d)\n",

>>> +			      __func__, index, dev_read_name(dev),

>>> ret); return ret;

>>>  		}

>>>  	}

>>> @@ -295,8 +295,8 @@ static int clk_set_default_rates(struct udevice

>>> *dev, int stage) ret = clk_set_rate(&clk, rates[index]);

>>>  

>>>  		if (ret < 0) {

>>> -			debug("%s: failed to set rate on clock index

>>> %d (%ld) for %s\n",

>>> -			      __func__, index, clk.id,

>>> dev_read_name(dev));

>>> +			debug("%s: failed to set rate on clock index

>>> %d (%ld) for %s (err = %d)\n",

>>> +			      __func__, index, clk.id,

>>> dev_read_name(dev), ret); break;

>>>  		}

>>>  	}

>>> @@ -436,7 +436,7 @@ ulong clk_get_rate(struct clk *clk)

>>>  {

>>>  	const struct clk_ops *ops;

>>>  

>>> -	debug("%s(clk=%p)\n", __func__, clk);

>>> +	debug("%s(clk=%p \"%s\")\n", __func__, clk, clk->dev->name);

>>>  	if (!clk_valid(clk))

>>>  		return 0;

>>>  	ops = clk_dev_ops(clk->dev);

>>> @@ -452,7 +452,7 @@ struct clk *clk_get_parent(struct clk *clk)

>>>  	struct udevice *pdev;

>>>  	struct clk *pclk;

>>>  

>>> -	debug("%s(clk=%p)\n", __func__, clk);

>>> +	debug("%s(clk=%p) \"%s\"\n", __func__, clk, clk->dev->name);

>>>  	if (!clk_valid(clk))

>>>  		return NULL;

>>>  

>>> @@ -469,7 +469,7 @@ long long clk_get_parent_rate(struct clk *clk)

>>>  	const struct clk_ops *ops;

>>>  	struct clk *pclk;

>>>  

>>> -	debug("%s(clk=%p)\n", __func__, clk);

>>> +	debug("%s(clk=%p \"%s\")\n", __func__, clk, clk->dev->name);

>>>  	if (!clk_valid(clk))

>>>  		return 0;

>>>  

>>> @@ -492,7 +492,8 @@ ulong clk_set_rate(struct clk *clk, ulong rate)

>>>  {

>>>  	const struct clk_ops *ops;

>>>  

>>> -	debug("%s(clk=%p, rate=%lu)\n", __func__, clk, rate);

>>> +	debug("%s(clk=%p \"%s\", rate=%lu)\n", __func__, clk,

>>> clk->dev->name,

>>> +	      rate);

>>>  	if (!clk_valid(clk))

>>>  		return 0;

>>>  	ops = clk_dev_ops(clk->dev);

>>> @@ -507,7 +508,8 @@ int clk_set_parent(struct clk *clk, struct clk

>>> *parent) {

>>>  	const struct clk_ops *ops;

>>>  

>>> -	debug("%s(clk=%p, parent=%p)\n", __func__, clk, parent);

>>> +	debug("%s(clk=%p \"%s\", parent=%p \"%s\")\n", __func__, clk,

>>> +	      clk->dev->name, parent, parent->dev->name);

>>>  	if (!clk_valid(clk))

>>>  		return 0;

>>>  	ops = clk_dev_ops(clk->dev);

>>> @@ -524,7 +526,7 @@ int clk_enable(struct clk *clk)

>>>  	struct clk *clkp = NULL;

>>>  	int ret;

>>>  

>>> -	debug("%s(clk=%p)\n", __func__, clk);

>>> +	debug("%s(clk=%p \"%s\")\n", __func__, clk, clk->dev->name);

>>>  	if (!clk_valid(clk))

>>>  		return 0;

>>>  	ops = clk_dev_ops(clk->dev);

>>> @@ -584,7 +586,7 @@ int clk_disable(struct clk *clk)

>>>  	struct clk *clkp = NULL;

>>>  	int ret;

>>>  

>>> -	debug("%s(clk=%p)\n", __func__, clk);

>>> +	debug("%s(clk=%p) \"%s\"\n", __func__, clk, clk->dev->name);

>>>  	if (!clk_valid(clk))

>>>  		return 0;

>>>  	ops = clk_dev_ops(clk->dev);

>>

>> Acked-by: Lukasz Majewski <lukma@denx.de>

>>

>>

>> Best regards,

>>

>> Lukasz Majewski

> 

> *bump*

> 

> Is anything going to come of this?


Second *bump*. It looks like this is not going to end up in the clock
tree. Can anyone else pick this up? Thanks.

--Sean
Simon Glass Sept. 10, 2020, 1:38 p.m. UTC | #3
On Wed, 9 Sep 2020 at 14:39, Sean Anderson <seanga2@gmail.com> wrote:
>

> On 6/30/20 5:55 AM, Sean Anderson wrote:

> > On 3/20/20 3:10 AM, Lukasz Majewski wrote:

> >> On Fri, 20 Mar 2020 01:53:16 -0400

> >> Sean Anderson <seanga2@gmail.com> wrote:

> >>

> >>> Some of the debug messages in the clock subsystem can be made more

> >>> informative by adding the clock name or adding the explicit error.

> >>>

> >>> Signed-off-by: Sean Anderson <seanga2@gmail.com>

> >>> ---

> >>>

> >>>  drivers/clk/clk-uclass.c | 24 +++++++++++++-----------

> >>>  1 file changed, 13 insertions(+), 11 deletions(-)

> >>>


Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox series

Patch

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 71878474eb..d44df05680 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -237,8 +237,8 @@  static int clk_set_default_parents(struct udevice *dev, int stage)
 			continue;
 
 		if (ret < 0) {
-			debug("%s: failed to reparent clock %d for %s\n",
-			      __func__, index, dev_read_name(dev));
+			debug("%s: failed to reparent clock %d for %s (err = %d)\n",
+			      __func__, index, dev_read_name(dev), ret);
 			return ret;
 		}
 	}
@@ -295,8 +295,8 @@  static int clk_set_default_rates(struct udevice *dev, int stage)
 		ret = clk_set_rate(&clk, rates[index]);
 
 		if (ret < 0) {
-			debug("%s: failed to set rate on clock index %d (%ld) for %s\n",
-			      __func__, index, clk.id, dev_read_name(dev));
+			debug("%s: failed to set rate on clock index %d (%ld) for %s (err = %d)\n",
+			      __func__, index, clk.id, dev_read_name(dev), ret);
 			break;
 		}
 	}
@@ -436,7 +436,7 @@  ulong clk_get_rate(struct clk *clk)
 {
 	const struct clk_ops *ops;
 
-	debug("%s(clk=%p)\n", __func__, clk);
+	debug("%s(clk=%p \"%s\")\n", __func__, clk, clk->dev->name);
 	if (!clk_valid(clk))
 		return 0;
 	ops = clk_dev_ops(clk->dev);
@@ -452,7 +452,7 @@  struct clk *clk_get_parent(struct clk *clk)
 	struct udevice *pdev;
 	struct clk *pclk;
 
-	debug("%s(clk=%p)\n", __func__, clk);
+	debug("%s(clk=%p) \"%s\"\n", __func__, clk, clk->dev->name);
 	if (!clk_valid(clk))
 		return NULL;
 
@@ -469,7 +469,7 @@  long long clk_get_parent_rate(struct clk *clk)
 	const struct clk_ops *ops;
 	struct clk *pclk;
 
-	debug("%s(clk=%p)\n", __func__, clk);
+	debug("%s(clk=%p \"%s\")\n", __func__, clk, clk->dev->name);
 	if (!clk_valid(clk))
 		return 0;
 
@@ -492,7 +492,8 @@  ulong clk_set_rate(struct clk *clk, ulong rate)
 {
 	const struct clk_ops *ops;
 
-	debug("%s(clk=%p, rate=%lu)\n", __func__, clk, rate);
+	debug("%s(clk=%p \"%s\", rate=%lu)\n", __func__, clk, clk->dev->name,
+	      rate);
 	if (!clk_valid(clk))
 		return 0;
 	ops = clk_dev_ops(clk->dev);
@@ -507,7 +508,8 @@  int clk_set_parent(struct clk *clk, struct clk *parent)
 {
 	const struct clk_ops *ops;
 
-	debug("%s(clk=%p, parent=%p)\n", __func__, clk, parent);
+	debug("%s(clk=%p \"%s\", parent=%p \"%s\")\n", __func__, clk,
+	      clk->dev->name, parent, parent->dev->name);
 	if (!clk_valid(clk))
 		return 0;
 	ops = clk_dev_ops(clk->dev);
@@ -524,7 +526,7 @@  int clk_enable(struct clk *clk)
 	struct clk *clkp = NULL;
 	int ret;
 
-	debug("%s(clk=%p)\n", __func__, clk);
+	debug("%s(clk=%p \"%s\")\n", __func__, clk, clk->dev->name);
 	if (!clk_valid(clk))
 		return 0;
 	ops = clk_dev_ops(clk->dev);
@@ -584,7 +586,7 @@  int clk_disable(struct clk *clk)
 	struct clk *clkp = NULL;
 	int ret;
 
-	debug("%s(clk=%p)\n", __func__, clk);
+	debug("%s(clk=%p) \"%s\"\n", __func__, clk, clk->dev->name);
 	if (!clk_valid(clk))
 		return 0;
 	ops = clk_dev_ops(clk->dev);