time.c (101cfc9f787d8ca22866a178f2c1684fb10f8c7a) time.c (227e3958a780499b3ec41c36d4752ac4f4962874)
1/*
2 * linux/arch/arm/kernel/time.c
3 *
4 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
5 * Modifications for ARM (C) 1994-2001 Russell King
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 69 unchanged lines hidden (view full) ---

78
79static void dummy_clock_access(struct timespec64 *ts)
80{
81 ts->tv_sec = 0;
82 ts->tv_nsec = 0;
83}
84
85static clock_access_fn __read_persistent_clock = dummy_clock_access;
1/*
2 * linux/arch/arm/kernel/time.c
3 *
4 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
5 * Modifications for ARM (C) 1994-2001 Russell King
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 69 unchanged lines hidden (view full) ---

78
79static void dummy_clock_access(struct timespec64 *ts)
80{
81 ts->tv_sec = 0;
82 ts->tv_nsec = 0;
83}
84
85static clock_access_fn __read_persistent_clock = dummy_clock_access;
86static clock_access_fn __read_boot_clock = dummy_clock_access;
87
88void read_persistent_clock64(struct timespec64 *ts)
89{
90 __read_persistent_clock(ts);
91}
92
86
87void read_persistent_clock64(struct timespec64 *ts)
88{
89 __read_persistent_clock(ts);
90}
91
93void read_boot_clock64(struct timespec64 *ts)
92int __init register_persistent_clock(clock_access_fn read_persistent)
94{
93{
95 __read_boot_clock(ts);
96}
97
98int __init register_persistent_clock(clock_access_fn read_boot,
99 clock_access_fn read_persistent)
100{
101 /* Only allow the clockaccess functions to be registered once */
94 /* Only allow the clockaccess functions to be registered once */
102 if (__read_persistent_clock == dummy_clock_access &&
103 __read_boot_clock == dummy_clock_access) {
104 if (read_boot)
105 __read_boot_clock = read_boot;
95 if (__read_persistent_clock == dummy_clock_access) {
106 if (read_persistent)
107 __read_persistent_clock = read_persistent;
96 if (read_persistent)
97 __read_persistent_clock = read_persistent;
108
109 return 0;
110 }
111
112 return -EINVAL;
113}
114
115void __init time_init(void)
116{
117 if (machine_desc->init_time) {
118 machine_desc->init_time();
119 } else {
120#ifdef CONFIG_COMMON_CLK
121 of_clk_init(NULL);
122#endif
123 timer_probe();
124 }
125}
98 return 0;
99 }
100
101 return -EINVAL;
102}
103
104void __init time_init(void)
105{
106 if (machine_desc->init_time) {
107 machine_desc->init_time();
108 } else {
109#ifdef CONFIG_COMMON_CLK
110 of_clk_init(NULL);
111#endif
112 timer_probe();
113 }
114}