[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201202204009.32073-32-cristian.marussi@arm.com>
Date: Wed, 2 Dec 2020 20:40:03 +0000
From: Cristian Marussi <cristian.marussi@....com>
To: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Cc: sudeep.holla@....com, lukasz.luba@....com,
james.quinlan@...adcom.com, Jonathan.Cameron@...wei.com,
f.fainelli@...il.com, etienne.carriere@...aro.org,
thara.gopinath@...aro.org, vincent.guittot@...aro.org,
souvik.chakravarty@....com,
Cristian Marussi <cristian.marussi@....com>
Subject: [PATCH v3 31/37] firmware: arm_scmi: make references to handle const
Now that all the protocol private variable data have been moved out of
struct scmi_handle, mark all of its references as const.
Signed-off-by: Cristian Marussi <cristian.marussi@....com>
---
drivers/firmware/arm_scmi/common.h | 4 ++--
drivers/firmware/arm_scmi/driver.c | 12 ++++++------
include/linux/scmi_protocol.h | 4 ++--
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h
index c7b48f1e5fe0..45387a32d79e 100644
--- a/drivers/firmware/arm_scmi/common.h
+++ b/drivers/firmware/arm_scmi/common.h
@@ -274,8 +274,8 @@ void __exit scmi_##name##_unregister(void) \
const struct scmi_protocol *scmi_get_protocol(int protocol_id);
-int scmi_acquire_protocol(struct scmi_handle *handle, u8 protocol_id);
-void scmi_release_protocol(struct scmi_handle *handle, u8 protocol_id);
+int scmi_acquire_protocol(const struct scmi_handle *handle, u8 protocol_id);
+void scmi_release_protocol(const struct scmi_handle *handle, u8 protocol_id);
/* SCMI Transport */
/**
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index b76c06b8bbc3..68a40d83325c 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -729,7 +729,7 @@ scmi_get_revision_area(const struct scmi_protocol_handle *ph)
* Return: A reference to an initialized protocol instance or error on failure.
*/
static struct scmi_protocol_instance * __must_check
-scmi_get_protocol_instance(struct scmi_handle *handle, u8 protocol_id)
+scmi_get_protocol_instance(const struct scmi_handle *handle, u8 protocol_id)
{
int ret = -ENOMEM;
void *gid;
@@ -808,7 +808,7 @@ scmi_get_protocol_instance(struct scmi_handle *handle, u8 protocol_id)
*
* Return: 0 if protocol was acquired successfully.
*/
-int scmi_acquire_protocol(struct scmi_handle *handle, u8 protocol_id)
+int scmi_acquire_protocol(const struct scmi_handle *handle, u8 protocol_id)
{
return PTR_ERR_OR_ZERO(scmi_get_protocol_instance(handle, protocol_id));
}
@@ -821,7 +821,7 @@ int scmi_acquire_protocol(struct scmi_handle *handle, u8 protocol_id)
* Remove one user for the specified protocol and triggers de-initialization
* and resources de-allocation once the last user has gone.
*/
-void scmi_release_protocol(struct scmi_handle *handle, u8 protocol_id)
+void scmi_release_protocol(const struct scmi_handle *handle, u8 protocol_id)
{
struct scmi_info *info = handle_to_scmi_info(handle);
struct scmi_protocol_instance *pi;
@@ -866,7 +866,7 @@ void scmi_release_protocol(struct scmi_handle *handle, u8 protocol_id)
* Must be checked for errors by caller.
*/
static const void __must_check *
-scmi_get_protocol_operations(struct scmi_handle *handle, u8 protocol_id,
+scmi_get_protocol_operations(const struct scmi_handle *handle, u8 protocol_id,
struct scmi_protocol_handle **ph)
{
struct scmi_protocol_instance *pi;
@@ -908,7 +908,7 @@ scmi_is_protocol_implemented(const struct scmi_handle *handle, u8 prot_id)
}
struct scmi_protocol_devres {
- struct scmi_handle *handle;
+ const struct scmi_handle *handle;
u8 protocol_id;
};
@@ -943,7 +943,7 @@ scmi_devm_get_protocol_ops(struct scmi_device *sdev, u8 protocol_id,
{
struct scmi_protocol_instance *pi;
struct scmi_protocol_devres *dres;
- struct scmi_handle *handle = sdev->handle;
+ const struct scmi_handle *handle = sdev->handle;
if (!ph)
return ERR_PTR(-EINVAL);
diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
index 2687778a8a1f..397af71bb07d 100644
--- a/include/linux/scmi_protocol.h
+++ b/include/linux/scmi_protocol.h
@@ -621,9 +621,9 @@ struct scmi_handle {
void (*devm_put_ops)(struct scmi_device *sdev, u8 proto);
const void __must_check *
- (*get_ops)(struct scmi_handle *handle, u8 proto,
+ (*get_ops)(const struct scmi_handle *handle, u8 proto,
struct scmi_protocol_handle **ph);
- void (*put_ops)(struct scmi_handle *handle, u8 proto);
+ void (*put_ops)(const struct scmi_handle *handle, u8 proto);
const struct scmi_notify_ops *notify_ops;
void *notify_priv;
--
2.17.1
Powered by blists - more mailing lists