[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <159255500790.62212.11790974984337702896@swboyd.mtv.corp.google.com>
Date: Fri, 19 Jun 2020 01:23:27 -0700
From: Stephen Boyd <swboyd@...omium.org>
To: Maulik Shah <mkshah@...eaurora.org>, agross@...nel.org,
bjorn.andersson@...aro.org
Cc: linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
dianders@...omium.org, rnayak@...eaurora.org, ilina@...eaurora.org,
lsrao@...eaurora.org, Maulik Shah <mkshah@...eaurora.org>
Subject: Re: [PATCH] soc: qcom: rpmh: Use __fill_rpmh_msg API during rpmh_write()
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@...eaurora.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.
Powered by blists - more mailing lists