diff mbox series

[U-Boot,v3,02/11] cmd: Do not show frequency for clocks which .get_rate() return error

Message ID 20190425102953.5348-3-lukma@denx.de
State Changes Requested
Delegated to: Tom Rini
Headers show
Series clk: Port Linux common clock framework [CCF] to U-boot (tag: 5.0-rc3) | expand

Commit Message

Lukasz Majewski April 25, 2019, 10:29 a.m. UTC
It may happen that some UCLASS_CLK clocks drivers work as a "managers",
to call other, proper clocks. This situation is present in the iMX{6|8}
clocks when supporting CONFIG_CLK (and CCF).

To avoid bogus output of "clk dump" we omit clocks which return error
value - allowing reusing default implementation of this command.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v3: None

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

Comments

Peng Fan April 26, 2019, 2:17 a.m. UTC | #1
> Subject: [PATCH v3 02/11] cmd: Do not show frequency for clocks
> which .get_rate() return error
> 
> It may happen that some UCLASS_CLK clocks drivers work as a "managers", to
> call other, proper clocks. This situation is present in the iMX{6|8} clocks when
> supporting CONFIG_CLK (and CCF).
> 
> To avoid bogus output of "clk dump" we omit clocks which return error value -
> allowing reusing default implementation of this command.
> 
> Signed-off-by: Lukasz Majewski <lukma@denx.de>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> 
> Changes in v3: None
> 
>  cmd/clk.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/cmd/clk.c b/cmd/clk.c
> index fd4231589c..2ea82176aa 100644
> --- a/cmd/clk.c
> +++ b/cmd/clk.c
> @@ -16,6 +16,7 @@ int __weak soc_clk_dump(void)
>  	struct udevice *dev;
>  	struct uclass *uc;
>  	struct clk clk;
> +	ulong rate;
>  	int ret;
> 
>  	/* Device addresses start at 1 */
> @@ -37,7 +38,9 @@ int __weak soc_clk_dump(void)
>  			continue;
>  		}
> 
> -		printf("%-30.30s : %lu Hz\n", dev->name, clk_get_rate(&clk));
> +		rate = clk_get_rate(&clk);
> +		if (!IS_ERR_VALUE(rate))
> +			printf("%-30.30s : %lu Hz\n", dev->name, rate);
> 
>  		clk_free(&clk);
>  	}

Reviewed-by: Peng Fan <peng.fan@nxp.com>

> --
> 2.11.0
diff mbox series

Patch

diff --git a/cmd/clk.c b/cmd/clk.c
index fd4231589c..2ea82176aa 100644
--- a/cmd/clk.c
+++ b/cmd/clk.c
@@ -16,6 +16,7 @@  int __weak soc_clk_dump(void)
 	struct udevice *dev;
 	struct uclass *uc;
 	struct clk clk;
+	ulong rate;
 	int ret;
 
 	/* Device addresses start at 1 */
@@ -37,7 +38,9 @@  int __weak soc_clk_dump(void)
 			continue;
 		}
 
-		printf("%-30.30s : %lu Hz\n", dev->name, clk_get_rate(&clk));
+		rate = clk_get_rate(&clk);
+		if (!IS_ERR_VALUE(rate))
+			printf("%-30.30s : %lu Hz\n", dev->name, rate);
 
 		clk_free(&clk);
 	}