Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/gemini Bracket timer_init() with disable_interr...



details:   https://anonhg.NetBSD.org/src/rev/5528570f6357
branches:  trunk
changeset: 794580:5528570f6357
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Mar 18 12:54:29 2014 +0000

description:
Bracket timer_init() with disable_interrupts()/restore_interrupts()
properly. Pointed out by Chris Gilbert.

diffstat:

 sys/arch/arm/gemini/gemini_timer.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 62c8c40e7a7b -r 5528570f6357 sys/arch/arm/gemini/gemini_timer.c
--- a/sys/arch/arm/gemini/gemini_timer.c        Tue Mar 18 11:00:20 2014 +0000
+++ b/sys/arch/arm/gemini/gemini_timer.c        Tue Mar 18 12:54:29 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gemini_timer.c,v 1.6 2014/03/09 10:33:23 martin Exp $  */
+/*     $NetBSD: gemini_timer.c,v 1.7 2014/03/18 12:54:29 martin Exp $  */
 
 /* adapted from:
  *     NetBSD: omap2_geminitmr.c,v 1.1 2008/08/27 11:03:10 matt Exp
@@ -81,7 +81,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gemini_timer.c,v 1.6 2014/03/09 10:33:23 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gemini_timer.c,v 1.7 2014/03/18 12:54:29 martin Exp $");
 
 #include "opt_gemini.h"
 #include "opt_cpuoptions.h"
@@ -257,7 +257,9 @@
 static void
 timer_init(geminitmr_softc_t *sc, int schz, boolean_t autoload, boolean_t intr)
 {
-       disable_interrupts(I32_bit);
+       int psw;
+
+       psw = disable_interrupts(I32_bit);
        timer_factors(sc, schz, autoload);
        _timer_stop(sc);
        _timer_intr_dis(sc);
@@ -265,7 +267,7 @@
        if (intr)
                _timer_intr_enb(sc);
        _timer_start(sc);
-       enable_interrupts(I32_bit);
+       restore_interrupts(psw);
 }
 
 void



Home | Main Index | Thread Index | Old Index