clocksource / ACPI: Add probing infrastructure for ACPI-based clocksources
authorMarc Zyngier <Marc.Zyngier@arm.com>
Mon, 28 Sep 2015 14:49:15 +0000 (15:49 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 1 Oct 2015 00:18:38 +0000 (02:18 +0200)
DT enjoys a rather nice probing infrastructure for clocksources,
while ACPI is so far stuck into a very distant past.

This patch introduces a declarative API, allowing clocksources
to be self-contained and be called when parsing the GTDT table.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/clocksource/clksrc-of.c
include/asm-generic/vmlinux.lds.h
include/linux/clocksource.h

index 0093a8e49e14d67af9538d8c98c6265d5ad6bedb..a2105bd620a0103dff1ea9cc4661d24324c16b28 100644 (file)
@@ -14,6 +14,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <linux/acpi.h>
 #include <linux/init.h>
 #include <linux/of.h>
 #include <linux/clocksource.h>
@@ -38,6 +39,9 @@ void __init clocksource_of_init(void)
                init_func(np);
                clocksources++;
        }
+
+       clocksources += acpi_probe_device_table(clksrc);
+
        if (!clocksources)
                pr_crit("%s: no matching clocksources found\n", __func__);
 }
index cd836cd1ea2489eb489000fa9e66e1a3c2c82158..c4bd0e2c173c011e37f6eef7acfb9bc3920fcca6 100644 (file)
        KERNEL_DTB()                                                    \
        IRQCHIP_OF_MATCH_TABLE()                                        \
        ACPI_PROBE_TABLE(irqchip)                                       \
+       ACPI_PROBE_TABLE(clksrc)                                        \
        EARLYCON_TABLE()                                                \
        EARLYCON_OF_TABLES()
 
index 278dd279a7a8035e8be073a9664ea88f7357984a..8cde04803d914eca2628880c17ca911aafabbff5 100644 (file)
@@ -258,4 +258,7 @@ void acpi_generic_timer_init(void);
 static inline void acpi_generic_timer_init(void) { }
 #endif
 
+#define CLOCKSOURCE_ACPI_DECLARE(name, table_id, fn)           \
+       ACPI_DECLARE_PROBE_ENTRY(clksrc, name, table_id, 0, NULL, 0, fn)
+
 #endif /* _LINUX_CLOCKSOURCE_H */