From b9f7fd907c38a38aea6869c91e38a7d745825442 Mon Sep 17 00:00:00 2001 From: Cristian Marussi Date: Tue, 16 Mar 2021 12:48:32 +0000 Subject: firmware: arm_scmi: Convert events registration to protocol handles Convert all refactored events registration routines to use protocol handles. In order to maintain bisectability and to allow protocols and drivers to be later ported to the new protocol handle interface one by one, introduce here also some transient code that will be removed later in order to ease such transition. Link: https://lore.kernel.org/r/20210316124903.35011-8-cristian.marussi@arm.com Tested-by: Florian Fainelli Signed-off-by: Cristian Marussi Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/notify.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'drivers/firmware/arm_scmi/notify.c') diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c index cbb2b004eb60..023c93deb14b 100644 --- a/drivers/firmware/arm_scmi/notify.c +++ b/drivers/firmware/arm_scmi/notify.c @@ -178,7 +178,7 @@ #define REVT_NOTIFY_SET_STATUS(revt, eid, sid, state) \ ({ \ typeof(revt) r = revt; \ - r->proto->ops->set_notify_enabled(r->proto->ni->handle, \ + r->proto->ops->set_notify_enabled(r->proto->ph, \ (eid), (sid), (state)); \ }) @@ -191,7 +191,7 @@ #define REVT_FILL_REPORT(revt, ...) \ ({ \ typeof(revt) r = revt; \ - r->proto->ops->fill_custom_report(r->proto->ni->handle, \ + r->proto->ops->fill_custom_report(r->proto->ph, \ __VA_ARGS__); \ }) @@ -279,6 +279,7 @@ struct scmi_registered_event; * events' descriptors, whose fixed-size is determined at * compile time. * @registered_mtx: A mutex to protect @registered_events_handlers + * @ph: SCMI protocol handle reference * @registered_events_handlers: An hashtable containing all events' handlers * descriptors registered for this protocol * @@ -303,6 +304,7 @@ struct scmi_registered_events_desc { struct scmi_registered_event **registered_events; /* mutex to protect registered_events_handlers */ struct mutex registered_mtx; + const struct scmi_protocol_handle *ph; DECLARE_HASHTABLE(registered_events_handlers, SCMI_REGISTERED_HASH_SZ); }; @@ -735,6 +737,7 @@ scmi_allocate_registered_events_desc(struct scmi_notify_instance *ni, * @handle: The handle identifying the platform instance against which the * protocol's events are registered * @proto_id: Protocol ID + * @ph: SCMI protocol handle. * @ee: A structure describing the events supported by this protocol. * * Used by SCMI Protocols initialization code to register with the notification @@ -745,6 +748,7 @@ scmi_allocate_registered_events_desc(struct scmi_notify_instance *ni, * Return: 0 on Success */ int scmi_register_protocol_events(const struct scmi_handle *handle, u8 proto_id, + const struct scmi_protocol_handle *ph, const struct scmi_protocol_events *ee) { int i; @@ -754,7 +758,7 @@ int scmi_register_protocol_events(const struct scmi_handle *handle, u8 proto_id, struct scmi_notify_instance *ni; const struct scmi_event *evt; - if (!ee || !ee->ops || !ee->evts || + if (!ee || !ee->ops || !ee->evts || !ph || (!ee->num_sources && !ee->ops->get_num_sources)) return -EINVAL; @@ -768,7 +772,7 @@ int scmi_register_protocol_events(const struct scmi_handle *handle, u8 proto_id, if (ee->num_sources) { num_sources = ee->num_sources; } else { - int nsrc = ee->ops->get_num_sources(handle); + int nsrc = ee->ops->get_num_sources(ph); if (nsrc <= 0) return -EINVAL; @@ -786,6 +790,7 @@ int scmi_register_protocol_events(const struct scmi_handle *handle, u8 proto_id, if (IS_ERR(pd)) return PTR_ERR(pd); + pd->ph = ph; for (i = 0; i < ee->num_events; i++, evt++) { struct scmi_registered_event *r_evt; -- cgit v1.2.3