From patchwork Tue Dec 10 14:53:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 181122 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp5605820och; Tue, 10 Dec 2019 06:54:11 -0800 (PST) X-Google-Smtp-Source: APXvYqxexJB9hvME/XUsYd7hYI0d6UejiC6XN8lDHruWTUUbnaZn0eBQi+knkQ92T+HZad5YCOmW X-Received: by 2002:aca:48cf:: with SMTP id v198mr4221498oia.35.1575989651355; Tue, 10 Dec 2019 06:54:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575989651; cv=none; d=google.com; s=arc-20160816; b=Reg9AcHbghY/BV4zNAGiGZ0FlqYTpSLMpSAcn6brD64NthNUNXPcxtaFZrYm5KJo5u KaTkl9ucfEyCSHHhIsfUnpY+2KnF09rplTS0vMR342+iYlE37/uwxZ+JUNemOTdO4z83 H1YKpP51Ig9TtmgakndX43WZTlGaKDKSUK70aiHM31nNxhrClHbDvwJZ5BP2fM1a5fUK rw+91EzQjhSZruobvRKBni+pKT4zCrtyCwNmr2w7C7aKcxbTkBLQv3t5OYIWnu2/1rN2 OU1TWmKS5OKC3ijp+tlH3rwPLUKb7rJJU+EP4jOsxzjbX61X9hDPN9FHZVfmfsd/WRIo H42w== 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=g6kN/5/N0EYkjm0uZze5WNbgOHcBZtnuJxdueNOXugc=; b=QO0qJMaqt314EhHmRmdoQDyEQSPzkGhkm/Oe1UDb1bpU4erC4gtFH7ntJvNwT24bpL Y0ckuvA03m7mv412y73vsO2LQTEYUrhiCf7by49DrollH+hDIfwaVOUxTh17bMIQCpp2 Dnrs+3P1u4aTqH1xdcLI6iliHQFPY32/bA2JejiOPmRmvaFPfVbd66s05kI3rsmmdHiW a9v7JgMgsO15QilAd/Tek25vbqNUp/G+bY+96OPxiDj24hwbnh4ByCq53BFMYDPFk48o /wTwOEBxt8vs2up6pzfIB8EpEc0sL0/d2Nq/zout87sX4v0uXQ5J/UM2Ew4gMlhulkUi Wi/Q== 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.10; Tue, 10 Dec 2019 06:54:11 -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 S1727658AbfLJOyJ (ORCPT + 27 others); Tue, 10 Dec 2019 09:54:09 -0500 Received: from foss.arm.com ([217.140.110.172]:47126 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727634AbfLJOyI (ORCPT ); Tue, 10 Dec 2019 09:54:08 -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 7E4F811B3; Tue, 10 Dec 2019 06:54:07 -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 CF7023F67D; Tue, 10 Dec 2019 06:54:06 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH 03/15] firmware: arm_scmi: Skip protocol initialisation for additional devices Date: Tue, 10 Dec 2019 14:53:33 +0000 Message-Id: <20191210145345.11616-4-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 The scmi bus now supports adding multiple devices per protocol, and since scmi_protocol_init is called for each scmi device created, we must avoid allocating protocol private data and initialising the protocol itself if it is already initialised. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/clock.c | 3 +++ drivers/firmware/arm_scmi/perf.c | 3 +++ drivers/firmware/arm_scmi/power.c | 3 +++ drivers/firmware/arm_scmi/reset.c | 3 +++ drivers/firmware/arm_scmi/sensors.c | 3 +++ 5 files changed, 15 insertions(+) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c index 32526a793f3a..922b22aaaf84 100644 --- a/drivers/firmware/arm_scmi/clock.c +++ b/drivers/firmware/arm_scmi/clock.c @@ -316,6 +316,9 @@ static int scmi_clock_protocol_init(struct scmi_handle *handle) int clkid, ret; struct clock_info *cinfo; + if (handle->clk_ops && handle->clk_priv) + return 0; /* initialised already for the first device */ + scmi_version_get(handle, SCMI_PROTOCOL_CLOCK, &version); dev_dbg(handle->dev, "Clock Version %d.%d\n", diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c index 601af4edad5e..55c2a4c21ccb 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -710,6 +710,9 @@ static int scmi_perf_protocol_init(struct scmi_handle *handle) u32 version; struct scmi_perf_info *pinfo; + if (handle->perf_ops && handle->perf_priv) + return 0; /* initialised already for the first device */ + scmi_version_get(handle, SCMI_PROTOCOL_PERF, &version); dev_dbg(handle->dev, "Performance Version %d.%d\n", diff --git a/drivers/firmware/arm_scmi/power.c b/drivers/firmware/arm_scmi/power.c index 5abef7079c0a..9a7593238b8f 100644 --- a/drivers/firmware/arm_scmi/power.c +++ b/drivers/firmware/arm_scmi/power.c @@ -185,6 +185,9 @@ static int scmi_power_protocol_init(struct scmi_handle *handle) u32 version; struct scmi_power_info *pinfo; + if (handle->power_ops && handle->power_priv) + return 0; /* initialised already for the first device */ + scmi_version_get(handle, SCMI_PROTOCOL_POWER, &version); dev_dbg(handle->dev, "Power Version %d.%d\n", diff --git a/drivers/firmware/arm_scmi/reset.c b/drivers/firmware/arm_scmi/reset.c index ab42c21c5517..809dc8faee1e 100644 --- a/drivers/firmware/arm_scmi/reset.c +++ b/drivers/firmware/arm_scmi/reset.c @@ -195,6 +195,9 @@ static int scmi_reset_protocol_init(struct scmi_handle *handle) u32 version; struct scmi_reset_info *pinfo; + if (handle->reset_ops && handle->reset_priv) + return 0; /* initialised already for the first device */ + scmi_version_get(handle, SCMI_PROTOCOL_RESET, &version); dev_dbg(handle->dev, "Reset Version %d.%d\n", diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c index a400ea805fc2..b7f92c37c8a4 100644 --- a/drivers/firmware/arm_scmi/sensors.c +++ b/drivers/firmware/arm_scmi/sensors.c @@ -276,6 +276,9 @@ static int scmi_sensors_protocol_init(struct scmi_handle *handle) u32 version; struct sensors_info *sinfo; + if (handle->sensor_ops && handle->sensor_priv) + return 0; /* initialised already for the first device */ + scmi_version_get(handle, SCMI_PROTOCOL_SENSOR, &version); dev_dbg(handle->dev, "Sensor Version %d.%d\n",