linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: Sudeep Holla <sudeep.holla@arm.com>,
	Cristian Marussi <cristian.marussi@arm.com>
Subject: [PATCH 06/15] firmware: arm_scmi: Update scmi_prot_init_fn_t to use device instead of handle
Date: Tue, 10 Dec 2019 14:53:36 +0000	[thread overview]
Message-ID: <20191210145345.11616-7-sudeep.holla@arm.com> (raw)
In-Reply-To: <20191210145345.11616-1-sudeep.holla@arm.com>

The scmi bus now supports multiple device per protocol. So, in order to
initialise each device and it's attributes, it's better to pass scmi_device
pointer to the protocol initialise function rather than scmi_handle.
scmi_handle can be still fetched from the scmi_device pointer.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/firmware/arm_scmi/bus.c     | 6 +++---
 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 ++-
 include/linux/scmi_protocol.h       | 2 +-
 7 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
index 3714e6307b05..f619da2634a6 100644
--- a/drivers/firmware/arm_scmi/bus.c
+++ b/drivers/firmware/arm_scmi/bus.c
@@ -51,13 +51,13 @@ static int scmi_dev_match(struct device *dev, struct device_driver *drv)
 	return 0;
 }

-static int scmi_protocol_init(int protocol_id, struct scmi_handle *handle)
+static int scmi_protocol_init(int protocol_id, struct scmi_device *dev)
 {
 	scmi_prot_init_fn_t fn = idr_find(&scmi_protocols, protocol_id);

 	if (unlikely(!fn))
 		return -EINVAL;
-	return fn(handle);
+	return fn(dev);
 }

 static int scmi_dev_probe(struct device *dev)
@@ -74,7 +74,7 @@ static int scmi_dev_probe(struct device *dev)
 	if (!scmi_dev->handle)
 		return -EPROBE_DEFER;

-	ret = scmi_protocol_init(scmi_dev->protocol_id, scmi_dev->handle);
+	ret = scmi_protocol_init(scmi_dev->protocol_id, scmi_dev);
 	if (ret)
 		return ret;

diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c
index 922b22aaaf84..6c24eb8a4e68 100644
--- a/drivers/firmware/arm_scmi/clock.c
+++ b/drivers/firmware/arm_scmi/clock.c
@@ -310,11 +310,12 @@ static struct scmi_clk_ops clk_ops = {
 	.disable = scmi_clock_disable,
 };

-static int scmi_clock_protocol_init(struct scmi_handle *handle)
+static int scmi_clock_protocol_init(struct scmi_device *dev)
 {
 	u32 version;
 	int clkid, ret;
 	struct clock_info *cinfo;
+	struct scmi_handle *handle = dev->handle;

 	if (handle->clk_ops && handle->clk_priv)
 		return 0; /* initialised already for the first device */
diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index 55c2a4c21ccb..4f02bfba98ba 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -704,11 +704,12 @@ static struct scmi_perf_ops perf_ops = {
 	.est_power_get = scmi_dvfs_est_power_get,
 };

-static int scmi_perf_protocol_init(struct scmi_handle *handle)
+static int scmi_perf_protocol_init(struct scmi_device *dev)
 {
 	int domain;
 	u32 version;
 	struct scmi_perf_info *pinfo;
+	struct scmi_handle *handle = dev->handle;

 	if (handle->perf_ops && handle->perf_priv)
 		return 0; /* initialised already for the first device */
diff --git a/drivers/firmware/arm_scmi/power.c b/drivers/firmware/arm_scmi/power.c
index 9a7593238b8f..5a8faa369d82 100644
--- a/drivers/firmware/arm_scmi/power.c
+++ b/drivers/firmware/arm_scmi/power.c
@@ -179,11 +179,12 @@ static struct scmi_power_ops power_ops = {
 	.state_get = scmi_power_state_get,
 };

-static int scmi_power_protocol_init(struct scmi_handle *handle)
+static int scmi_power_protocol_init(struct scmi_device *dev)
 {
 	int domain;
 	u32 version;
 	struct scmi_power_info *pinfo;
+	struct scmi_handle *handle = dev->handle;

 	if (handle->power_ops && handle->power_priv)
 		return 0; /* initialised already for the first device */
diff --git a/drivers/firmware/arm_scmi/reset.c b/drivers/firmware/arm_scmi/reset.c
index 809dc8faee1e..438d74a2c80a 100644
--- a/drivers/firmware/arm_scmi/reset.c
+++ b/drivers/firmware/arm_scmi/reset.c
@@ -189,11 +189,12 @@ static struct scmi_reset_ops reset_ops = {
 	.deassert = scmi_reset_domain_deassert,
 };

-static int scmi_reset_protocol_init(struct scmi_handle *handle)
+static int scmi_reset_protocol_init(struct scmi_device *dev)
 {
 	int domain;
 	u32 version;
 	struct scmi_reset_info *pinfo;
+	struct scmi_handle *handle = dev->handle;

 	if (handle->reset_ops && handle->reset_priv)
 		return 0; /* initialised already for the first device */
diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c
index b7f92c37c8a4..afa51bedfa5d 100644
--- a/drivers/firmware/arm_scmi/sensors.c
+++ b/drivers/firmware/arm_scmi/sensors.c
@@ -271,10 +271,11 @@ static struct scmi_sensor_ops sensor_ops = {
 	.reading_get = scmi_sensor_reading_get,
 };

-static int scmi_sensors_protocol_init(struct scmi_handle *handle)
+static int scmi_sensors_protocol_init(struct scmi_device *dev)
 {
 	u32 version;
 	struct sensors_info *sinfo;
+	struct scmi_handle *handle = dev->handle;

 	if (handle->sensor_ops && handle->sensor_priv)
 		return 0; /* initialised already for the first device */
diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
index 5c873a59b387..b676825e6eb0 100644
--- a/include/linux/scmi_protocol.h
+++ b/include/linux/scmi_protocol.h
@@ -316,6 +316,6 @@ static inline void scmi_driver_unregister(struct scmi_driver *driver) {}
 #define module_scmi_driver(__scmi_driver)	\
 	module_driver(__scmi_driver, scmi_register, scmi_unregister)

-typedef int (*scmi_prot_init_fn_t)(struct scmi_handle *);
+typedef int (*scmi_prot_init_fn_t)(struct scmi_device *);
 int scmi_protocol_register(int protocol_id, scmi_prot_init_fn_t fn);
 void scmi_protocol_unregister(int protocol_id);
--
2.17.1


  parent reply	other threads:[~2019-12-10 14:54 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10 14:53 [PATCH 00/15] firmware: arm_scmi: Add support for multiple device per protocol Sudeep Holla
2019-12-10 14:53 ` [PATCH 01/15] " Sudeep Holla
2019-12-10 17:02   ` Cristian Marussi
2019-12-10 14:53 ` [PATCH 02/15] firmware: arm_scmi: Skip scmi mbox channel setup for addtional devices Sudeep Holla
2019-12-10 17:33   ` Cristian Marussi
2019-12-10 14:53 ` [PATCH 03/15] firmware: arm_scmi: Skip protocol initialisation for additional devices Sudeep Holla
2019-12-10 18:14   ` Cristian Marussi
2019-12-10 14:53 ` [PATCH 04/15] firmware: arm_scmi: Add names to scmi devices created Sudeep Holla
2019-12-10 18:26   ` Cristian Marussi
2019-12-10 14:53 ` [PATCH 05/15] firmware: arm_scmi: Add versions and identifier attributes using dev_groups Sudeep Holla
2019-12-11 13:21   ` Cristian Marussi
2019-12-10 14:53 ` Sudeep Holla [this message]
2019-12-11 17:34   ` [PATCH 06/15] firmware: arm_scmi: Update scmi_prot_init_fn_t to use device instead of handle Cristian Marussi
2019-12-10 14:53 ` [PATCH 07/15] firmware: arm_scmi: Stash version in protocol init functions Sudeep Holla
2019-12-11 17:35   ` Cristian Marussi
2019-12-10 14:53 ` [PATCH 08/15] firmware: arm_scmi: Add and initialise protocol version to scmi_device structure Sudeep Holla
2019-12-11 18:06   ` Cristian Marussi
2019-12-12 12:15     ` Sudeep Holla
2019-12-10 14:53 ` [PATCH 09/15] firmware: arm_scmi: Add scmi protocol version and id device attributes Sudeep Holla
2019-12-11 18:08   ` Cristian Marussi
2019-12-10 14:53 ` [PATCH 10/15] firmware: arm_scmi: Drop logging individual scmi protocol version Sudeep Holla
2019-12-11 18:09   ` Cristian Marussi
2019-12-10 14:53 ` [PATCH 11/15] firmware: arm_scmi: Match scmi device by both name and protocol id Sudeep Holla
2019-12-11 18:09   ` Cristian Marussi
2019-12-11 18:10   ` Cristian Marussi
2019-12-10 14:53 ` [PATCH 12/15] clk: scmi: " Sudeep Holla
2019-12-24  7:49   ` Stephen Boyd
2019-12-10 14:53 ` [PATCH 13/15] cpufreq: " Sudeep Holla
2019-12-11  2:39   ` Viresh Kumar
2019-12-11 10:13     ` Sudeep Holla
2019-12-11 10:30       ` Viresh Kumar
2019-12-10 14:53 ` [PATCH 14/15] hwmon: (scmi-hwmon) " Sudeep Holla
2019-12-10 18:06   ` Guenter Roeck
2019-12-10 18:20     ` Sudeep Holla
2019-12-10 14:53 ` [PATCH 15/15] reset: reset-scmi: " Sudeep Holla
2019-12-11  9:51   ` Philipp Zabel
2019-12-11 15:28     ` Sudeep Holla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191210145345.11616-7-sudeep.holla@arm.com \
    --to=sudeep.holla@arm.com \
    --cc=cristian.marussi@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH 06/15] firmware: arm_scmi: Update scmi_prot_init_fn_t to use device instead of handle' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox