Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2604242ybt; Mon, 22 Jun 2020 02:36:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLiaM9oWbVIg6i2jrB09b28MygaoGYtpThvj5rOVwSbhKRd67vdYiATStRGeptF7BDbv7L X-Received: by 2002:a17:906:1c49:: with SMTP id l9mr14278487ejg.296.1592818569779; Mon, 22 Jun 2020 02:36:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592818569; cv=none; d=google.com; s=arc-20160816; b=WsGSBEBWBSX3oeOPOehhvP4Obv5rR7iiEC4tucQoJljcsCrHMj3ZdUZg6pQ6cwKpAT j57YWK97GKUGr7eijVU8jFopnbK8OhbvPz+LSzbs/swwwKrqTjOu1fYVcc/aNJ0g4JAz eW+lRxjDZBNUbPZ388oRhnJhwnNeh7Di+wWPjdJFU/JhT02usG2k7RUZTvX8hY97VO1w 92nqOf/2UFjvKuDXyyaRr7hresXcy+3l15eYEezF0JqQ8+CYZsMZpJzf/6HbZ4L+4VJw Gqt+YT1VkypxxsSSwmmVe7w4jJghPvzXUB9iCqxYgh1VPYfX3UlD+BFyPdYi3PqV5bVV Z2QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from:dmarc-filter :dkim-signature; bh=vrHaCLVrBpW0c9FNy6REcSMG1UjdnzZ5O3XMh6dAXk8=; b=Sa53Dm0lBEAnsVNsQXVre+S2de4Qw/cAD8RIPLHIoAJQRW1srdbzM9Z8+16Z7UsKl5 9KauprFRVLW9DcG/eiPLbI7/AuGi0SvKWIedzyAjA/a+Rh8ittdAkjGgjCPQq/1QP7lk WLMfyaphOYs9amDSQBGmvEMYo1abVKvp5OGIkLAkwP6Ua3daif/3wfv8J6BqEviXgMHm Ck4qARO7WCY7Tg45KF4myOWO+RwELpy6nmsGaQXmusE7ijYz8ZJXTp8QzCua8lmgGtyV TLcUz58E997DeCT9jAnS/4GjsL6kT2FBehulNaO7GqkP22roGbZkpxFMx+7D2M1SpBXu 2R5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=tuM30VCU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b3si10259196edn.338.2020.06.22.02.35.47; Mon, 22 Jun 2020 02:36:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=tuM30VCU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727068AbgFVJdm (ORCPT + 99 others); Mon, 22 Jun 2020 05:33:42 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:35617 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727063AbgFVJdm (ORCPT ); Mon, 22 Jun 2020 05:33:42 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1592818421; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: References: Cc: To: Subject: From: Sender; bh=vrHaCLVrBpW0c9FNy6REcSMG1UjdnzZ5O3XMh6dAXk8=; b=tuM30VCUdo8nXEv7zd5KHPGJtsVB9sImh0xMSrQh1Cp0UK2rMyakKGeFAaHMoswRFo2ravtU d3ORAohP1+QFYXx1SRuOcrckQe5j447W/8My9u5p5H9L1vVWMtnYDhgsxDilSOlIHSdQ3H2Q l28837UqDxDbadiR6fgszRS1gPo= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n02.prod.us-east-1.postgun.com with SMTP id 5ef07aed567385e8e785d7a6 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 22 Jun 2020 09:33:33 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 8968BC433C8; Mon, 22 Jun 2020 09:33:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from [192.168.29.129] (unknown [49.36.71.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mkshah) by smtp.codeaurora.org (Postfix) with ESMTPSA id 98211C433C8; Mon, 22 Jun 2020 09:33:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 98211C433C8 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=mkshah@codeaurora.org From: Maulik Shah Subject: Re: [PATCH] soc: qcom: rpmh: Use __fill_rpmh_msg API during rpmh_write() To: Stephen Boyd , agross@kernel.org, bjorn.andersson@linaro.org Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dianders@chromium.org, rnayak@codeaurora.org, ilina@codeaurora.org, lsrao@codeaurora.org References: <1592486051-22256-1-git-send-email-mkshah@codeaurora.org> <159255500790.62212.11790974984337702896@swboyd.mtv.corp.google.com> Message-ID: <31fe6700-b7ea-6d57-0e83-75bcfb118c08@codeaurora.org> Date: Mon, 22 Jun 2020 15:03:24 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <159255500790.62212.11790974984337702896@swboyd.mtv.corp.google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> --- >> 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