[rtems commit] pps: Move pcount assignment in pps_event()

Sebastian Huber sebh at rtems.org
Thu Mar 9 06:54:14 UTC 2023


Module:    rtems
Branch:    master
Commit:    6730543457855f69be28e016e190043764b25073
Changeset: http://git.rtems.org/rtems/commit/?id=6730543457855f69be28e016e190043764b25073

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Feb 27 14:49:09 2023 -0700

pps: Move pcount assignment in pps_event()

Move the pseq increment.  This makes it possible to reuse registers earlier.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604

---

 cpukit/score/src/kern_tc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cpukit/score/src/kern_tc.c b/cpukit/score/src/kern_tc.c
index 99abd652d8..586331dc7a 100644
--- a/cpukit/score/src/kern_tc.c
+++ b/cpukit/score/src/kern_tc.c
@@ -2226,25 +2226,25 @@ pps_event(struct pps_state *pps, int event)
 #endif
 	}
 
+	*pcount = pps->capcount;
+
 	/*
 	 * If the timecounter changed, we cannot compare the count values, so
 	 * we have to drop the rest of the PPS-stuff until the next event.
 	 */
 	if (__predict_false(pps->ppstc != captc)) {
 		pps->ppstc = captc;
-		*pcount = pps->capcount;
 		pps->ppscount[2] = pps->capcount;
 		return;
 	}
 
+	(*pseq)++;
+
 	/* Convert the count to a timespec. */
 	tcount = pps->capcount - tcount;
 	tcount &= captc->tc_counter_mask;
 	bintime_addx(&bt, capth_scale * tcount);
 	bintime2timespec(&bt, &ts);
-
-	*pcount = pps->capcount;
-	(*pseq)++;
 	*tsp = ts;
 
 	if (foff) {



More information about the vc mailing list