Thread (58 messages) 58 messages, 6 authors, 2021-03-15

Re: [PATCH v6 02/37] firmware: arm_scmi: introduce protocol handle definitions

From: Sudeep Holla <hidden>
Date: 2021-03-08 05:51:34
Also in: lkml

On Tue, Feb 02, 2021 at 10:15:20PM +0000, Cristian Marussi wrote:
Add basic protocol handles definitions and private data helpers support.

A protocol handle identifies a protocol instance initialized against a
specific handle; it embeds all the references to the core SCMI xfer methods
that will be needed by a protocol implementation to build and send its own
protocol specific messages using common core methods.

As such, in the interface, a protocol handle will be passed down from the
core to the protocol specific initialization callback at init time.

Anyway at this point only definitions are introduced, all protocols
initialization code and SCMI drivers probing is still based on the old
interface, so no functional change.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
 drivers/firmware/arm_scmi/common.h | 59 ++++++++++++++++++++++++++++++
 drivers/firmware/arm_scmi/driver.c | 45 +++++++++++++++++++++++
 2 files changed, 104 insertions(+)
[...]
quoted hunk ↗ jump to hunk
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index ed94efbecd61..2328a468bbd1 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
[...]
quoted hunk ↗ jump to hunk
 /**
  * scmi_get_protocol_instance  - Protocol initialization helper.
  * @handle: A reference to the SCMI platform instance.
@@ -588,6 +629,10 @@ scmi_get_protocol_instance(struct scmi_handle *handle, u8 protocol_id)
 
 		pi->gid = gid;
 		pi->proto = proto;
+		pi->handle = handle;
+		pi->ph.dev = handle->dev;
+		pi->ph.set_priv = scmi_set_protocol_priv;
+		pi->ph.get_priv = scmi_get_protocol_priv;

Sorry missed this in earlier patch. Not a must, but I prefer if you can move
all these initialisation into separate functions so that scmi_get_protocol_instance
can be simplified to read.

if (pi)
	increment refcount
else
	scmi_get_protocol
	alloc and init protocol instance
	register events

How about some thing like above ?

--
Regards,
Sudeep

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help