firmware: arm_scmi: Add protocol modularization support

Extend SCMI protocols accounting mechanism to address possible module
usage and add the support to possibly define new protocols as loadable
modules.

Keep the standard protocols built into the SCMI core.

Link: https://lore.kernel.org/r/20210316124903.35011-38-cristian.marussi@arm.com
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
This commit is contained in:
Cristian Marussi 2021-03-16 12:49:02 +00:00 committed by Sudeep Holla
parent aa1fd3e4cb
commit f5800e0bf6
12 changed files with 55 additions and 5 deletions

View file

@ -704,6 +704,18 @@ static inline void scmi_driver_unregister(struct scmi_driver *driver) {}
#define module_scmi_driver(__scmi_driver) \
module_driver(__scmi_driver, scmi_register, scmi_unregister)
/**
* module_scmi_protocol() - Helper macro for registering a scmi protocol
* @__scmi_protocol: scmi_protocol structure
*
* Helper macro for scmi drivers to set up proper module init / exit
* functions. Replaces module_init() and module_exit() and keeps people from
* printing pointless things to the kernel log when their driver is loaded.
*/
#define module_scmi_protocol(__scmi_protocol) \
module_driver(__scmi_protocol, \
scmi_protocol_register, scmi_protocol_unregister)
struct scmi_protocol;
int scmi_protocol_register(const struct scmi_protocol *proto);
void scmi_protocol_unregister(const struct scmi_protocol *proto);