Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Mar 2013 16:07:55 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r247633 - projects/calloutng/sys/kern
Message-ID:  <201303021607.r22G7tHt048125@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sat Mar  2 16:07:55 2013
New Revision: 247633
URL: http://svnweb.freebsd.org/changeset/base/247633

Log:
  Remove some code duplication due to ET_HW_UNLOCK() inlining.

Modified:
  projects/calloutng/sys/kern/kern_clocksource.c

Modified: projects/calloutng/sys/kern/kern_clocksource.c
==============================================================================
--- projects/calloutng/sys/kern/kern_clocksource.c	Sat Mar  2 15:54:02 2013	(r247632)
+++ projects/calloutng/sys/kern/kern_clocksource.c	Sat Mar  2 16:07:55 2013	(r247633)
@@ -822,18 +822,15 @@ clocksource_cyc_set(const struct bintime
 	    (int)(t >> 32), (u_int)(t & 0xffffffff));
 
 	ET_HW_LOCK(state);
-	if (t == state->nextcyc) {
-		ET_HW_UNLOCK(state);
-		return;
-	}
+	if (t == state->nextcyc)
+		goto done;
 	state->nextcyc = t;
-	if (t >= state->nextevent) {
-		ET_HW_UNLOCK(state);
-		return;
-	}
+	if (t >= state->nextevent)
+		goto done;
 	state->nextevent = t;
 	if (!periodic)
 		loadtimer(now, 0);
+done:
 	ET_HW_UNLOCK(state);
 }
 #endif
@@ -841,7 +838,6 @@ clocksource_cyc_set(const struct bintime
 void
 cpu_new_callout(int cpu, sbintime_t bt, sbintime_t bt_opt)
 {
-	sbintime_t now;
 	struct pcpu_state *state;
 
 	/* Do not touch anything if somebody reconfiguring timers. */
@@ -861,26 +857,20 @@ cpu_new_callout(int cpu, sbintime_t bt, 
 	 * and scheduling.
 	 */
 	state->nextcallopt = bt_opt;
-	if (bt >= state->nextcall) {
-		ET_HW_UNLOCK(state);
-		return;
-	}
+	if (bt >= state->nextcall)
+		goto done;
 	state->nextcall = bt;
 	/* If there is some other event set earlier -- do nothing. */
-	if (bt >= state->nextevent) {
-		ET_HW_UNLOCK(state);
-		return;
-	}
+	if (bt >= state->nextevent)
+		goto done;
 	state->nextevent = bt;
 	/* If timer is periodic -- there is nothing to reprogram. */
-	if (periodic) {
-		ET_HW_UNLOCK(state);
-		return;
-	}
+	if (periodic)
+		goto done;
 	/* If timer is global or of the current CPU -- reprogram it. */
 	if ((timer->et_flags & ET_FLAGS_PERCPU) == 0 || cpu == curcpu) {
-		now = sbinuptime();
-		loadtimer(now, 0);
+		loadtimer(sbinuptime(), 0);
+done:
 		ET_HW_UNLOCK(state);
 		return;
 	}



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