From: "xinglong.yang" <seanyang230@gmail.com>
To: xinglong.yang@cixtech.com, sudeep.holla@arm.com,
cristian.marussi@arm.com
Cc: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] firmware: arm_scmi: Refrain set operations of perf
Date: Thu, 2 Nov 2023 15:58:53 +0800 [thread overview]
Message-ID: <20231102075853.1320710-1-xinglong.yang@cixtech.com> (raw)
Refrain from trying to take the SET operation where the set_* operations
are not supported, because: (1.) avoid unneeded SCMI exchanges, (2.)
avoids to trust the FW reply blindly.
Signed-off-by: xinglong.yang <xinglong.yang@cixtech.com>
---
drivers/firmware/arm_scmi/perf.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index 431bda9165c3..3bcdef91ed5c 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -377,6 +377,9 @@ static int scmi_perf_limits_set(const struct scmi_protocol_handle *ph,
if (IS_ERR(dom))
return PTR_ERR(dom);
+ if (!dom->set_limits)
+ return -EOPNOTSUPP;
+
if (PROTOCOL_REV_MAJOR(pi->version) >= 0x3 && !max_perf && !min_perf)
return -EINVAL;
@@ -473,6 +476,9 @@ static int scmi_perf_level_set(const struct scmi_protocol_handle *ph,
if (IS_ERR(dom))
return PTR_ERR(dom);
+ if (!dom->set_perf)
+ return -EOPNOTSUPP;
+
if (dom->fc_info && dom->fc_info[PERF_FC_LEVEL].set_addr) {
struct scmi_fc_info *fci = &dom->fc_info[PERF_FC_LEVEL];
--
2.42.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2023-11-02 7:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-02 7:58 xinglong.yang [this message]
2023-11-02 9:54 ` Fwd: [PATCH v2] firmware: arm_scmi: Refrain set operations of perf sean yang
2023-11-02 9:54 ` sean yang
2023-11-02 11:06 ` Sudeep Holla
2023-11-02 11:20 ` Sudeep Holla
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=20231102075853.1320710-1-xinglong.yang@cixtech.com \
--to=seanyang230@gmail.com \
--cc=cristian.marussi@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=sudeep.holla@arm.com \
--cc=xinglong.yang@cixtech.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.