Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Feb 2023 22:12:20 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 0448501f2b1a - main - pps: Move pcount assignment in pps_event()
Message-ID:  <202302272212.31RMCK9e028818@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=0448501f2b1a2c89be4042817939645ec6fddfd8

commit 0448501f2b1a2c89be4042817939645ec6fddfd8
Author:     Sebastian Huber <sebastian.huber@embedded-brains.de>
AuthorDate: 2023-02-27 21:49:09 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-02-27 22:10:55 +0000

    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
---
 sys/kern/kern_tc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index b466fd4399e4..b625726123af 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -1842,25 +1842,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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302272212.31RMCK9e028818>