* [PATCH 0/2] clk qcom rpmh fixes
@ 2020-03-09 22:12 Stephen Boyd
2020-03-09 22:12 ` [PATCH 1/2] clk: qcom: rpmh: Simplify clk_rpmh_bcm_send_cmd() Stephen Boyd
2020-03-09 22:12 ` [PATCH 2/2] clk: qcom: rpmh: Drop unnecessary semicolons Stephen Boyd
0 siblings, 2 replies; 5+ messages in thread
From: Stephen Boyd @ 2020-03-09 22:12 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd; +Cc: linux-kernel, linux-clk
I had to read this driver today so I'm reworking it a
little to ease readability. Based upon patches I've applied
to clk-qcom in clk.git
Stephen Boyd (2):
clk: qcom: rpmh: Simplify clk_rpmh_bcm_send_cmd()
clk: qcom: rpmh: Drop unnecessary semicolons
drivers/clk/qcom/clk-rpmh.c | 41 ++++++++++++++++---------------------
1 file changed, 18 insertions(+), 23 deletions(-)
base-commit: cd5d5d8dec5e08e3e6ded9fa8366750a203b1d2a
--
Sent by a computer, using git, on the internet
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] clk: qcom: rpmh: Simplify clk_rpmh_bcm_send_cmd()
2020-03-09 22:12 [PATCH 0/2] clk qcom rpmh fixes Stephen Boyd
@ 2020-03-09 22:12 ` Stephen Boyd
2020-03-25 2:33 ` Stephen Boyd
2020-03-09 22:12 ` [PATCH 2/2] clk: qcom: rpmh: Drop unnecessary semicolons Stephen Boyd
1 sibling, 1 reply; 5+ messages in thread
From: Stephen Boyd @ 2020-03-09 22:12 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-kernel, linux-clk, Bjorn Andersson, Taniya Das
This function has some duplication in unlocking a mutex and returns in a
few different places. Let's use some if statements to consolidate code
and make this a bit easier to read.
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
CC: Taniya Das <tdas@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
---
drivers/clk/qcom/clk-rpmh.c | 33 ++++++++++++++-------------------
1 file changed, 14 insertions(+), 19 deletions(-)
diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c
index bfc29aec3a78..b1b277b55682 100644
--- a/drivers/clk/qcom/clk-rpmh.c
+++ b/drivers/clk/qcom/clk-rpmh.c
@@ -259,38 +259,33 @@ static int clk_rpmh_bcm_send_cmd(struct clk_rpmh *c, bool enable)
{
struct tcs_cmd cmd = { 0 };
u32 cmd_state;
- int ret;
+ int ret = 0;
mutex_lock(&rpmh_clk_lock);
-
- cmd_state = 0;
if (enable) {
cmd_state = 1;
if (c->aggr_state)
cmd_state = c->aggr_state;
+ } else {
+ cmd_state = 0;
}
- if (c->last_sent_aggr_state == cmd_state) {
- mutex_unlock(&rpmh_clk_lock);
- return 0;
- }
-
- cmd.addr = c->res_addr;
- cmd.data = BCM_TCS_CMD(1, enable, 0, cmd_state);
+ if (c->last_sent_aggr_state != cmd_state) {
+ cmd.addr = c->res_addr;
+ cmd.data = BCM_TCS_CMD(1, enable, 0, cmd_state);
- ret = clk_rpmh_send(c, RPMH_ACTIVE_ONLY_STATE, &cmd, enable);
- if (ret) {
- dev_err(c->dev, "set active state of %s failed: (%d)\n",
- c->res_name, ret);
- mutex_unlock(&rpmh_clk_lock);
- return ret;
+ ret = clk_rpmh_send(c, RPMH_ACTIVE_ONLY_STATE, &cmd, enable);
+ if (ret) {
+ dev_err(c->dev, "set active state of %s failed: (%d)\n",
+ c->res_name, ret);
+ } else {
+ c->last_sent_aggr_state = cmd_state;
+ }
}
- c->last_sent_aggr_state = cmd_state;
-
mutex_unlock(&rpmh_clk_lock);
- return 0;
+ return ret;
}
static int clk_rpmh_bcm_prepare(struct clk_hw *hw)
--
Sent by a computer, using git, on the internet
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] clk: qcom: rpmh: Drop unnecessary semicolons
2020-03-09 22:12 [PATCH 0/2] clk qcom rpmh fixes Stephen Boyd
2020-03-09 22:12 ` [PATCH 1/2] clk: qcom: rpmh: Simplify clk_rpmh_bcm_send_cmd() Stephen Boyd
@ 2020-03-09 22:12 ` Stephen Boyd
2020-03-25 2:33 ` Stephen Boyd
1 sibling, 1 reply; 5+ messages in thread
From: Stephen Boyd @ 2020-03-09 22:12 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-kernel, linux-clk, Bjorn Andersson, Taniya Das
Some functions end in }; which is just bad style. Remove the extra
semicolon.
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Taniya Das <tdas@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
---
drivers/clk/qcom/clk-rpmh.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c
index b1b277b55682..e2c669b08aff 100644
--- a/drivers/clk/qcom/clk-rpmh.c
+++ b/drivers/clk/qcom/clk-rpmh.c
@@ -227,7 +227,7 @@ static int clk_rpmh_prepare(struct clk_hw *hw)
mutex_unlock(&rpmh_clk_lock);
return ret;
-};
+}
static void clk_rpmh_unprepare(struct clk_hw *hw)
{
@@ -293,14 +293,14 @@ static int clk_rpmh_bcm_prepare(struct clk_hw *hw)
struct clk_rpmh *c = to_clk_rpmh(hw);
return clk_rpmh_bcm_send_cmd(c, true);
-};
+}
static void clk_rpmh_bcm_unprepare(struct clk_hw *hw)
{
struct clk_rpmh *c = to_clk_rpmh(hw);
clk_rpmh_bcm_send_cmd(c, false);
-};
+}
static int clk_rpmh_bcm_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
@@ -316,7 +316,7 @@ static int clk_rpmh_bcm_set_rate(struct clk_hw *hw, unsigned long rate,
clk_rpmh_bcm_send_cmd(c, true);
return 0;
-};
+}
static long clk_rpmh_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate)
--
Sent by a computer, using git, on the internet
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] clk: qcom: rpmh: Simplify clk_rpmh_bcm_send_cmd()
2020-03-09 22:12 ` [PATCH 1/2] clk: qcom: rpmh: Simplify clk_rpmh_bcm_send_cmd() Stephen Boyd
@ 2020-03-25 2:33 ` Stephen Boyd
0 siblings, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2020-03-25 2:33 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-kernel, linux-clk, Bjorn Andersson, Taniya Das
Quoting Stephen Boyd (2020-03-09 15:12:31)
> This function has some duplication in unlocking a mutex and returns in a
> few different places. Let's use some if statements to consolidate code
> and make this a bit easier to read.
>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> CC: Taniya Das <tdas@codeaurora.org>
> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
> ---
Applied to clk-next
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] clk: qcom: rpmh: Drop unnecessary semicolons
2020-03-09 22:12 ` [PATCH 2/2] clk: qcom: rpmh: Drop unnecessary semicolons Stephen Boyd
@ 2020-03-25 2:33 ` Stephen Boyd
0 siblings, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2020-03-25 2:33 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-kernel, linux-clk, Bjorn Andersson, Taniya Das
Quoting Stephen Boyd (2020-03-09 15:12:32)
> Some functions end in }; which is just bad style. Remove the extra
> semicolon.
>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Cc: Taniya Das <tdas@codeaurora.org>
> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
> ---
Applied to clk-next
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-03-25 2:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09 22:12 [PATCH 0/2] clk qcom rpmh fixes Stephen Boyd
2020-03-09 22:12 ` [PATCH 1/2] clk: qcom: rpmh: Simplify clk_rpmh_bcm_send_cmd() Stephen Boyd
2020-03-25 2:33 ` Stephen Boyd
2020-03-09 22:12 ` [PATCH 2/2] clk: qcom: rpmh: Drop unnecessary semicolons Stephen Boyd
2020-03-25 2:33 ` Stephen Boyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).