lkml.org 
[lkml]   [2019]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 03/15] firmware: arm_scmi: Skip protocol initialisation for additional devices
Date
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@arm.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
\
 
 \ /
  Last update: 2019-12-10 15:55    [W:0.113 / U:15.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site