From: Cristian Marussi <cristian.marussi@arm.com>
To: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org,
linux-doc@vger.kernel.org
Cc: sudeep.holla@kernel.org, james.quinlan@broadcom.com,
f.fainelli@gmail.com, vincent.guittot@linaro.org,
etienne.carriere@st.com, peng.fan@oss.nxp.com,
michal.simek@amd.com, d-gole@ti.com, jic23@kernel.org,
elif.topuz@arm.com, lukasz.luba@arm.com, philip.radford@arm.com,
david@kernel.org, souvik.chakravarty@arm.com, leitao@kernel.org,
kas@kernel.org, puranjay@kernel.org, usama.arif@linux.dev,
kernel-team@meta.com, Cristian Marussi <cristian.marussi@arm.com>
Subject: [PATCH v12 19/25] firmware: arm_scmi: Add un-managed methods to get/put protocols operations
Date: Sun, 20 Sep 2026 10:19:22 +0100 [thread overview]
Message-ID: <20260920091928.2014972-20-cristian.marussi@arm.com> (raw)
In-Reply-To: <20260920091928.2014972-1-cristian.marussi@arm.com>
Add a couple of simple common methods to be able to manually get and put
protocol operations to address situation in which devres managed methods
cannot be used.
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
v10 --> v11
- fixed a few comments typos
---
drivers/firmware/arm_scmi/driver.c | 39 ++++++++++++++++++++++++++++++
include/linux/scmi_protocol.h | 7 ++++++
2 files changed, 46 insertions(+)
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index f5aca46bc608..6838a1d5f80a 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -2571,6 +2571,31 @@ scmi_devm_protocol_get(struct scmi_device *sdev, u8 protocol_id,
return pi->proto->ops;
}
+/**
+ * scmi_protocol_operations_get - UnManaged get protocol operations
+ *
+ * @handle: A reference to the SCMI platform instance.
+ * @protocol_id: The protocol being acquired.
+ * @ph: A pointer reference used to pass back the associated protocol handle.
+ */
+static const void __must_check *
+scmi_protocol_operations_get(const struct scmi_handle *handle, u8 protocol_id,
+ struct scmi_protocol_handle **ph)
+{
+ struct scmi_protocol_instance *pi;
+
+ if (!ph)
+ return ERR_PTR(-EINVAL);
+
+ pi = scmi_get_protocol_instance(handle, protocol_id);
+ if (IS_ERR(pi))
+ return pi;
+
+ *ph = &pi->ph;
+
+ return pi->proto->ops;
+}
+
/**
* scmi_devm_protocol_acquire - Devres managed helper to get hold of a protocol
* @sdev: A reference to an scmi_device whose embedded struct device is to
@@ -2627,6 +2652,18 @@ static void scmi_devm_protocol_put(struct scmi_device *sdev, u8 protocol_id)
WARN_ON(ret);
}
+/**
+ * scmi_protocol_operations_put - UnManaged put protocol operations
+ *
+ * @handle: A reference to the SCMI platform instance.
+ * @protocol_id: The protocol being released.
+ */
+static void scmi_protocol_operations_put(const struct scmi_handle *handle,
+ u8 protocol_id)
+{
+ scmi_protocol_release(handle, protocol_id);
+}
+
/**
* scmi_is_transport_atomic - Method to check if underlying transport for an
* SCMI instance is configured as atomic.
@@ -3358,6 +3395,8 @@ static int scmi_probe(struct platform_device *pdev)
handle->devm_protocol_acquire = scmi_devm_protocol_acquire;
handle->devm_protocol_get = scmi_devm_protocol_get;
handle->devm_protocol_put = scmi_devm_protocol_put;
+ handle->protocol_get = scmi_protocol_operations_get;
+ handle->protocol_put = scmi_protocol_operations_put;
handle->is_transport_atomic = scmi_is_transport_atomic;
/* Setup all channels described in the DT at first */
diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
index 4b44c9f503bc..ebe3ee6e7aaa 100644
--- a/include/linux/scmi_protocol.h
+++ b/include/linux/scmi_protocol.h
@@ -1137,6 +1137,9 @@ struct scmi_notify_ops {
* @devm_protocol_get: devres managed method to acquire a protocol and get specific
* operations and a dedicated protocol handler
* @devm_protocol_put: devres managed method to release a protocol
+ * @protocol_get: unmanaged method to acquire a protocol and get specific
+ * operations and a dedicated protocol handler
+ * @protocol_put: unmanaged method to release a protocol
* @is_transport_atomic: method to check if the underlying transport for this
* instance handle is configured to support atomic
* transactions for commands.
@@ -1159,6 +1162,10 @@ struct scmi_handle {
(*devm_protocol_get)(struct scmi_device *sdev, u8 proto,
struct scmi_protocol_handle **ph);
void (*devm_protocol_put)(struct scmi_device *sdev, u8 proto);
+ const void __must_check *
+ (*protocol_get)(const struct scmi_handle *handle, u8 proto,
+ struct scmi_protocol_handle **ph);
+ void (*protocol_put)(const struct scmi_handle *handle, u8 proto);
bool (*is_transport_atomic)(const struct scmi_handle *handle,
unsigned int *atomic_threshold);
const struct scmi_notify_ops *notify_ops;
--
2.54.0
next prev parent reply other threads:[~2026-09-20 9:21 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-20 9:19 [PATCH v12 00/25] Introduce SCMI Telemetry support Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 01/25] firmware: arm_scmi: Add new SCMIv4.0 error codes definitions Cristian Marussi
2026-09-22 12:20 ` David Hildenbrand (Arm)
2026-09-22 17:32 ` Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 02/25] firmware: arm_scmi: Allow registration of unknown-size events/reports Cristian Marussi
2026-09-22 13:15 ` David Hildenbrand (Arm)
2026-09-23 10:55 ` Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 03/25] firmware: arm_scmi: Introduce protocol instance notifiers Cristian Marussi
2026-09-22 13:44 ` David Hildenbrand (Arm)
2026-09-23 15:03 ` Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 04/25] dt-bindings: firmware: arm,scmi: Add support for telemetry protocol Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 05/25] include: trace: Add Telemetry trace events Cristian Marussi
2026-09-22 13:48 ` David Hildenbrand (Arm)
2026-09-23 12:02 ` Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 06/25] firmware: arm_scmi: Add basic Telemetry support Cristian Marussi
2026-09-22 14:42 ` David Hildenbrand (Arm)
2026-09-23 14:43 ` Cristian Marussi
2026-09-28 20:01 ` Jonathan Cameron
2026-09-29 16:10 ` Jonathan Cameron
2026-10-04 8:28 ` Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 07/25] firmware: arm_scmi: Add support to parse SHMTIs areas Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 08/25] firmware: arm_scmi: Add Telemetry configuration operations Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 09/25] firmware: arm_scmi: Add Telemetry DataEvent read capabilities Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 10/25] firmware: arm_scmi: Add support for Telemetry reset Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 11/25] firmware: arm_scmi: Add Telemetry notification support Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 12/25] firmware: arm_scmi: Add support for boot-on Telemetry Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 13/25] firmware: arm-scmi: Add telemetry generic event support Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 14/25] firmware: arm_scmi: Add Telemetry generation counter event Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 15/25] firmware: arm_scmi: Add common per-protocol debugfs support Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 16/25] firmware: arm_scmi: Add Telemetry debugfs SHMTI dump support Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 17/25] firmware: arm_scmi: Add Telemetry debugfs ABI documentation Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 18/25] firmware: arm_scmi: Expose per-instance identifier Cristian Marussi
2026-09-20 9:19 ` Cristian Marussi [this message]
2026-09-20 9:19 ` [PATCH v12 20/25] uapi: Add ARM SCMI Telemetry definitions Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 21/25] firmware: arm_scmi: Add System Telemetry driver Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 22/25] docs: ioctl-number: Add SCMI Ioctls Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 23/25] [RFC] Documentation: Add SCMI System Telemetry documentation Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 24/25] [RFC] tools/scmi: Add SCMI Telemetry testing tool Cristian Marussi
2026-09-20 9:19 ` [PATCH v12 25/25] [RFC] kselftest/arm64: Add SCMI Telemetry UAPI compliance testcases Cristian Marussi
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=20260920091928.2014972-20-cristian.marussi@arm.com \
--to=cristian.marussi@arm.com \
--cc=arm-scmi@vger.kernel.org \
--cc=d-gole@ti.com \
--cc=david@kernel.org \
--cc=elif.topuz@arm.com \
--cc=etienne.carriere@st.com \
--cc=f.fainelli@gmail.com \
--cc=james.quinlan@broadcom.com \
--cc=jic23@kernel.org \
--cc=kas@kernel.org \
--cc=kernel-team@meta.com \
--cc=leitao@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=michal.simek@amd.com \
--cc=peng.fan@oss.nxp.com \
--cc=philip.radford@arm.com \
--cc=puranjay@kernel.org \
--cc=souvik.chakravarty@arm.com \
--cc=sudeep.holla@kernel.org \
--cc=usama.arif@linux.dev \
--cc=vincent.guittot@linaro.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox