From: Sudeep Holla <sudeep.holla@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Sudeep Holla <sudeep.holla@arm.com>,
Cristian Marussi <cristian.marussi@arm.com>
Subject: [PATCH] firmware: arm_scmi: Rename scmi_{msg_,}clock_config_{get,set}_{2,21}
Date: Mon, 25 Sep 2023 11:15:57 +0100 [thread overview]
Message-ID: <20230925101557.3839860-1-sudeep.holla@arm.com> (raw)
It is very confusing to use *_v2 for everything applicable until SCMI
clock protocol version v2.0 including v1.0 for example. So let us rename
such that *_v2 is used only for SCMI clock protocol v2.1 onwards. Also
add comment to indicate the same explicitly.
Cc: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
drivers/firmware/arm_scmi/clock.c | 41 +++++++++++++++++--------------
1 file changed, 22 insertions(+), 19 deletions(-)
diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c
index d18bf789fc24..9c0e33c1efab 100644
--- a/drivers/firmware/arm_scmi/clock.c
+++ b/drivers/firmware/arm_scmi/clock.c
@@ -46,12 +46,13 @@ struct scmi_msg_resp_clock_attributes {
__le32 clock_enable_latency;
};
-struct scmi_msg_clock_config_set_v2 {
+struct scmi_msg_clock_config_set {
__le32 id;
__le32 attributes;
};
-struct scmi_msg_clock_config_set_v21 {
+/* Valid only from SCMI clock v2.1 */
+struct scmi_msg_clock_config_set_v2 {
__le32 id;
__le32 attributes;
#define NULL_OEM_TYPE 0
@@ -429,13 +430,13 @@ static int scmi_clock_rate_set(const struct scmi_protocol_handle *ph,
}
static int
-scmi_clock_config_set_v2(const struct scmi_protocol_handle *ph, u32 clk_id,
- enum clk_state state, u8 __unused0, u32 __unused1,
- bool atomic)
+scmi_clock_config_set(const struct scmi_protocol_handle *ph, u32 clk_id,
+ enum clk_state state, u8 __unused0, u32 __unused1,
+ bool atomic)
{
int ret;
struct scmi_xfer *t;
- struct scmi_msg_clock_config_set_v2 *cfg;
+ struct scmi_msg_clock_config_set *cfg;
if (state >= CLK_STATE_RESERVED)
return -EINVAL;
@@ -457,15 +458,16 @@ scmi_clock_config_set_v2(const struct scmi_protocol_handle *ph, u32 clk_id,
return ret;
}
+/* For SCMI clock v2.1 and onwards */
static int
-scmi_clock_config_set_v21(const struct scmi_protocol_handle *ph, u32 clk_id,
- enum clk_state state, u8 oem_type, u32 oem_val,
- bool atomic)
+scmi_clock_config_set_v2(const struct scmi_protocol_handle *ph, u32 clk_id,
+ enum clk_state state, u8 oem_type, u32 oem_val,
+ bool atomic)
{
int ret;
u32 attrs;
struct scmi_xfer *t;
- struct scmi_msg_clock_config_set_v21 *cfg;
+ struct scmi_msg_clock_config_set_v2 *cfg;
if (state == CLK_STATE_RESERVED ||
(!oem_type && state == CLK_STATE_UNCHANGED))
@@ -513,10 +515,11 @@ static int scmi_clock_disable(const struct scmi_protocol_handle *ph, u32 clk_id,
NULL_OEM_TYPE, 0, atomic);
}
+/* For SCMI clock v2.1 and onwards */
static int
-scmi_clock_config_get_v21(const struct scmi_protocol_handle *ph, u32 clk_id,
- u8 oem_type, u32 *attributes, bool *enabled,
- u32 *oem_val, bool atomic)
+scmi_clock_config_get_v2(const struct scmi_protocol_handle *ph, u32 clk_id,
+ u8 oem_type, u32 *attributes, bool *enabled,
+ u32 *oem_val, bool atomic)
{
int ret;
u32 flags;
@@ -556,9 +559,9 @@ scmi_clock_config_get_v21(const struct scmi_protocol_handle *ph, u32 clk_id,
}
static int
-scmi_clock_config_get_v2(const struct scmi_protocol_handle *ph, u32 clk_id,
- u8 oem_type, u32 *attributes, bool *enabled,
- u32 *oem_val, bool atomic)
+scmi_clock_config_get(const struct scmi_protocol_handle *ph, u32 clk_id,
+ u8 oem_type, u32 *attributes, bool *enabled,
+ u32 *oem_val, bool atomic)
{
int ret;
struct scmi_xfer *t;
@@ -781,11 +784,11 @@ static int scmi_clock_protocol_init(const struct scmi_protocol_handle *ph)
if (PROTOCOL_REV_MAJOR(version) >= 0x2 &&
PROTOCOL_REV_MINOR(version) >= 0x1) {
- cinfo->clock_config_set = scmi_clock_config_set_v21;
- cinfo->clock_config_get = scmi_clock_config_get_v21;
- } else {
cinfo->clock_config_set = scmi_clock_config_set_v2;
cinfo->clock_config_get = scmi_clock_config_get_v2;
+ } else {
+ cinfo->clock_config_set = scmi_clock_config_set;
+ cinfo->clock_config_get = scmi_clock_config_get;
}
cinfo->version = version;
--
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-09-25 10:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-25 10:15 Sudeep Holla [this message]
2023-09-27 11:15 ` [PATCH] firmware: arm_scmi: Rename scmi_{msg_,}clock_config_{get,set}_{2,21} Cristian Marussi
2023-09-27 11:50 ` Sudeep Holla
2023-09-27 12:43 ` Cristian Marussi
2023-09-27 12:51 ` Sudeep Holla
2023-09-27 13:06 ` 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=20230925101557.3839860-1-sudeep.holla@arm.com \
--to=sudeep.holla@arm.com \
--cc=cristian.marussi@arm.com \
--cc=linux-arm-kernel@lists.infradead.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