---
 cpukit/score/src/kern_tc.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/cpukit/score/src/kern_tc.c b/cpukit/score/src/kern_tc.c
index 89ece1fbde..3256b646ef 100644
--- a/cpukit/score/src/kern_tc.c
+++ b/cpukit/score/src/kern_tc.c
@@ -1659,9 +1659,9 @@ _Timecounter_Windup(struct bintime *new_boottimebin,
        struct timecounter *tc;
        struct timehands *th, *tho;
        uint32_t delta, ncount;
-#if defined(RTEMS_SMP)
+#ifdef __rtems__
        u_int ogen;
-#endif
+#endif /* __rtems__ */
        int i;
        time_t t;
 #ifdef __rtems__
@@ -1686,6 +1686,7 @@ _Timecounter_Windup(struct bintime *new_boottimebin,
        memcpy(th, tho, offsetof(struct timehands, th_generation));
 #else
        th = tho;
+       ogen = th->th_generation;
 #endif
        if (new_boottimebin != NULL)
                th->th_boottime = *new_boottimebin;
@@ -1783,7 +1784,7 @@ _Timecounter_Windup(struct bintime *new_boottimebin,
 #endif
        }
 
-#if defined(RTEMS_SMP)
+#ifdef __rtems__
        /*
         * Now that the struct timehands is again consistent, set the new
         * generation number, making sure to not make it zero.
@@ -1791,9 +1792,7 @@ _Timecounter_Windup(struct bintime *new_boottimebin,
        if (++ogen == 0)
                ogen = 1;
        atomic_store_rel_int(&th->th_generation, ogen);
-#else
-       atomic_store_rel_int(&th->th_generation, th->th_generation + 1);
-#endif
+#endif /* __rtems__ */
 
        /* Go live with the new struct timehands. */
 #ifdef FFCLOCK
@@ -2323,13 +2322,13 @@ _Timecounter_Tick_simple(uint32_t delta, uint32_t 
offset,
 {
        struct bintime bt;
        struct timehands *th;
-#if defined(RTEMS_SMP)
+#ifdef __rtems__
        u_int ogen;
-#endif
+#endif /* __rtems__ */
 
        th = timehands;
-#if defined(RTEMS_SMP)
        ogen = th->th_generation;
+#if defined(RTEMS_SMP)
        th->th_generation = 0;
        atomic_thread_fence_rel();
 #endif
@@ -2344,7 +2343,7 @@ _Timecounter_Tick_simple(uint32_t delta, uint32_t offset,
        bintime2timeval(&bt, &th->th_microtime);
        bintime2timespec(&bt, &th->th_nanotime);
 
-#if defined(RTEMS_SMP)
+#ifdef __rtems__
        /*
         * Now that the struct timehands is again consistent, set the new
         * generation number, making sure to not make it zero.
@@ -2352,9 +2351,7 @@ _Timecounter_Tick_simple(uint32_t delta, uint32_t offset,
        if (++ogen == 0)
                ogen = 1;
        atomic_store_rel_int(&th->th_generation, ogen);
-#else
-       atomic_store_rel_int(&th->th_generation, th->th_generation + 1);
-#endif
+#endif /* __rtems__ */
 
        /* Go live with the new struct timehands. */
        time_second = th->th_microtime.tv_sec;
-- 
2.25.1

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to