* [PATCH] soc: qcom: rpmh: Use __fill_rpmh_msg API during rpmh_write()
@ 2020-06-18 13:14 Maulik Shah
2020-06-19 8:23 ` Stephen Boyd
2020-11-26 19:50 ` patchwork-bot+linux-arm-msm
0 siblings, 2 replies; 4+ messages in thread
From: Maulik Shah @ 2020-06-18 13:14 UTC (permalink / raw)
To: bjorn.andersson, agross
Cc: linux-arm-msm, linux-kernel, dianders, swboyd, rnayak, ilina,
lsrao, Maulik Shah
Use __fill_rpmh_msg API during rpmh_write(). This allows to
remove duplication of code in error checking, copying commands
and setting message state.
Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
---
drivers/soc/qcom/rpmh.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/soc/qcom/rpmh.c b/drivers/soc/qcom/rpmh.c
index f2b5b46c..a0a0b97 100644
--- a/drivers/soc/qcom/rpmh.c
+++ b/drivers/soc/qcom/rpmh.c
@@ -181,8 +181,6 @@ static int __rpmh_write(const struct device *dev, enum rpmh_state state,
struct cache_req *req;
int i;
- rpm_msg->msg.state = state;
-
/* Cache the request in our store and link the payload */
for (i = 0; i < rpm_msg->msg.num_cmds; i++) {
req = cache_rpm_request(ctrlr, state, &rpm_msg->msg.cmds[i]);
@@ -190,8 +188,6 @@ static int __rpmh_write(const struct device *dev, enum rpmh_state state,
return PTR_ERR(req);
}
- rpm_msg->msg.state = state;
-
if (state == RPMH_ACTIVE_ONLY_STATE) {
WARN_ON(irqs_disabled());
ret = rpmh_rsc_send_data(ctrlr_to_drv(ctrlr), &rpm_msg->msg);
@@ -268,11 +264,9 @@ int rpmh_write(const struct device *dev, enum rpmh_state state,
DEFINE_RPMH_MSG_ONSTACK(dev, state, &compl, rpm_msg);
int ret;
- if (!cmd || !n || n > MAX_RPMH_PAYLOAD)
- return -EINVAL;
-
- memcpy(rpm_msg.cmd, cmd, n * sizeof(*cmd));
- rpm_msg.msg.num_cmds = n;
+ ret = __fill_rpmh_msg(&rpm_msg, state, cmd, n);
+ if (ret)
+ return ret;
ret = __rpmh_write(dev, state, &rpm_msg);
if (ret)
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] soc: qcom: rpmh: Use __fill_rpmh_msg API during rpmh_write()
2020-06-18 13:14 [PATCH] soc: qcom: rpmh: Use __fill_rpmh_msg API during rpmh_write() Maulik Shah
@ 2020-06-19 8:23 ` Stephen Boyd
2020-06-22 9:33 ` Maulik Shah
2020-11-26 19:50 ` patchwork-bot+linux-arm-msm
1 sibling, 1 reply; 4+ messages in thread
From: Stephen Boyd @ 2020-06-19 8:23 UTC (permalink / raw)
To: Maulik Shah, agross, bjorn.andersson
Cc: linux-arm-msm, linux-kernel, dianders, rnayak, ilina, lsrao,
Maulik Shah
Quoting Maulik Shah (2020-06-18 06:14:11)
> Use __fill_rpmh_msg API during rpmh_write(). This allows to
> remove duplication of code in error checking, copying commands
> and setting message state.
>
> Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
> ---
> drivers/soc/qcom/rpmh.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/soc/qcom/rpmh.c b/drivers/soc/qcom/rpmh.c
> index f2b5b46c..a0a0b97 100644
> --- a/drivers/soc/qcom/rpmh.c
> +++ b/drivers/soc/qcom/rpmh.c
> @@ -181,8 +181,6 @@ static int __rpmh_write(const struct device *dev, enum rpmh_state state,
> struct cache_req *req;
> int i;
>
> - rpm_msg->msg.state = state;
> -
> /* Cache the request in our store and link the payload */
> for (i = 0; i < rpm_msg->msg.num_cmds; i++) {
> req = cache_rpm_request(ctrlr, state, &rpm_msg->msg.cmds[i]);
> @@ -190,8 +188,6 @@ static int __rpmh_write(const struct device *dev, enum rpmh_state state,
> return PTR_ERR(req);
> }
>
> - rpm_msg->msg.state = state;
> -
> if (state == RPMH_ACTIVE_ONLY_STATE) {
> WARN_ON(irqs_disabled());
> ret = rpmh_rsc_send_data(ctrlr_to_drv(ctrlr), &rpm_msg->msg);
Were these two hunks just nonsense assignments to rpm_msg->msg.state?
> @@ -268,11 +264,9 @@ int rpmh_write(const struct device *dev, enum rpmh_state state,
> DEFINE_RPMH_MSG_ONSTACK(dev, state, &compl, rpm_msg);
> int ret;
>
> - if (!cmd || !n || n > MAX_RPMH_PAYLOAD)
> - return -EINVAL;
> -
> - memcpy(rpm_msg.cmd, cmd, n * sizeof(*cmd));
> - rpm_msg.msg.num_cmds = n;
> + ret = __fill_rpmh_msg(&rpm_msg, state, cmd, n);
> + if (ret)
> + return ret;
This part makes sense and is discussed in the commit text.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] soc: qcom: rpmh: Use __fill_rpmh_msg API during rpmh_write()
2020-06-19 8:23 ` Stephen Boyd
@ 2020-06-22 9:33 ` Maulik Shah
0 siblings, 0 replies; 4+ messages in thread
From: Maulik Shah @ 2020-06-22 9:33 UTC (permalink / raw)
To: Stephen Boyd, agross, bjorn.andersson
Cc: linux-arm-msm, linux-kernel, dianders, rnayak, ilina, lsrao
Hi,
On 6/19/2020 1:53 PM, Stephen Boyd wrote:
> Quoting Maulik Shah (2020-06-18 06:14:11)
>> Use __fill_rpmh_msg API during rpmh_write(). This allows to
>> remove duplication of code in error checking, copying commands
>> and setting message state.
>>
>> Signed-off-by: Maulik Shah<mkshah@codeaurora.org>
>> ---
>> drivers/soc/qcom/rpmh.c | 12 +++---------
>> 1 file changed, 3 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/soc/qcom/rpmh.c b/drivers/soc/qcom/rpmh.c
>> index f2b5b46c..a0a0b97 100644
>> --- a/drivers/soc/qcom/rpmh.c
>> +++ b/drivers/soc/qcom/rpmh.c
>> @@ -181,8 +181,6 @@ static int __rpmh_write(const struct device *dev, enum rpmh_state state,
>> struct cache_req *req;
>> int i;
>>
>> - rpm_msg->msg.state = state;
>> -
>> /* Cache the request in our store and link the payload */
>> for (i = 0; i < rpm_msg->msg.num_cmds; i++) {
>> req = cache_rpm_request(ctrlr, state, &rpm_msg->msg.cmds[i]);
>> @@ -190,8 +188,6 @@ static int __rpmh_write(const struct device *dev, enum rpmh_state state,
>> return PTR_ERR(req);
>> }
>>
>> - rpm_msg->msg.state = state;
>> -
>> if (state == RPMH_ACTIVE_ONLY_STATE) {
>> WARN_ON(irqs_disabled());
>> ret = rpmh_rsc_send_data(ctrlr_to_drv(ctrlr), &rpm_msg->msg);
> Were these two hunks just nonsense assignments to rpm_msg->msg.state?
yes, using __fill_rpmh_msg() and DEFINE_RPMH_MSG_ONSTACK takes care of
setting this.
Thanks,
Maulik
>
>> @@ -268,11 +264,9 @@ int rpmh_write(const struct device *dev, enum rpmh_state state,
>> DEFINE_RPMH_MSG_ONSTACK(dev, state, &compl, rpm_msg);
>> int ret;
>>
>> - if (!cmd || !n || n > MAX_RPMH_PAYLOAD)
>> - return -EINVAL;
>> -
>> - memcpy(rpm_msg.cmd, cmd, n * sizeof(*cmd));
>> - rpm_msg.msg.num_cmds = n;
>> + ret = __fill_rpmh_msg(&rpm_msg, state, cmd, n);
>> + if (ret)
>> + return ret;
> This part makes sense and is discussed in the commit text.
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] soc: qcom: rpmh: Use __fill_rpmh_msg API during rpmh_write()
2020-06-18 13:14 [PATCH] soc: qcom: rpmh: Use __fill_rpmh_msg API during rpmh_write() Maulik Shah
2020-06-19 8:23 ` Stephen Boyd
@ 2020-11-26 19:50 ` patchwork-bot+linux-arm-msm
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+linux-arm-msm @ 2020-11-26 19:50 UTC (permalink / raw)
To: Maulik Shah; +Cc: linux-arm-msm
Hello:
This patch was applied to qcom/linux.git (refs/heads/for-next):
On Thu, 18 Jun 2020 18:44:11 +0530 you wrote:
> Use __fill_rpmh_msg API during rpmh_write(). This allows to
> remove duplication of code in error checking, copying commands
> and setting message state.
>
> Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
> ---
> drivers/soc/qcom/rpmh.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
Here is the summary with links:
- soc: qcom: rpmh: Use __fill_rpmh_msg API during rpmh_write()
https://git.kernel.org/qcom/c/0924dad5d458
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-11-26 19:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-18 13:14 [PATCH] soc: qcom: rpmh: Use __fill_rpmh_msg API during rpmh_write() Maulik Shah
2020-06-19 8:23 ` Stephen Boyd
2020-06-22 9:33 ` Maulik Shah
2020-11-26 19:50 ` patchwork-bot+linux-arm-msm
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).