Linux 6.10-rc7
[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 13static const struct of_device_id __timer_of_table_sentinel
33def849 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) {
14e019df
JH
32 if (ret != -EPROBE_DEFER)
33 pr_err("Failed to initialize '%pOF': %d\n", np,
34 ret);
b7c4db86
DL
35 continue;
36 }
37
2fcc112a 38 timers++;
b7c4db86
DL
39 }
40
2fcc112a 41 timers += acpi_probe_device_table(timer);
c625f76a 42
2fcc112a
DL
43 if (!timers)
44 pr_crit("%s: no matching timers found\n", __func__);
ae278a93 45}