[PATCH v6 02/37] firmware: arm_scmi: introduce protocol handle definitions
Sudeep Holla
sudeep.holla at arm.com
Mon Mar 8 05:50:30 GMT 2021
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 at 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
More information about the linux-arm-kernel
mailing list