lkml.org 
[lkml]   [2021]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH v6 02/37] firmware: arm_scmi: introduce protocol handle definitions
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(+)
>

[...]

> 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

[...]

> /**
> * 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
\
 
 \ /
  Last update: 2021-03-08 06:51    [W:0.485 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site