mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-27 12:53:34 +07:00
firmware: arm_scmi: Move scmi protocols registration into the driver
In preparation to enable building SCMI as a single module, let us move the SCMI protocol registration call into the driver. This enables us to also add unregistration of the SCMI protocols. The main reason for this is to keep it simple instead of maintaining it as separate modules and dealing with all possible initcall races and deferred probe handling. We can move it as separate modules if needed in future. Link: https://lore.kernel.org/r/20200907195046.56615-4-sudeep.holla@arm.com Tested-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
This commit is contained in:
parent
5a2f0a0bdf
commit
1eaf18e35a
@ -364,9 +364,4 @@ static int scmi_clock_protocol_init(struct scmi_handle *handle)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init scmi_clock_init(void)
|
||||
{
|
||||
return scmi_protocol_register(SCMI_PROTOCOL_CLOCK,
|
||||
&scmi_clock_protocol_init);
|
||||
}
|
||||
subsys_initcall(scmi_clock_init);
|
||||
DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(SCMI_PROTOCOL_CLOCK, clock)
|
||||
|
@ -159,6 +159,27 @@ int scmi_base_protocol_init(struct scmi_handle *h);
|
||||
int __init scmi_bus_init(void);
|
||||
void __exit scmi_bus_exit(void);
|
||||
|
||||
#define DECLARE_SCMI_REGISTER_UNREGISTER(func) \
|
||||
int __init scmi_##func##_register(void); \
|
||||
void __exit scmi_##func##_unregister(void)
|
||||
DECLARE_SCMI_REGISTER_UNREGISTER(clock);
|
||||
DECLARE_SCMI_REGISTER_UNREGISTER(perf);
|
||||
DECLARE_SCMI_REGISTER_UNREGISTER(power);
|
||||
DECLARE_SCMI_REGISTER_UNREGISTER(reset);
|
||||
DECLARE_SCMI_REGISTER_UNREGISTER(sensors);
|
||||
DECLARE_SCMI_REGISTER_UNREGISTER(system);
|
||||
|
||||
#define DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(id, name) \
|
||||
int __init scmi_##name##_register(void) \
|
||||
{ \
|
||||
return scmi_protocol_register((id), &scmi_##name##_protocol_init); \
|
||||
} \
|
||||
\
|
||||
void __exit scmi_##name##_unregister(void) \
|
||||
{ \
|
||||
scmi_protocol_unregister((id)); \
|
||||
}
|
||||
|
||||
/* SCMI Transport */
|
||||
/**
|
||||
* struct scmi_chan_info - Structure representing a SCMI channel information
|
||||
|
@ -933,14 +933,28 @@ static int __init scmi_driver_init(void)
|
||||
{
|
||||
scmi_bus_init();
|
||||
|
||||
scmi_clock_register();
|
||||
scmi_perf_register();
|
||||
scmi_power_register();
|
||||
scmi_reset_register();
|
||||
scmi_sensors_register();
|
||||
scmi_system_register();
|
||||
|
||||
return platform_driver_register(&scmi_driver);
|
||||
}
|
||||
module_init(scmi_driver_init);
|
||||
subsys_initcall(scmi_driver_init);
|
||||
|
||||
static void __exit scmi_driver_exit(void)
|
||||
{
|
||||
scmi_bus_exit();
|
||||
|
||||
scmi_clock_unregister();
|
||||
scmi_perf_unregister();
|
||||
scmi_power_unregister();
|
||||
scmi_reset_unregister();
|
||||
scmi_sensors_unregister();
|
||||
scmi_system_unregister();
|
||||
|
||||
platform_driver_unregister(&scmi_driver);
|
||||
}
|
||||
module_exit(scmi_driver_exit);
|
||||
|
@ -890,9 +890,4 @@ static int scmi_perf_protocol_init(struct scmi_handle *handle)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init scmi_perf_init(void)
|
||||
{
|
||||
return scmi_protocol_register(SCMI_PROTOCOL_PERF,
|
||||
&scmi_perf_protocol_init);
|
||||
}
|
||||
subsys_initcall(scmi_perf_init);
|
||||
DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(SCMI_PROTOCOL_PERF, perf)
|
||||
|
@ -301,9 +301,4 @@ static int scmi_power_protocol_init(struct scmi_handle *handle)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init scmi_power_init(void)
|
||||
{
|
||||
return scmi_protocol_register(SCMI_PROTOCOL_POWER,
|
||||
&scmi_power_protocol_init);
|
||||
}
|
||||
subsys_initcall(scmi_power_init);
|
||||
DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(SCMI_PROTOCOL_POWER, power)
|
||||
|
@ -313,9 +313,4 @@ static int scmi_reset_protocol_init(struct scmi_handle *handle)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init scmi_reset_init(void)
|
||||
{
|
||||
return scmi_protocol_register(SCMI_PROTOCOL_RESET,
|
||||
&scmi_reset_protocol_init);
|
||||
}
|
||||
subsys_initcall(scmi_reset_init);
|
||||
DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(SCMI_PROTOCOL_RESET, reset)
|
||||
|
@ -365,9 +365,4 @@ static int scmi_sensors_protocol_init(struct scmi_handle *handle)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init scmi_sensors_init(void)
|
||||
{
|
||||
return scmi_protocol_register(SCMI_PROTOCOL_SENSOR,
|
||||
&scmi_sensors_protocol_init);
|
||||
}
|
||||
subsys_initcall(scmi_sensors_init);
|
||||
DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(SCMI_PROTOCOL_SENSOR, sensors)
|
||||
|
@ -128,9 +128,4 @@ static int scmi_system_protocol_init(struct scmi_handle *handle)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init scmi_system_init(void)
|
||||
{
|
||||
return scmi_protocol_register(SCMI_PROTOCOL_SYSTEM,
|
||||
&scmi_system_protocol_init);
|
||||
}
|
||||
subsys_initcall(scmi_system_init);
|
||||
DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(SCMI_PROTOCOL_SYSTEM, system)
|
||||
|
Loading…
Reference in New Issue
Block a user