[LinuxPPS] [PATCH 01/11] PPS: Don't waste time getting unnecessary timestamps.

George Spelvin linux at horizon.com
Fri Feb 6 14:25:38 CET 2009


Here is a patch series for cleaning up linuxpps 5.3.4.

---
 drivers/pps/clients/pps-ldisc.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/pps/clients/pps-ldisc.c b/drivers/pps/clients/pps-ldisc.c
index f16396b..0406f40 100644
--- a/drivers/pps/clients/pps-ldisc.c
+++ b/drivers/pps/clients/pps-ldisc.c
@@ -33,17 +33,13 @@ static void pps_tty_dcd_change(struct tty_struct *tty, unsigned int status,
 	struct timespec __ts;
 	struct pps_ktime pps_ts;
 
-	/* First of all we get the time stamp... */
-	getnstimeofday(&__ts);
-
-	/* Does caller give us a timestamp? */
-	if (ts) {	/* Yes. Let's use it! */
-		pps_ts.sec = ts->tv_sec;
-		pps_ts.nsec = ts->tv_nsec;
-	} else {	/* No. Do it ourself! */
-		pps_ts.sec = __ts.tv_sec;
-		pps_ts.nsec = __ts.tv_nsec;
+	/* Get timestamp if necessary */
+	if (!ts) {
+		getnstimeofday(&__ts);
+		ts = &__ts;
 	}
+	pps_ts.sec = ts->tv_sec;
+	pps_ts.nsec = ts->tv_nsec;
 
 	/* Now do the PPS event report */
 	pps_event(id, &pps_ts, status ? PPS_CAPTUREASSERT : PPS_CAPTURECLEAR,
-- 
1.6.0.6




More information about the LinuxPPS mailing list