This macro does the same job as CLOCKSOURCE_OF_DECLARE. The device name from the ACPI timer table is matched with all the registered timer controllers and matching initialisation routine is invoked.
Signed-off-by: Amit Daniel Kachhap amit.daniel@samsung.com --- include/asm-generic/vmlinux.lds.h | 6 ++++++ include/linux/clocksource.h | 13 +++++++++++++ 2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 83e2c31..e015ca2 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -144,8 +144,13 @@ VMLINUX_SYMBOL(__clksrc_of_table) = .; \ *(__clksrc_of_table) \ *(__clksrc_of_table_end) +#define CLKSRC_ACPI_TABLES() . = ALIGN(8); \ + VMLINUX_SYMBOL(__clksrc_acpi_table) = .; \ + *(__clksrc_acpi_table) \ + *(__clksrc_acpi_table_end) #else #define CLKSRC_OF_TABLES() +#define CLKSRC_ACPI_TABLES() #endif
#ifdef CONFIG_IRQCHIP @@ -490,6 +495,7 @@ MEM_DISCARD(init.rodata) \ CLK_OF_TABLES() \ CLKSRC_OF_TABLES() \ + CLKSRC_ACPI_TABLES() \ KERNEL_DTB() \ IRQCHIP_OF_MATCH_TABLE()
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index dbbf8aa..c300d50 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h @@ -338,7 +338,10 @@ extern int clocksource_mmio_init(void __iomem *, const char *, extern int clocksource_i8253_init(void);
struct device_node; + typedef void(*clocksource_of_init_fn)(struct device_node *); +typedef void(*clocksource_acpi_init_fn)(void); + #ifdef CONFIG_CLKSRC_OF extern void clocksource_of_init(void);
@@ -356,4 +359,14 @@ static inline void clocksource_of_init(void) {} .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn } #endif
+#ifdef CONFIG_ACPI +#define CLOCKSOURCE_ACPI_DECLARE(name, compat, fn) \ + static const struct acpi_device_id __clksrc_acpi_table_##name \ + __used __section(__clksrc_acpi_table) \ + = { .id = compat, \ + .driver_data = (kernel_ulong_t)fn } +#else +#define CLOCKSOURCE_ACPI_DECLARE(name, compat, fn) +#endif + #endif /* _LINUX_CLOCKSOURCE_H */