Commit 8463cf80 authored by Christophe Leroy's avatar Christophe Leroy Committed by Thomas Gleixner

lib/vdso: Let do_coarse() return 0 to simplify the callsite

do_coarse() is similar to do_hres() except that it never fails.

Change its type to int instead of void and let it always return success (0)
to simplify the call site.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/21e8afa38c02ca8672c2690307383507fe63b454.1577111367.git.christophe.leroy@c-s.fr
parent 0b5c1233
...@@ -68,7 +68,7 @@ static int do_hres(const struct vdso_data *vd, clockid_t clk, ...@@ -68,7 +68,7 @@ static int do_hres(const struct vdso_data *vd, clockid_t clk,
return 0; return 0;
} }
static void do_coarse(const struct vdso_data *vd, clockid_t clk, static int do_coarse(const struct vdso_data *vd, clockid_t clk,
struct __kernel_timespec *ts) struct __kernel_timespec *ts)
{ {
const struct vdso_timestamp *vdso_ts = &vd->basetime[clk]; const struct vdso_timestamp *vdso_ts = &vd->basetime[clk];
...@@ -79,6 +79,8 @@ static void do_coarse(const struct vdso_data *vd, clockid_t clk, ...@@ -79,6 +79,8 @@ static void do_coarse(const struct vdso_data *vd, clockid_t clk,
ts->tv_sec = vdso_ts->sec; ts->tv_sec = vdso_ts->sec;
ts->tv_nsec = vdso_ts->nsec; ts->tv_nsec = vdso_ts->nsec;
} while (unlikely(vdso_read_retry(vd, seq))); } while (unlikely(vdso_read_retry(vd, seq)));
return 0;
} }
static __maybe_unused int static __maybe_unused int
...@@ -96,14 +98,13 @@ __cvdso_clock_gettime_common(clockid_t clock, struct __kernel_timespec *ts) ...@@ -96,14 +98,13 @@ __cvdso_clock_gettime_common(clockid_t clock, struct __kernel_timespec *ts)
* clocks are handled in the VDSO directly. * clocks are handled in the VDSO directly.
*/ */
msk = 1U << clock; msk = 1U << clock;
if (likely(msk & VDSO_HRES)) { if (likely(msk & VDSO_HRES))
return do_hres(&vd[CS_HRES_COARSE], clock, ts); return do_hres(&vd[CS_HRES_COARSE], clock, ts);
} else if (msk & VDSO_COARSE) { else if (msk & VDSO_COARSE)
do_coarse(&vd[CS_HRES_COARSE], clock, ts); return do_coarse(&vd[CS_HRES_COARSE], clock, ts);
return 0; else if (msk & VDSO_RAW)
} else if (msk & VDSO_RAW) {
return do_hres(&vd[CS_RAW], clock, ts); return do_hres(&vd[CS_RAW], clock, ts);
}
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment