treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201
[linux-2.6-block.git] / drivers / clocksource / timer-probe.c
CommitLineData
9952f691 1// SPDX-License-Identifier: GPL-2.0-only
ae278a93
SW
2/*
3 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
ae278a93
SW
4 */
5
c625f76a 6#include <linux/acpi.h>
ae278a93
SW
7#include <linux/init.h>
8#include <linux/of.h>
3d5a9658 9#include <linux/clocksource.h>
ae278a93 10
2fcc112a 11extern struct of_device_id __timer_of_table[];
ae278a93 12
2fcc112a
DL
13static const struct of_device_id __timer_of_table_sentinel
14 __used __section(__timer_of_table_end);
ae278a93 15
ba5d08c0 16void __init timer_probe(void)
ae278a93
SW
17{
18 struct device_node *np;
19 const struct of_device_id *match;
b7c4db86 20 of_init_fn_1_ret init_func_ret;
2fcc112a 21 unsigned timers = 0;
b7c4db86 22 int ret;
ae278a93 23
2fcc112a 24 for_each_matching_node_and_match(np, __timer_of_table, &match) {
eeb93d02
SH
25 if (!of_device_is_available(np))
26 continue;
27
b7c4db86
DL
28 init_func_ret = match->data;
29
30 ret = init_func_ret(np);
31 if (ret) {
469869d1 32 pr_err("Failed to initialize '%pOF': %d\n", np, ret);
b7c4db86
DL
33 continue;
34 }
35
2fcc112a 36 timers++;
b7c4db86
DL
37 }
38
2fcc112a 39 timers += acpi_probe_device_table(timer);
c625f76a 40
2fcc112a
DL
41 if (!timers)
42 pr_crit("%s: no matching timers found\n", __func__);
ae278a93 43}