From patchwork Tue Dec 10 14:53:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 181124 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp5605952och; Tue, 10 Dec 2019 06:54:17 -0800 (PST) X-Google-Smtp-Source: APXvYqy2JjG80iCTsVuFViRPCibb/9TxSUwp0WSuiI12YiqzOT9EfDBa2g2X1YhidZw8StLNDGZ8 X-Received: by 2002:aca:3b89:: with SMTP id i131mr4080464oia.43.1575989657311; Tue, 10 Dec 2019 06:54:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575989657; cv=none; d=google.com; s=arc-20160816; b=uo7CBPaa8qPXFGfd0LCLfugjX3HjZixNzfxySbus8Rj8nyXespdD1ApC2GJXDcvqHO pEUlwIAhJ+klPH9otk+yHlAGFYW8jmnzfzNeeAOApLM82f0FJhvwSKkVWeiT3Wq40Nfy 5ezD45T8xuNJRbC0qzvs5sGSnWTM/jc1QugXgnQuB3XXbkcmS5tXpfT2IQ7eMamN1jXH /3rHpvSvdwxiIZ//g7zuz8iX/hu8Byd/yk5ByXeFShGwImO5KtmGtRdMdxTDNP2loIud N5+uRyk2lgqol/qMDGvo7B4HfCVwJrAEpG64CHoqmwUE22ESFr39YyM6N6jSBDAVv3jg CauA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=W6hIiz9eQa6XDDC50MkgIC1rZwkdiu622C9azLzl1gg=; b=dEC5p+aOPR812JO+W3w2nh7K8vMjLRpNCjxdTl2+cX059kQn55x53hdL0KFogvrj5P aoed/WfYpRr2169C2MvUp0FwNWZAxOtR4Pvqtw63ELTCNl5rWEJaD55huSuyHLeAjVTd dSE7QuxcK8EokvCebhJ3ByTI6pcmrEb75t9GyEwuix3VXdv6lqNt1twdV84nhu0/8e/E BVogtfMV7/t7i4dJdAhSOuQ6BxoVygJ7uXwRcdlbHHWDGJakX6cpOoNCiJdHJuGDCB/b v9dK0CW+i77fsJfaOrkoYhO+RkP8UVZC1KTgr9l+w45gw32ancoaLGO9PuoFfHwNiri4 r4MA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a12si2053135oie.87.2019.12.10.06.54.16; Tue, 10 Dec 2019 06:54:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727728AbfLJOyQ (ORCPT + 27 others); Tue, 10 Dec 2019 09:54:16 -0500 Received: from foss.arm.com ([217.140.110.172]:47150 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727669AbfLJOyL (ORCPT ); Tue, 10 Dec 2019 09:54:11 -0500 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 0900A1045; Tue, 10 Dec 2019 06:54:11 -0800 (PST) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5A4BF3F67D; Tue, 10 Dec 2019 06:54:10 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH 07/15] firmware: arm_scmi: Stash version in protocol init functions Date: Tue, 10 Dec 2019 14:53:37 +0000 Message-Id: <20191210145345.11616-8-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210145345.11616-1-sudeep.holla@arm.com> References: <20191210145345.11616-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to avoid querying the individual protocol versions multiple time with more that one device created for each protocol, we can simple store the copy in the protocol specific private data and use them whenever required. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/clock.c | 2 ++ drivers/firmware/arm_scmi/perf.c | 2 ++ drivers/firmware/arm_scmi/power.c | 2 ++ drivers/firmware/arm_scmi/reset.c | 2 ++ drivers/firmware/arm_scmi/sensors.c | 2 ++ 5 files changed, 10 insertions(+) -- 2.17.1 Reviewed-by: Cristian Marussi diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c index 6c24eb8a4e68..b567ec03f711 100644 --- a/drivers/firmware/arm_scmi/clock.c +++ b/drivers/firmware/arm_scmi/clock.c @@ -65,6 +65,7 @@ struct scmi_clock_set_rate { }; struct clock_info { + u32 version; int num_clocks; int max_async_req; atomic_t cur_async_req; @@ -344,6 +345,7 @@ static int scmi_clock_protocol_init(struct scmi_device *dev) scmi_clock_describe_rates_get(handle, clkid, clk); } + cinfo->version = version; handle->clk_ops = &clk_ops; handle->clk_priv = cinfo; diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c index 4f02bfba98ba..b1de6197f61c 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -145,6 +145,7 @@ struct perf_dom_info { }; struct scmi_perf_info { + u32 version; int num_domains; bool power_scale_mw; u64 stats_addr; @@ -740,6 +741,7 @@ static int scmi_perf_protocol_init(struct scmi_device *dev) scmi_perf_domain_init_fc(handle, domain, &dom->fc_info); } + pinfo->version = version; handle->perf_ops = &perf_ops; handle->perf_priv = pinfo; diff --git a/drivers/firmware/arm_scmi/power.c b/drivers/firmware/arm_scmi/power.c index 5a8faa369d82..d11c6cd6bbab 100644 --- a/drivers/firmware/arm_scmi/power.c +++ b/drivers/firmware/arm_scmi/power.c @@ -50,6 +50,7 @@ struct power_dom_info { }; struct scmi_power_info { + u32 version; int num_domains; u64 stats_addr; u32 stats_size; @@ -211,6 +212,7 @@ static int scmi_power_protocol_init(struct scmi_device *dev) scmi_power_domain_attributes_get(handle, domain, dom); } + pinfo->version = version; handle->power_ops = &power_ops; handle->power_priv = pinfo; diff --git a/drivers/firmware/arm_scmi/reset.c b/drivers/firmware/arm_scmi/reset.c index 438d74a2c80a..dce103781b3f 100644 --- a/drivers/firmware/arm_scmi/reset.c +++ b/drivers/firmware/arm_scmi/reset.c @@ -48,6 +48,7 @@ struct reset_dom_info { }; struct scmi_reset_info { + u32 version; int num_domains; struct reset_dom_info *dom_info; }; @@ -221,6 +222,7 @@ static int scmi_reset_protocol_init(struct scmi_device *dev) scmi_reset_domain_attributes_get(handle, domain, dom); } + pinfo->version = version; handle->reset_ops = &reset_ops; handle->reset_priv = pinfo; diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c index afa51bedfa5d..aac0243e2880 100644 --- a/drivers/firmware/arm_scmi/sensors.c +++ b/drivers/firmware/arm_scmi/sensors.c @@ -68,6 +68,7 @@ struct scmi_msg_sensor_reading_get { }; struct sensors_info { + u32 version; int num_sensors; int max_requests; u64 reg_addr; @@ -298,6 +299,7 @@ static int scmi_sensors_protocol_init(struct scmi_device *dev) scmi_sensor_description_get(handle, sinfo); + sinfo->version = version; handle->sensor_ops = &sensor_ops; handle->sensor_priv = sinfo;