There were two places invoking the sc_cobalt_clock_gettime syscalls
and both places would be updated while introducing y2038 support. To
keep y2038 compatibility as simple as possible the code has been moved
into a simple helper function.

Signed-off-by: Florian Bezdeka <[email protected]>
---
 lib/cobalt/clock.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c
index a0673d1fc..3f87278ce 100644
--- a/lib/cobalt/clock.c
+++ b/lib/cobalt/clock.c
@@ -149,6 +149,11 @@ static int __do_clock_host_realtime(struct timespec *ts)
        return 0;
 }
 
+static int __do_clock_gettime(clockid_t clock_id, struct timespec *tp)
+{
+       return -XENOMAI_SYSCALL2(sc_cobalt_clock_gettime, clock_id, tp);
+}
+
 static int gettime_via_tsc(clockid_t clock_id, struct timespec *tp)
 {
        unsigned long rem;
@@ -172,7 +177,7 @@ static int gettime_via_tsc(clockid_t clock_id, struct 
timespec *tp)
                tp->tv_nsec = rem;
                return 0;
        default:
-               ret = -XENOMAI_SYSCALL2(sc_cobalt_clock_gettime, clock_id, tp);
+               ret = __do_clock_gettime(clock_id, tp);
        }
 
        if (ret) {
@@ -197,7 +202,7 @@ static int gettime_via_vdso(clockid_t clock_id, struct 
timespec *tp)
                ret = __cobalt_vdso_gettime(clock_id, tp);
                break;
        default:
-               ret = -XENOMAI_SYSCALL2(sc_cobalt_clock_gettime, clock_id, tp);
+               ret = __do_clock_gettime(clock_id, tp);
        }
 
        if (ret) {
-- 
2.31.1


Reply via email to