Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/iomd Replace a __cpu_simple_lock_t with a kmute...



details:   https://anonhg.NetBSD.org/src/rev/bff5f49366b5
branches:  trunk
changeset: 779324:bff5f49366b5
user:      skrll <skrll%NetBSD.org@localhost>
date:      Fri May 18 21:09:50 2012 +0000

description:
Replace a __cpu_simple_lock_t with a kmutex_t.

diffstat:

 sys/arch/arm/iomd/iomd_clock.c |  19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diffs (84 lines):

diff -r 519e7eebed8a -r bff5f49366b5 sys/arch/arm/iomd/iomd_clock.c
--- a/sys/arch/arm/iomd/iomd_clock.c    Fri May 18 20:52:02 2012 +0000
+++ b/sys/arch/arm/iomd/iomd_clock.c    Fri May 18 21:09:50 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iomd_clock.c,v 1.28 2012/05/15 05:45:37 skrll Exp $    */
+/*     $NetBSD: iomd_clock.c,v 1.29 2012/05/18 21:09:50 skrll Exp $    */
 
 /*
  * Copyright (c) 1994-1997 Mark Brinicombe.
@@ -47,7 +47,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: iomd_clock.c,v 1.28 2012/05/15 05:45:37 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iomd_clock.c,v 1.29 2012/05/18 21:09:50 skrll Exp $");
 
 #include <sys/systm.h>
 #include <sys/types.h>
@@ -86,13 +86,12 @@
 
 static u_int iomd_timecounter0_get(struct timecounter *tc);
 
-
 static volatile uint32_t timer0_lastcount;
 static volatile uint32_t timer0_offset;
 static volatile int timer0_ticked;
 /* TODO: Get IRQ status */
 
-static __cpu_simple_lock_t tmr_lock = __SIMPLELOCK_UNLOCKED;
+static kmutex_t tmr_lock;
 
 static struct timecounter iomd_timecounter = {
        iomd_timecounter0_get,
@@ -144,9 +143,10 @@
        sc->sc_ioh = ca->ca_ioh; /* This is a handle for the whole IOMD */
 
        clock_sc = sc;
+       mutex_init(&tmr_lock, MUTEX_DEFAULT, IPL_CLOCK);
 
        /* Cannot do anything until cpu_initclocks() has been called */
-       
+
        aprint_normal("\n");
 }
 
@@ -156,14 +156,14 @@
 {
        if (timer0_count && 
            timecounter->tc_get_timecount == iomd_timecounter0_get) {
-               __cpu_simple_lock(&tmr_lock);
+               mutex_spin_enter(&tmr_lock);
                if (timer0_ticked)
                        timer0_ticked    = 0;
                else {
                        timer0_offset   += timer0_count;
                        timer0_lastcount = 0;
                }
-               __cpu_simple_unlock(&tmr_lock);
+               mutex_spin_exit(&tmr_lock);
        }
 
 }
@@ -323,10 +323,9 @@
        tm += (bus_space_read_1(clock_sc->sc_iot, clock_sc->sc_ioh,
            IOMD_T0HIGH) << 8);
        splx(s);
-       simple_lock(&tmr_lock);
 
+       mutex_spin_enter(&tmr_lock);
        tm = timer0_count - tm;
-       
 
        if (timer0_count &&
            (tm < timer0_lastcount || (!timer0_ticked && false/* XXX: clkintr_pending */))) {
@@ -336,8 +335,8 @@
 
        timer0_lastcount = tm;
        tm += timer0_offset;
+       mutex_spin_exit(&tmr_lock);
 
-       simple_unlock(&tmr_lock);
        return tm;
 }
 



Home | Main Index | Thread Index | Old Index