From patchwork Mon Sep 25 10:15:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13397628 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 86792CE7A81 for ; Mon, 25 Sep 2023 10:16:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=aFlciLetrodVLYNElFqphGsre+6giytkycDyCm7aaiA=; b=Vvj9R2J9BkmzRX UjzTTiEZyAeW6WGLRta2TbG+OzAhU67nh2Uds+6+x2h0JGFk81O85424EqgId1PXUl8w4pPR9go6i nNjVGXYkBHD1Y4iavQWX3rJyWB6IbTVJa+ev/Jo5nIFbvOQjoZvIJ+dg/mQkJrrD8JqQxZMyqgSyt LhByHgXdHgptzW7WzejSGVsG7AnubIXuovlPJeO752miPWGHi38TFPf3ffCkfocLSxquLweyE2r3F h2zU9G+h/PipK8LxSdRfiGvMaugO/Uy+FtvjBIuqXtZEduspYw+d1np6zsg1F5W3veVnw/64s6g+z 6Foi/FdRd6VyMytDK36A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qkidc-00Dx9R-34; Mon, 25 Sep 2023 10:16:24 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qkidZ-00Dx77-2F for linux-arm-kernel@lists.infradead.org; Mon, 25 Sep 2023 10:16:23 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 27CF8DA7; Mon, 25 Sep 2023 03:16:38 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 68F0F3F59C; Mon, 25 Sep 2023 03:15:59 -0700 (PDT) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH] firmware: arm_scmi: Rename scmi_{msg_,}clock_config_{get,set}_{2,21} Date: Mon, 25 Sep 2023 11:15:57 +0100 Message-ID: <20230925101557.3839860-1-sudeep.holla@arm.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230925_031621_827524_ED8D0A38 X-CRM114-Status: GOOD ( 10.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Signed-off-by: Sudeep Holla --- 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;