@@ -82,8 +82,8 @@ const struct vdso_time_data *__arch_get_vdso_u_timens_data(const struct vdso_tim
8282#endif /* CONFIG_GENERIC_VDSO_DATA_STORE */
8383
8484static __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 )
8787{
8888 const struct vdso_time_data * vd = __arch_get_vdso_u_timens_data (vdns );
8989 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
103103 seq = vdso_read_begin (vc );
104104
105105 if (unlikely (!vdso_clocksource_ok (vc )))
106- return -1 ;
106+ return false ;
107107
108108 cycles = __arch_get_hw_counter (vc -> clock_mode , vd );
109109 if (unlikely (!vdso_cycles_ok (cycles )))
110- return -1 ;
110+ return false ;
111111 ns = vdso_calc_ns (vc , cycles , vdso_ts -> nsec );
112112 sec = vdso_ts -> sec ;
113113 } 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
123123 ts -> tv_sec = sec + __iter_div_u64_rem (ns , NSEC_PER_SEC , & ns );
124124 ts -> tv_nsec = ns ;
125125
126- return 0 ;
126+ return true ;
127127}
128128#else
129129static __always_inline
@@ -133,24 +133,24 @@ const struct vdso_time_data *__arch_get_vdso_u_timens_data(const struct vdso_tim
133133}
134134
135135static __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 )
138138{
139- return - EINVAL ;
139+ return false ;
140140}
141141#endif
142142
143143static __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 )
146146{
147147 const struct vdso_timestamp * vdso_ts = & vc -> basetime [clk ];
148148 u64 cycles , sec , ns ;
149149 u32 seq ;
150150
151151 /* Allows to compile the high resolution parts out */
152152 if (!__arch_vdso_hres_capable ())
153- return -1 ;
153+ return false ;
154154
155155 do {
156156 /*
@@ -173,11 +173,11 @@ int do_hres(const struct vdso_time_data *vd, const struct vdso_clock *vc,
173173 smp_rmb ();
174174
175175 if (unlikely (!vdso_clocksource_ok (vc )))
176- return -1 ;
176+ return false ;
177177
178178 cycles = __arch_get_hw_counter (vc -> clock_mode , vd );
179179 if (unlikely (!vdso_cycles_ok (cycles )))
180- return -1 ;
180+ return false ;
181181 ns = vdso_calc_ns (vc , cycles , vdso_ts -> nsec );
182182 sec = vdso_ts -> sec ;
183183 } 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,
189189 ts -> tv_sec = sec + __iter_div_u64_rem (ns , NSEC_PER_SEC , & ns );
190190 ts -> tv_nsec = ns ;
191191
192- return 0 ;
192+ return true ;
193193}
194194
195195#ifdef CONFIG_TIME_NS
196196static __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 )
199199{
200200 const struct vdso_time_data * vd = __arch_get_vdso_u_timens_data (vdns );
201201 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
223223 */
224224 ts -> tv_sec = sec + __iter_div_u64_rem (nsec , NSEC_PER_SEC , & nsec );
225225 ts -> tv_nsec = nsec ;
226- return 0 ;
226+ return true ;
227227}
228228#else
229229static __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 )
232232{
233- return -1 ;
233+ return false ;
234234}
235235#endif
236236
237237static __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 )
240240{
241241 const struct vdso_timestamp * vdso_ts = & vc -> basetime [clk ];
242242 u32 seq ;
@@ -258,10 +258,10 @@ int do_coarse(const struct vdso_time_data *vd, const struct vdso_clock *vc,
258258 ts -> tv_nsec = vdso_ts -> nsec ;
259259 } while (unlikely (vdso_read_retry (vc , seq )));
260260
261- return 0 ;
261+ return true ;
262262}
263263
264- static __always_inline int
264+ static __always_inline bool
265265__cvdso_clock_gettime_common (const struct vdso_time_data * vd , clockid_t clock ,
266266 struct __kernel_timespec * ts )
267267{
@@ -270,7 +270,7 @@ __cvdso_clock_gettime_common(const struct vdso_time_data *vd, clockid_t clock,
270270
271271 /* Check for negative values or invalid clocks */
272272 if (unlikely ((u32 ) clock >= MAX_CLOCKS ))
273- return -1 ;
273+ return false ;
274274
275275 /*
276276 * 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,
284284 else if (msk & VDSO_RAW )
285285 vc = & vc [CS_RAW ];
286286 else
287- return -1 ;
287+ return false ;
288288
289289 return do_hres (vd , vc , clock , ts );
290290}
@@ -293,9 +293,11 @@ static __maybe_unused int
293293__cvdso_clock_gettime_data (const struct vdso_time_data * vd , clockid_t clock ,
294294 struct __kernel_timespec * ts )
295295{
296- int ret = __cvdso_clock_gettime_common (vd , clock , ts );
296+ bool ok ;
297+
298+ ok = __cvdso_clock_gettime_common (vd , clock , ts );
297299
298- if (unlikely (ret ))
300+ if (unlikely (! ok ))
299301 return clock_gettime_fallback (clock , ts );
300302 return 0 ;
301303}
@@ -312,18 +314,18 @@ __cvdso_clock_gettime32_data(const struct vdso_time_data *vd, clockid_t clock,
312314 struct old_timespec32 * res )
313315{
314316 struct __kernel_timespec ts ;
315- int ret ;
317+ bool ok ;
316318
317- ret = __cvdso_clock_gettime_common (vd , clock , & ts );
319+ ok = __cvdso_clock_gettime_common (vd , clock , & ts );
318320
319- if (unlikely (ret ))
321+ if (unlikely (! ok ))
320322 return clock_gettime32_fallback (clock , res );
321323
322- /* For ret == 0 */
324+ /* For ok == true */
323325 res -> tv_sec = ts .tv_sec ;
324326 res -> tv_nsec = ts .tv_nsec ;
325327
326- return ret ;
328+ return 0 ;
327329}
328330
329331static __maybe_unused int
@@ -342,7 +344,7 @@ __cvdso_gettimeofday_data(const struct vdso_time_data *vd,
342344 if (likely (tv != NULL )) {
343345 struct __kernel_timespec ts ;
344346
345- if (do_hres (vd , & vc [CS_HRES_COARSE ], CLOCK_REALTIME , & ts ))
347+ if (! do_hres (vd , & vc [CS_HRES_COARSE ], CLOCK_REALTIME , & ts ))
346348 return gettimeofday_fallback (tv , tz );
347349
348350 tv -> tv_sec = ts .tv_sec ;
0 commit comments