timer-probe.c 959 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
  4. */
  5. #include <linux/acpi.h>
  6. #include <linux/init.h>
  7. #include <linux/of.h>
  8. #include <linux/clocksource.h>
  9. extern struct of_device_id __timer_of_table[];
  10. static const struct of_device_id __timer_of_table_sentinel
  11. __used __section("__timer_of_table_end");
  12. void __init timer_probe(void)
  13. {
  14. struct device_node *np;
  15. const struct of_device_id *match;
  16. of_init_fn_1_ret init_func_ret;
  17. unsigned timers = 0;
  18. int ret;
  19. for_each_matching_node_and_match(np, __timer_of_table, &match) {
  20. if (!of_device_is_available(np))
  21. continue;
  22. init_func_ret = match->data;
  23. ret = init_func_ret(np);
  24. if (ret) {
  25. if (ret != -EPROBE_DEFER)
  26. pr_err("Failed to initialize '%pOF': %d\n", np,
  27. ret);
  28. continue;
  29. }
  30. timers++;
  31. }
  32. timers += acpi_probe_device_table(timer);
  33. if (!timers)
  34. pr_crit("%s: no matching timers found\n", __func__);
  35. }