clk: Show clock rate and error value when fail to set clock rate
PATCH v2 1/1 clk: Show clock rate and error value when fail to set clock rate
This patch shows the current clock rate nad error value when clk_set_rate() fail to set the clock rate because log messgae means only the clock rate.
---
Changes from v1:
- Add error value of clk-set_rate() with current clock rate
drivers/clk/clk-conf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clk/clk-conf.c +3 -2
@@ -107,8 +107,9 @@ static int __set_clk_rates(struct device_node *node, bool clk_supplier) rc =clk_set_rate (clk, rate);if (rc <0 ) -pr_err ("clk: couldn't set %s clock rate: %d\n" , -__clk_get_name (clk), rc); +pr_err ("clk: couldn't set %s rate to %ld (%d)\n" , +__clk_get_name (clk),clk_get_rate (clk), + rc);clk_put (clk); } index++;
Signature · 1 line
1.8.5.5
Hi Chanwoo,
Quoted 19 lines · Chanwoo Choi
This patch shows the current clock rate nad error value when
clk_set_rate()fail to set the clock rate because log messgae means only the clock rate.Cc Mike Turquette <[email protected]>Cc Stephen Boyd <[email protected]>Cc Sylwester Nawrocki <[email protected]>Signed-off-by Chanwoo Choi <[email protected]>---
Changes from v1:
- Add error value of clk-set_rate() with current clock ratedrivers/clk/clk-conf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/clk/clk-conf.c +0
-0
drivers/clk/clk-conf.c static int __set_clk_rates(struct device_node *node, bool clk_supplier) · line 112
Quoted 8 lines
drivers/clk/clk-conf.c +3
-2@@ -107,8 +107,9 @@ static int __set_clk_rates(struct device_node *node, bool clk_supplier) rc =clk_set_rate (clk, rate);if (rc <0 ) -pr_err ("clk: couldn't set %s clock rate: %d\n" , -__clk_get_name (clk), rc); +pr_err ("clk: couldn't set %s rate to %ld (%d)\n" , +__clk_get_name (clk),clk_get_rate (clk), + rc);
Apologies for my previous misleading comment, with this patch you log current clock rate as the rate which was attempted to be set. And these two will likely be different when clk_set_rate() failed. So it should rather be:
pr_err("clk: couldn't set %s clk rate to %ld (%d)\n",
__clk_get_name(clk), rate, rc);
If you really need to log current rate, then it could be changed to:
pr_err("clk: couldn't set %s clk rate to %ld (%d), current rate: %ld\n",
__clk_get_name(clk), rate, rc, clk_get_rate(clk));
But I doubt we need to log all these parameters. The clock rate changes could be logged with the ftrace functionality added recently to the clk core.
Quoted 3 lines
drivers/clk/clk-conf.c +0
-0clk_put (clk); } index++;
Signature · 2 lines
Regards, Sylwester
Hi Sylwester,
Quoted 36 lines · Sylwester Nawrocki
Hi Chanwoo,
Quoted 19 lines · Chanwoo Choi
This patch shows the current clock rate nad error value when
clk_set_rate()fail to set the clock rate because log messgae means only the clock rate.Cc Mike Turquette <[email protected]>Cc Stephen Boyd <[email protected]>Cc Sylwester Nawrocki <[email protected]>Signed-off-by Chanwoo Choi <[email protected]>---
Changes from v1:
- Add error value of clk-set_rate() with current clock ratedrivers/clk/clk-conf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/clk/clk-conf.c +0
-0drivers/clk/clk-conf.c static int __set_clk_rates(struct device_node *node, bool clk_supplier) · line 112
Quoted 8 lines
drivers/clk/clk-conf.c +3
-2@@ -107,8 +107,9 @@ static int __set_clk_rates(struct device_node *node, bool clk_supplier) rc =clk_set_rate (clk, rate);if (rc <0 ) -pr_err ("clk: couldn't set %s clock rate: %d\n" , -__clk_get_name (clk), rc); +pr_err ("clk: couldn't set %s rate to %ld (%d)\n" , +__clk_get_name (clk),clk_get_rate (clk), + rc);Apologies for my previous misleading comment, with this patch you log current clock rate as the rate which was attempted to be set. And these two will likely be different when
clk_set_rate()failed. So it should rather be:
Quoted 2 lines
pr_err("clk: couldn't set %s clk rate to %ld (%d)\n",
__clk_get_name(clk), rate, rc);
I'll modify it as following without error value.
If I add the error value, the number of character are over 80.
pr_err("clk: couldn't set %s clk rate to %ld\n",
__clk_get_name(clk), rate);Thanks,
Chanwoo Choi
Hi Chanwoo,
Quoted 19 lines · Chanwoo Choi
Quoted 19 lines
Quoted 19 lines
drivers/clk/clk-conf.c +0
-0Quoted 5 lines
Quoted 5 lines
index aad4796..2b6375f 100644
drivers/clk/clk-conf.c +0
-0@@ -107,8 +107,9 @@ static int __set_clk_rates(struct device_node *node, bool clk_supplier)Quoted 7 lines
drivers/clk/clk-conf.c static int __set_clk_rates(struct device_node *node, bool clk_supplier) · line 112
Quoted 7 lines
drivers/clk/clk-conf.c +3
-2rc =clk_set_rate (clk, rate);if (rc <0 ) -pr_err ("clk: couldn't set %s clock rate: %d\n" , -__clk_get_name (clk), rc); +pr_err ("clk: couldn't set %s rate to %ld (%d)\n" , +__clk_get_name (clk),clk_get_rate (clk), + rc);Apologies for my previous misleading comment, with this patch you log current clock rate as the rate which was attempted to be set. And these two will likely be different when
clk_set_rate()failed. So it should rather be:
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
pr_err("clk: couldn't set %s clk rate to %ld (%d)\n",
__clk_get_name(clk), rate, rc);I'll modify it as following without error value.
If I add the error value, the number of character are over 80.pr_err("clk: couldn't set %s clk rate to %ld\n", __clk_get_name(clk), rate);
I wouldn't worry about line length over 80 characters, it not a hard rule. Let's leave the error code as it might be useful for debugging.
Signature · 2 lines
Regards, Sylwester
Hi Sylwester,
Quoted 25 lines · Sylwester Nawrocki
Hi Chanwoo,
Quoted 22 lines · Chanwoo Choi
Quoted 21 lines
Quoted 21 lines
drivers/clk/clk-conf.c +0
-0Quoted 5 lines
Quoted 5 lines
index aad4796..2b6375f 100644
drivers/clk/clk-conf.c +0
-0@@ -107,8 +107,9 @@ static int __set_clk_rates(struct device_node *node, bool clk_supplier)Quoted 7 lines
drivers/clk/clk-conf.c static int __set_clk_rates(struct device_node *node, bool clk_supplier) · line 112
Quoted 7 lines
drivers/clk/clk-conf.c +3
-2rc =clk_set_rate (clk, rate);if (rc <0 ) -pr_err ("clk: couldn't set %s clock rate: %d\n" , -__clk_get_name (clk), rc); +pr_err ("clk: couldn't set %s rate to %ld (%d)\n" , +__clk_get_name (clk),clk_get_rate (clk), + rc);Apologies for my previous misleading comment, with this patch you log current clock rate as the rate which was attempted to be set. And these two will likely be different when
clk_set_rate()failed. So it should rather be:pr_err("clk: couldn't set %s clk rate to %ld (%d)\n",
__clk_get_name(clk), rate, rc);
Quoted 8 lines
Quoted 4 lines
I'll modify it as following without error value.
If I add the error value, the number of character are over 80.pr_err("clk: couldn't set %s clk rate to %ld\n", __clk_get_name(clk), rate);I wouldn't worry about line length over 80 characters, it not a hard rule. Let's leave the error code as it might be useful for debugging.
OK, I'll add error value again.
Thanks,
Chanwoo Choi
Quoted 33 lines · Chanwoo Choi
Hi Sylwester,
Quoted 30 lines · Sylwester Nawrocki
Hi Chanwoo,
Quoted 26 lines · Chanwoo Choi
Quoted 19 lines
Quoted 19 lines
drivers/clk/clk-conf.c +0
-0Quoted 5 lines
Quoted 5 lines
index aad4796..2b6375f 100644
drivers/clk/clk-conf.c +0
-0@@ -107,8 +107,9 @@ static int __set_clk_rates(struct device_node *node, bool clk_supplier)Quoted 7 lines
drivers/clk/clk-conf.c static int __set_clk_rates(struct device_node *node, bool clk_supplier) · line 112
Quoted 7 lines
drivers/clk/clk-conf.c +3
-2rc =clk_set_rate (clk, rate);if (rc <0 ) -pr_err ("clk: couldn't set %s clock rate: %d\n" , -__clk_get_name (clk), rc); +pr_err ("clk: couldn't set %s rate to %ld (%d)\n" , +__clk_get_name (clk),clk_get_rate (clk), + rc);Apologies for my previous misleading comment, with this patch you log current clock rate as the rate which was attempted to be set. And these two will likely be different when
clk_set_rate()failed. So it should rather be:Quoted 2 lines
Quoted 2 lines
pr_err("clk: couldn't set %s clk rate to %ld (%d)\n",
__clk_get_name(clk), rate, rc);I'll modify it as following without error value.
If I add the error value, the number of character are over 80.pr_err("clk: couldn't set %s clk rate to %ld\n", __clk_get_name(clk), rate);
Quoted 5 lines
Quoted 3 lines
I wouldn't worry about line length over 80 characters, it not a hard rule. Let's leave the error code as it might be useful for debugging.
OK, I'll add error value again.
As you commented, I'll add all information as following:
pr_err("clk: couldn't set %s clk rate to %ld (%d), current rate: %ld\n",
__clk_get_name(clk), rate, rc, clk_get_rate(clk));Thanks,
Chanwoo Choi