hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/arch/nds32/kernel/vdso/gettimeofday.c
....@@ -48,9 +48,9 @@
4848 }
4949
5050 static notrace long clock_gettime_fallback(clockid_t _clkid,
51
- struct timespec *_ts)
51
+ struct __kernel_old_timespec *_ts)
5252 {
53
- register struct timespec *ts asm("$r1") = _ts;
53
+ register struct __kernel_old_timespec *ts asm("$r1") = _ts;
5454 register clockid_t clkid asm("$r0") = _clkid;
5555 register long ret asm("$r0");
5656
....@@ -63,7 +63,7 @@
6363 return ret;
6464 }
6565
66
-static notrace int do_realtime_coarse(struct timespec *ts,
66
+static notrace int do_realtime_coarse(struct __kernel_old_timespec *ts,
6767 struct vdso_data *vdata)
6868 {
6969 u32 seq;
....@@ -78,25 +78,23 @@
7878 return 0;
7979 }
8080
81
-static notrace int do_monotonic_coarse(struct timespec *ts,
81
+static notrace int do_monotonic_coarse(struct __kernel_old_timespec *ts,
8282 struct vdso_data *vdata)
8383 {
84
- struct timespec tomono;
8584 u32 seq;
85
+ u64 ns;
8686
8787 do {
8888 seq = vdso_read_begin(vdata);
8989
90
- ts->tv_sec = vdata->xtime_coarse_sec;
91
- ts->tv_nsec = vdata->xtime_coarse_nsec;
92
-
93
- tomono.tv_sec = vdata->wtm_clock_sec;
94
- tomono.tv_nsec = vdata->wtm_clock_nsec;
90
+ ts->tv_sec = vdata->xtime_coarse_sec + vdata->wtm_clock_sec;
91
+ ns = vdata->xtime_coarse_nsec + vdata->wtm_clock_nsec;
9592
9693 } while (vdso_read_retry(vdata, seq));
9794
98
- ts->tv_sec += tomono.tv_sec;
99
- timespec_add_ns(ts, tomono.tv_nsec);
95
+ ts->tv_sec += __iter_div_u64_rem(ns, NSEC_PER_SEC, &ns);
96
+ ts->tv_nsec = ns;
97
+
10098 return 0;
10199 }
102100
....@@ -115,7 +113,7 @@
115113 return ((u64) cycle_delta & vdso->cs_mask) * vdso->cs_mult;
116114 }
117115
118
-static notrace int do_realtime(struct timespec *ts, struct vdso_data *vdata)
116
+static notrace int do_realtime(struct __kernel_old_timespec *ts, struct vdso_data *vdata)
119117 {
120118 unsigned count;
121119 u64 ns;
....@@ -133,32 +131,31 @@
133131 return 0;
134132 }
135133
136
-static notrace int do_monotonic(struct timespec *ts, struct vdso_data *vdata)
134
+static notrace int do_monotonic(struct __kernel_old_timespec *ts, struct vdso_data *vdata)
137135 {
138
- struct timespec tomono;
139
- u64 nsecs;
136
+ u64 ns;
140137 u32 seq;
141138
142139 do {
143140 seq = vdso_read_begin(vdata);
144141
145142 ts->tv_sec = vdata->xtime_clock_sec;
146
- nsecs = vdata->xtime_clock_nsec;
147
- nsecs += vgetsns(vdata);
148
- nsecs >>= vdata->cs_shift;
143
+ ns = vdata->xtime_clock_nsec;
144
+ ns += vgetsns(vdata);
145
+ ns >>= vdata->cs_shift;
149146
150
- tomono.tv_sec = vdata->wtm_clock_sec;
151
- tomono.tv_nsec = vdata->wtm_clock_nsec;
147
+ ts->tv_sec += vdata->wtm_clock_sec;
148
+ ns += vdata->wtm_clock_nsec;
152149
153150 } while (vdso_read_retry(vdata, seq));
154151
155
- ts->tv_sec += tomono.tv_sec;
156
- ts->tv_nsec = 0;
157
- timespec_add_ns(ts, nsecs + tomono.tv_nsec);
152
+ ts->tv_sec += __iter_div_u64_rem(ns, NSEC_PER_SEC, &ns);
153
+ ts->tv_nsec = ns;
154
+
158155 return 0;
159156 }
160157
161
-notrace int __vdso_clock_gettime(clockid_t clkid, struct timespec *ts)
158
+notrace int __vdso_clock_gettime(clockid_t clkid, struct __kernel_old_timespec *ts)
162159 {
163160 struct vdso_data *vdata;
164161 int ret = -1;
....@@ -191,10 +188,10 @@
191188 }
192189
193190 static notrace int clock_getres_fallback(clockid_t _clk_id,
194
- struct timespec *_res)
191
+ struct __kernel_old_timespec *_res)
195192 {
196193 register clockid_t clk_id asm("$r0") = _clk_id;
197
- register struct timespec *res asm("$r1") = _res;
194
+ register struct __kernel_old_timespec *res asm("$r1") = _res;
198195 register int ret asm("$r0");
199196
200197 asm volatile ("movi $r15, %3\n"
....@@ -206,7 +203,7 @@
206203 return ret;
207204 }
208205
209
-notrace int __vdso_clock_getres(clockid_t clk_id, struct timespec *res)
206
+notrace int __vdso_clock_getres(clockid_t clk_id, struct __kernel_old_timespec *res)
210207 {
211208 struct vdso_data *vdata = __get_datapage();
212209
....@@ -230,10 +227,10 @@
230227 return 0;
231228 }
232229
233
-static notrace inline int gettimeofday_fallback(struct timeval *_tv,
230
+static notrace inline int gettimeofday_fallback(struct __kernel_old_timeval *_tv,
234231 struct timezone *_tz)
235232 {
236
- register struct timeval *tv asm("$r0") = _tv;
233
+ register struct __kernel_old_timeval *tv asm("$r0") = _tv;
237234 register struct timezone *tz asm("$r1") = _tz;
238235 register int ret asm("$r0");
239236
....@@ -246,9 +243,9 @@
246243 return ret;
247244 }
248245
249
-notrace int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
246
+notrace int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
250247 {
251
- struct timespec ts;
248
+ struct __kernel_old_timespec ts;
252249 struct vdso_data *vdata;
253250 int ret;
254251