All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] cmd: clk: cosmetic: correct code alignment in show_clks
@ 2020-07-30 12:04 Patrick Delaunay
  2020-07-30 12:04 ` [PATCH 2/2] cmd: clk: correctly handle depth for clk dump Patrick Delaunay
  2020-08-16  3:39 ` [PATCH 1/2] cmd: clk: cosmetic: correct code alignment in show_clks Simon Glass
  0 siblings, 2 replies; 4+ messages in thread
From: Patrick Delaunay @ 2020-07-30 12:04 UTC (permalink / raw)
  To: u-boot

Correct code alignment in show_clks() function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 cmd/clk.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/cmd/clk.c b/cmd/clk.c
index 439736d072..ba4540334a 100644
--- a/cmd/clk.c
+++ b/cmd/clk.c
@@ -25,24 +25,24 @@ static void show_clks(struct udevice *dev, int depth, int last_flag)
 	if (device_get_uclass_id(dev) == UCLASS_CLK && clkp) {
 		rate = clk_get_rate(clkp);
 
-	printf(" %-12u  %8d        ", rate, clkp->enable_count);
-
-	for (i = depth; i >= 0; i--) {
-		is_last = (last_flag >> i) & 1;
-		if (i) {
-			if (is_last)
-				printf("    ");
-			else
-				printf("|   ");
-		} else {
-			if (is_last)
-				printf("`-- ");
-			else
-				printf("|-- ");
+		printf(" %-12u  %8d        ", rate, clkp->enable_count);
+
+		for (i = depth; i >= 0; i--) {
+			is_last = (last_flag >> i) & 1;
+			if (i) {
+				if (is_last)
+					printf("    ");
+				else
+					printf("|   ");
+			} else {
+				if (is_last)
+					printf("`-- ");
+				else
+					printf("|-- ");
+			}
 		}
-	}
 
-	printf("%s\n", dev->name);
+		printf("%s\n", dev->name);
 	}
 
 	list_for_each_entry(child, &dev->child_head, sibling_node) {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] cmd: clk: correctly handle depth for clk dump
  2020-07-30 12:04 [PATCH 1/2] cmd: clk: cosmetic: correct code alignment in show_clks Patrick Delaunay
@ 2020-07-30 12:04 ` Patrick Delaunay
  2020-08-16  3:39   ` Simon Glass
  2020-08-16  3:39 ` [PATCH 1/2] cmd: clk: cosmetic: correct code alignment in show_clks Simon Glass
  1 sibling, 1 reply; 4+ messages in thread
From: Patrick Delaunay @ 2020-07-30 12:04 UTC (permalink / raw)
  To: u-boot

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

 cmd/clk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cmd/clk.c b/cmd/clk.c
index ba4540334a..e3c3d2f9bb 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);
 	}
 }
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 1/2] cmd: clk: cosmetic: correct code alignment in show_clks
  2020-07-30 12:04 [PATCH 1/2] cmd: clk: cosmetic: correct code alignment in show_clks Patrick Delaunay
  2020-07-30 12:04 ` [PATCH 2/2] cmd: clk: correctly handle depth for clk dump Patrick Delaunay
@ 2020-08-16  3:39 ` Simon Glass
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Glass @ 2020-08-16  3:39 UTC (permalink / raw)
  To: u-boot

On Thu, 30 Jul 2020 at 06:04, Patrick Delaunay <patrick.delaunay@st.com> wrote:
>
> Correct code alignment in show_clks() function.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
>  cmd/clk.c | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] cmd: clk: correctly handle depth for clk dump
  2020-07-30 12:04 ` [PATCH 2/2] cmd: clk: correctly handle depth for clk dump Patrick Delaunay
@ 2020-08-16  3:39   ` Simon Glass
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2020-08-16  3:39 UTC (permalink / raw)
  To: u-boot

On Thu, 30 Jul 2020 at 06:04, Patrick Delaunay <patrick.delaunay@st.com> wrote:
>
> 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>
> ---
>
>  cmd/clk.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-16  3:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30 12:04 [PATCH 1/2] cmd: clk: cosmetic: correct code alignment in show_clks Patrick Delaunay
2020-07-30 12:04 ` [PATCH 2/2] cmd: clk: correctly handle depth for clk dump Patrick Delaunay
2020-08-16  3:39   ` Simon Glass
2020-08-16  3:39 ` [PATCH 1/2] cmd: clk: cosmetic: correct code alignment in show_clks Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.