Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
0004  */
0005 
0006 #include <linux/acpi.h>
0007 #include <linux/init.h>
0008 #include <linux/of.h>
0009 #include <linux/clocksource.h>
0010 
0011 extern struct of_device_id __timer_of_table[];
0012 
0013 static const struct of_device_id __timer_of_table_sentinel
0014     __used __section("__timer_of_table_end");
0015 
0016 void __init timer_probe(void)
0017 {
0018     struct device_node *np;
0019     const struct of_device_id *match;
0020     of_init_fn_1_ret init_func_ret;
0021     unsigned timers = 0;
0022     int ret;
0023 
0024     for_each_matching_node_and_match(np, __timer_of_table, &match) {
0025         if (!of_device_is_available(np))
0026             continue;
0027 
0028         init_func_ret = match->data;
0029 
0030         ret = init_func_ret(np);
0031         if (ret) {
0032             if (ret != -EPROBE_DEFER)
0033                 pr_err("Failed to initialize '%pOF': %d\n", np,
0034                        ret);
0035             continue;
0036         }
0037 
0038         timers++;
0039     }
0040 
0041     timers += acpi_probe_device_table(timer);
0042 
0043     if (!timers)
0044         pr_crit("%s: no matching timers found\n", __func__);
0045 }