[PATCH] clk: Add more information to debug messages

Sean Anderson seanga2 at gmail.com
Wed Sep 9 22:39:16 CEST 2020


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 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
> 
> *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


More information about the U-Boot mailing list