aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Delaunay2020-07-30 14:04:10 +0200
committerLukasz Majewski2020-08-24 11:03:26 +0200
commit689ca8c5d123445a1d23f515fd1c8fb407cfb622 (patch)
tree6afb285ca3c3a7e4747e194b36ddf2717fe3a13c
parentcc6328412c3ba40c324f531fa5648d08573db110 (diff)
cmd: clk: correctly handle depth for clk dump
Update depth only when clock uclass is found to have correct display of command "clk dump". Without this patch, the displayed depth is the binding depth for all the uclass and that can be strange as only clock uclass nodes are displayed. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--cmd/clk.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/clk.c b/cmd/clk.c
index ba4540334ab..e3c3d2f9bb2 100644
--- a/cmd/clk.c
+++ b/cmd/clk.c
@@ -23,6 +23,7 @@ static void show_clks(struct udevice *dev, int depth, int last_flag)
clkp = dev_get_clk_ptr(dev);
if (device_get_uclass_id(dev) == UCLASS_CLK && clkp) {
+ depth++;
rate = clk_get_rate(clkp);
printf(" %-12u %8d ", rate, clkp->enable_count);
@@ -47,7 +48,7 @@ static void show_clks(struct udevice *dev, int depth, int last_flag)
list_for_each_entry(child, &dev->child_head, sibling_node) {
is_last = list_is_last(&child->sibling_node, &dev->child_head);
- show_clks(child, depth + 1, (last_flag << 1) | is_last);
+ show_clks(child, depth, (last_flag << 1) | is_last);
}
}