lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191210145345.11616-4-sudeep.holla@arm.com>
Date:   Tue, 10 Dec 2019 14:53:33 +0000
From:   Sudeep Holla <sudeep.holla@....com>
To:     linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc:     Sudeep Holla <sudeep.holla@....com>,
        Cristian Marussi <cristian.marussi@....com>
Subject: [PATCH 03/15] firmware: arm_scmi: Skip protocol initialisation for additional devices

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 <sudeep.holla@....com>
---
 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(+)

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",
--
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ