From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Stephen Boyd <swboyd@chromium.org>
Cc: Andy Gross <agross@kernel.org>,
linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
Elliot Berman <eberman@codeaurora.org>,
Brian Masney <masneyb@onstation.org>,
Stephan Gerhold <stephan@gerhold.net>,
Jeffrey Hugo <jhugo@codeaurora.org>,
Douglas Anderson <dianders@chromium.org>
Subject: Re: [PATCH 1/6] firmware: qcom_scm: Make __qcom_scm_is_call_available() return bool
Date: Fri, 5 Mar 2021 18:44:01 -0600 [thread overview]
Message-ID: <YELQUXSI4J2w/6oO@builder.lan> (raw)
In-Reply-To: <20210223214539.1336155-2-swboyd@chromium.org>
On Tue 23 Feb 15:45 CST 2021, Stephen Boyd wrote:
> Make __qcom_scm_is_call_available() return bool instead of int. The
> function has "is" in the name, so it should return a bool to indicate
> the truth of the call being available. Unfortunately, it can return a
> number < 0 which also looks "true", but not all callers expect that and
> thus they think a call is available when really the check to see if the
> call is available failed to figure it out.
>
> Cc: Elliot Berman <eberman@codeaurora.org>
> Cc: Brian Masney <masneyb@onstation.org>
> Cc: Stephan Gerhold <stephan@gerhold.net>
> Cc: Jeffrey Hugo <jhugo@codeaurora.org>
> Cc: Douglas Anderson <dianders@chromium.org>
> Fixes: 0f206514749b ("scsi: firmware: qcom_scm: Add support for programming inline crypto keys")
> Fixes: 0434a4061471 ("firmware: qcom: scm: add support to restore secure config to qcm_scm-32")
> Fixes: b0a1614fb1f5 ("firmware: qcom: scm: add OCMEM lock/unlock interface")
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Regards,
Bjorn
> ---
> drivers/firmware/qcom_scm.c | 19 ++++++++-----------
> 1 file changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c
> index f57779fc7ee9..2be5573dce53 100644
> --- a/drivers/firmware/qcom_scm.c
> +++ b/drivers/firmware/qcom_scm.c
> @@ -113,9 +113,6 @@ static void qcom_scm_clk_disable(void)
> clk_disable_unprepare(__scm->bus_clk);
> }
>
> -static int __qcom_scm_is_call_available(struct device *dev, u32 svc_id,
> - u32 cmd_id);
> -
> enum qcom_scm_convention qcom_scm_convention;
> static bool has_queried __read_mostly;
> static DEFINE_SPINLOCK(query_lock);
> @@ -219,8 +216,8 @@ static int qcom_scm_call_atomic(struct device *dev,
> }
> }
>
> -static int __qcom_scm_is_call_available(struct device *dev, u32 svc_id,
> - u32 cmd_id)
> +static bool __qcom_scm_is_call_available(struct device *dev, u32 svc_id,
> + u32 cmd_id)
> {
> int ret;
> struct qcom_scm_desc desc = {
> @@ -247,7 +244,7 @@ static int __qcom_scm_is_call_available(struct device *dev, u32 svc_id,
>
> ret = qcom_scm_call(dev, &desc, &res);
>
> - return ret ? : res.result[0];
> + return ret ? false : !!res.result[0];
> }
>
> /**
> @@ -585,9 +582,8 @@ bool qcom_scm_pas_supported(u32 peripheral)
> };
> struct qcom_scm_res res;
>
> - ret = __qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_PIL,
> - QCOM_SCM_PIL_PAS_IS_SUPPORTED);
> - if (ret <= 0)
> + if (!__qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_PIL,
> + QCOM_SCM_PIL_PAS_IS_SUPPORTED))
> return false;
>
> ret = qcom_scm_call(__scm->dev, &desc, &res);
> @@ -1060,17 +1056,18 @@ EXPORT_SYMBOL(qcom_scm_ice_set_key);
> */
> bool qcom_scm_hdcp_available(void)
> {
> + bool avail;
> int ret = qcom_scm_clk_enable();
>
> if (ret)
> return ret;
>
> - ret = __qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_HDCP,
> + avail = __qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_HDCP,
> QCOM_SCM_HDCP_INVOKE);
>
> qcom_scm_clk_disable();
>
> - return ret > 0;
> + return avail;
> }
> EXPORT_SYMBOL(qcom_scm_hdcp_available);
>
> --
> https://chromeos.dev
>
next prev parent reply other threads:[~2021-03-06 0:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-23 21:45 [PATCH 0/6] firmware: qcom_scm: Fix SMCCC detection on sc7180 Stephen Boyd
2021-02-23 21:45 ` [PATCH 1/6] firmware: qcom_scm: Make __qcom_scm_is_call_available() return bool Stephen Boyd
2021-03-06 0:44 ` Bjorn Andersson [this message]
2021-02-23 21:45 ` [PATCH 2/6] firmware: qcom_scm: Reduce locking section for __get_convention() Stephen Boyd
2021-02-23 21:45 ` [PATCH 3/6] firmware: qcom_scm: Workaround lack of "is available" call on SC7180 Stephen Boyd
2021-02-23 23:38 ` Jeffrey Hugo
2021-02-23 23:46 ` Stephen Boyd
2021-02-23 21:45 ` [PATCH 4/6] firmware: qcom_scm: Suppress sysfs bind attributes Stephen Boyd
2021-02-23 21:45 ` [PATCH 5/6] firmware: qcom_scm: Fix kernel-doc function names to match Stephen Boyd
2021-02-23 21:45 ` [PATCH 6/6] firmware: qcom_scm: Only compile legacy calls on ARM Stephen Boyd
2021-03-04 3:35 ` Elliot Berman
2021-03-04 6:14 ` Stephen Boyd
2021-03-05 18:18 ` Elliot Berman
2021-03-06 6:18 ` Stephen Boyd
2021-03-07 17:42 ` Bjorn Andersson
2021-03-23 3:36 ` Stephen Boyd
2021-03-23 18:27 ` Elliot Berman
2021-03-23 18:46 ` Bjorn Andersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YELQUXSI4J2w/6oO@builder.lan \
--to=bjorn.andersson@linaro.org \
--cc=agross@kernel.org \
--cc=dianders@chromium.org \
--cc=eberman@codeaurora.org \
--cc=jhugo@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masneyb@onstation.org \
--cc=stephan@gerhold.net \
--cc=swboyd@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).