thermal/drivers/core: Add init section table for self-encapsulation
Currently the governors are declared in their respective files but they export their [un]register functions which in turn call the [un]register governors core's functions. That implies a cyclic dependency which is not desirable. There is a way to self-encapsulate the governors by letting them to declare themselves in a __init section table. Define the table in the asm generic linker description like the other tables and provide the specific macros to deal with. Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
This commit is contained in:
parent
4b972a01a7
commit
980af75ede
@ -15,6 +15,21 @@
|
|||||||
/* Initial state of a cooling device during binding */
|
/* Initial state of a cooling device during binding */
|
||||||
#define THERMAL_NO_TARGET -1UL
|
#define THERMAL_NO_TARGET -1UL
|
||||||
|
|
||||||
|
/* Init section thermal table */
|
||||||
|
extern struct thermal_governor *__governor_thermal_table[];
|
||||||
|
extern struct thermal_governor *__governor_thermal_table_end[];
|
||||||
|
|
||||||
|
#define THERMAL_TABLE_ENTRY(table, name) \
|
||||||
|
static typeof(name) *__thermal_table_entry_##name \
|
||||||
|
__used __section(__##table##_thermal_table) = &name
|
||||||
|
|
||||||
|
#define THERMAL_GOVERNOR_DECLARE(name) THERMAL_TABLE_ENTRY(governor, name)
|
||||||
|
|
||||||
|
#define for_each_governor_table(__governor) \
|
||||||
|
for (__governor = __governor_thermal_table; \
|
||||||
|
__governor < __governor_thermal_table_end; \
|
||||||
|
__governor++)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This structure is used to describe the behavior of
|
* This structure is used to describe the behavior of
|
||||||
* a certain cooling device on a certain trip point
|
* a certain cooling device on a certain trip point
|
||||||
|
@ -239,6 +239,16 @@
|
|||||||
#define ACPI_PROBE_TABLE(name)
|
#define ACPI_PROBE_TABLE(name)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_THERMAL
|
||||||
|
#define THERMAL_TABLE(name) \
|
||||||
|
. = ALIGN(8); \
|
||||||
|
__##name##_thermal_table = .; \
|
||||||
|
KEEP(*(__##name##_thermal_table)) \
|
||||||
|
__##name##_thermal_table_end = .;
|
||||||
|
#else
|
||||||
|
#define THERMAL_TABLE(name)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define KERNEL_DTB() \
|
#define KERNEL_DTB() \
|
||||||
STRUCT_ALIGN(); \
|
STRUCT_ALIGN(); \
|
||||||
__dtb_start = .; \
|
__dtb_start = .; \
|
||||||
@ -608,6 +618,7 @@
|
|||||||
IRQCHIP_OF_MATCH_TABLE() \
|
IRQCHIP_OF_MATCH_TABLE() \
|
||||||
ACPI_PROBE_TABLE(irqchip) \
|
ACPI_PROBE_TABLE(irqchip) \
|
||||||
ACPI_PROBE_TABLE(timer) \
|
ACPI_PROBE_TABLE(timer) \
|
||||||
|
THERMAL_TABLE(governor) \
|
||||||
EARLYCON_TABLE() \
|
EARLYCON_TABLE() \
|
||||||
LSM_TABLE()
|
LSM_TABLE()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user