Subject: Re: CVS commit: src/sys/kern
To: None <simonb@NetBSD.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: source-changes
Date: 09/10/2006 15:58:10
simonb@NetBSD.org wrote:
> > splclock()/splx() unmatch?
>
> Yes indeed. I was a bit hasty commiting that.
>
> Please commit your fix.
Some people would hate goto (though I think it's okay for "break" case).
Which is better?
---
Izumi Tsutsui
Index: kern_tc.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_tc.c,v
retrieving revision 1.11
diff -u -r1.11 kern_tc.c
--- kern_tc.c 7 Sep 2006 15:48:14 -0000 1.11
+++ kern_tc.c 10 Sep 2006 06:54:43 -0000
@@ -454,17 +454,15 @@
* Even though we run on the dummy counter, switching here may be
* worse since this timecounter may not be monotonous.
*/
- if (tc->tc_quality < 0)
- return;
- if (tc->tc_quality < timecounter->tc_quality)
- return;
- if (tc->tc_quality == timecounter->tc_quality &&
- tc->tc_frequency < timecounter->tc_frequency)
- return;
- (void)tc->tc_get_timecount(tc);
- (void)tc->tc_get_timecount(tc);
- timecounter = tc;
- tc_windup();
+ if (tc->tc_quality >= 0 &&
+ tc->tc_quality >= timecounter->tc_quality &&
+ (tc->tc_quality > timecounter->tc_quality ||
+ tc->tc_frequency >= timecounter->tc_frequency)) {
+ (void)tc->tc_get_timecount(tc);
+ (void)tc->tc_get_timecount(tc);
+ timecounter = tc;
+ tc_windup();
+ }
splx(s);
}