[PATCH] clk: Add more information to debug messages

Sean Anderson seanga2 at gmail.com
Fri Mar 20 06:53:16 CET 2020


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);
-- 
2.25.1



More information about the U-Boot mailing list