@@ -82,8 +82,8 @@ const struct vdso_time_data *__arch_get_vdso_u_timens_data(const struct vdso_tim
82
82
#endif /* CONFIG_GENERIC_VDSO_DATA_STORE */
83
83
84
84
static __always_inline
85
- int do_hres_timens (const struct vdso_time_data * vdns , const struct vdso_clock * vcns ,
86
- clockid_t clk , struct __kernel_timespec * ts )
85
+ bool do_hres_timens (const struct vdso_time_data * vdns , const struct vdso_clock * vcns ,
86
+ clockid_t clk , struct __kernel_timespec * ts )
87
87
{
88
88
const struct vdso_time_data * vd = __arch_get_vdso_u_timens_data (vdns );
89
89
const struct timens_offset * offs = & vcns -> offset [clk ];
@@ -103,11 +103,11 @@ int do_hres_timens(const struct vdso_time_data *vdns, const struct vdso_clock *v
103
103
seq = vdso_read_begin (vc );
104
104
105
105
if (unlikely (!vdso_clocksource_ok (vc )))
106
- return -1 ;
106
+ return false ;
107
107
108
108
cycles = __arch_get_hw_counter (vc -> clock_mode , vd );
109
109
if (unlikely (!vdso_cycles_ok (cycles )))
110
- return -1 ;
110
+ return false ;
111
111
ns = vdso_calc_ns (vc , cycles , vdso_ts -> nsec );
112
112
sec = vdso_ts -> sec ;
113
113
} while (unlikely (vdso_read_retry (vc , seq )));
@@ -123,7 +123,7 @@ int do_hres_timens(const struct vdso_time_data *vdns, const struct vdso_clock *v
123
123
ts -> tv_sec = sec + __iter_div_u64_rem (ns , NSEC_PER_SEC , & ns );
124
124
ts -> tv_nsec = ns ;
125
125
126
- return 0 ;
126
+ return true ;
127
127
}
128
128
#else
129
129
static __always_inline
@@ -133,24 +133,24 @@ const struct vdso_time_data *__arch_get_vdso_u_timens_data(const struct vdso_tim
133
133
}
134
134
135
135
static __always_inline
136
- int do_hres_timens (const struct vdso_time_data * vdns , const struct vdso_clock * vcns ,
137
- clockid_t clk , struct __kernel_timespec * ts )
136
+ bool do_hres_timens (const struct vdso_time_data * vdns , const struct vdso_clock * vcns ,
137
+ clockid_t clk , struct __kernel_timespec * ts )
138
138
{
139
- return - EINVAL ;
139
+ return false ;
140
140
}
141
141
#endif
142
142
143
143
static __always_inline
144
- int do_hres (const struct vdso_time_data * vd , const struct vdso_clock * vc ,
145
- clockid_t clk , struct __kernel_timespec * ts )
144
+ bool do_hres (const struct vdso_time_data * vd , const struct vdso_clock * vc ,
145
+ clockid_t clk , struct __kernel_timespec * ts )
146
146
{
147
147
const struct vdso_timestamp * vdso_ts = & vc -> basetime [clk ];
148
148
u64 cycles , sec , ns ;
149
149
u32 seq ;
150
150
151
151
/* Allows to compile the high resolution parts out */
152
152
if (!__arch_vdso_hres_capable ())
153
- return -1 ;
153
+ return false ;
154
154
155
155
do {
156
156
/*
@@ -173,11 +173,11 @@ int do_hres(const struct vdso_time_data *vd, const struct vdso_clock *vc,
173
173
smp_rmb ();
174
174
175
175
if (unlikely (!vdso_clocksource_ok (vc )))
176
- return -1 ;
176
+ return false ;
177
177
178
178
cycles = __arch_get_hw_counter (vc -> clock_mode , vd );
179
179
if (unlikely (!vdso_cycles_ok (cycles )))
180
- return -1 ;
180
+ return false ;
181
181
ns = vdso_calc_ns (vc , cycles , vdso_ts -> nsec );
182
182
sec = vdso_ts -> sec ;
183
183
} while (unlikely (vdso_read_retry (vc , seq )));
@@ -189,13 +189,13 @@ int do_hres(const struct vdso_time_data *vd, const struct vdso_clock *vc,
189
189
ts -> tv_sec = sec + __iter_div_u64_rem (ns , NSEC_PER_SEC , & ns );
190
190
ts -> tv_nsec = ns ;
191
191
192
- return 0 ;
192
+ return true ;
193
193
}
194
194
195
195
#ifdef CONFIG_TIME_NS
196
196
static __always_inline
197
- int do_coarse_timens (const struct vdso_time_data * vdns , const struct vdso_clock * vcns ,
198
- clockid_t clk , struct __kernel_timespec * ts )
197
+ bool do_coarse_timens (const struct vdso_time_data * vdns , const struct vdso_clock * vcns ,
198
+ clockid_t clk , struct __kernel_timespec * ts )
199
199
{
200
200
const struct vdso_time_data * vd = __arch_get_vdso_u_timens_data (vdns );
201
201
const struct timens_offset * offs = & vcns -> offset [clk ];
@@ -223,20 +223,20 @@ int do_coarse_timens(const struct vdso_time_data *vdns, const struct vdso_clock
223
223
*/
224
224
ts -> tv_sec = sec + __iter_div_u64_rem (nsec , NSEC_PER_SEC , & nsec );
225
225
ts -> tv_nsec = nsec ;
226
- return 0 ;
226
+ return true ;
227
227
}
228
228
#else
229
229
static __always_inline
230
- int do_coarse_timens (const struct vdso_time_data * vdns , const struct vdso_clock * vcns ,
231
- clockid_t clk , struct __kernel_timespec * ts )
230
+ bool do_coarse_timens (const struct vdso_time_data * vdns , const struct vdso_clock * vcns ,
231
+ clockid_t clk , struct __kernel_timespec * ts )
232
232
{
233
- return -1 ;
233
+ return false ;
234
234
}
235
235
#endif
236
236
237
237
static __always_inline
238
- int do_coarse (const struct vdso_time_data * vd , const struct vdso_clock * vc ,
239
- clockid_t clk , struct __kernel_timespec * ts )
238
+ bool do_coarse (const struct vdso_time_data * vd , const struct vdso_clock * vc ,
239
+ clockid_t clk , struct __kernel_timespec * ts )
240
240
{
241
241
const struct vdso_timestamp * vdso_ts = & vc -> basetime [clk ];
242
242
u32 seq ;
@@ -258,10 +258,10 @@ int do_coarse(const struct vdso_time_data *vd, const struct vdso_clock *vc,
258
258
ts -> tv_nsec = vdso_ts -> nsec ;
259
259
} while (unlikely (vdso_read_retry (vc , seq )));
260
260
261
- return 0 ;
261
+ return true ;
262
262
}
263
263
264
- static __always_inline int
264
+ static __always_inline bool
265
265
__cvdso_clock_gettime_common (const struct vdso_time_data * vd , clockid_t clock ,
266
266
struct __kernel_timespec * ts )
267
267
{
@@ -270,7 +270,7 @@ __cvdso_clock_gettime_common(const struct vdso_time_data *vd, clockid_t clock,
270
270
271
271
/* Check for negative values or invalid clocks */
272
272
if (unlikely ((u32 ) clock >= MAX_CLOCKS ))
273
- return -1 ;
273
+ return false ;
274
274
275
275
/*
276
276
* Convert the clockid to a bitmask and use it to check which
@@ -284,7 +284,7 @@ __cvdso_clock_gettime_common(const struct vdso_time_data *vd, clockid_t clock,
284
284
else if (msk & VDSO_RAW )
285
285
vc = & vc [CS_RAW ];
286
286
else
287
- return -1 ;
287
+ return false ;
288
288
289
289
return do_hres (vd , vc , clock , ts );
290
290
}
@@ -293,9 +293,11 @@ static __maybe_unused int
293
293
__cvdso_clock_gettime_data (const struct vdso_time_data * vd , clockid_t clock ,
294
294
struct __kernel_timespec * ts )
295
295
{
296
- int ret = __cvdso_clock_gettime_common (vd , clock , ts );
296
+ bool ok ;
297
+
298
+ ok = __cvdso_clock_gettime_common (vd , clock , ts );
297
299
298
- if (unlikely (ret ))
300
+ if (unlikely (! ok ))
299
301
return clock_gettime_fallback (clock , ts );
300
302
return 0 ;
301
303
}
@@ -312,18 +314,18 @@ __cvdso_clock_gettime32_data(const struct vdso_time_data *vd, clockid_t clock,
312
314
struct old_timespec32 * res )
313
315
{
314
316
struct __kernel_timespec ts ;
315
- int ret ;
317
+ bool ok ;
316
318
317
- ret = __cvdso_clock_gettime_common (vd , clock , & ts );
319
+ ok = __cvdso_clock_gettime_common (vd , clock , & ts );
318
320
319
- if (unlikely (ret ))
321
+ if (unlikely (! ok ))
320
322
return clock_gettime32_fallback (clock , res );
321
323
322
- /* For ret == 0 */
324
+ /* For ok == true */
323
325
res -> tv_sec = ts .tv_sec ;
324
326
res -> tv_nsec = ts .tv_nsec ;
325
327
326
- return ret ;
328
+ return 0 ;
327
329
}
328
330
329
331
static __maybe_unused int
@@ -342,7 +344,7 @@ __cvdso_gettimeofday_data(const struct vdso_time_data *vd,
342
344
if (likely (tv != NULL )) {
343
345
struct __kernel_timespec ts ;
344
346
345
- if (do_hres (vd , & vc [CS_HRES_COARSE ], CLOCK_REALTIME , & ts ))
347
+ if (! do_hres (vd , & vc [CS_HRES_COARSE ], CLOCK_REALTIME , & ts ))
346
348
return gettimeofday_fallback (tv , tz );
347
349
348
350
tv -> tv_sec = ts .tv_sec ;
0 commit comments