Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/broadcom Initialise bsciichist only once, other...



details:   https://anonhg.NetBSD.org/src/rev/bb5f5df19a08
branches:  trunk
changeset: 802346:bb5f5df19a08
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu Sep 11 07:06:13 2014 +0000

description:
Initialise bsciichist only once, otherwise the kern_histories list
never ends.

diffstat:

 sys/arch/arm/broadcom/bcm2835_bsc.c |  24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diffs (70 lines):

diff -r 46890eb4c777 -r bb5f5df19a08 sys/arch/arm/broadcom/bcm2835_bsc.c
--- a/sys/arch/arm/broadcom/bcm2835_bsc.c       Thu Sep 11 06:56:05 2014 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_bsc.c       Thu Sep 11 07:06:13 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_bsc.c,v 1.2 2014/03/20 05:39:11 ozaki-r Exp $  */
+/*     $NetBSD: bcm2835_bsc.c,v 1.3 2014/09/11 07:06:13 skrll Exp $    */
 
 /*
  * Copyright (c) 2012 Jonathan A. Kollasch
@@ -27,14 +27,15 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc.c,v 1.2 2014/03/20 05:39:11 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc.c,v 1.3 2014/09/11 07:06:13 skrll Exp $");
 
 #include <sys/param.h>
+#include <sys/bus.h>
 #include <sys/device.h>
-#include <sys/systm.h>
+#include <sys/intr.h>
 #include <sys/mutex.h>
-#include <sys/bus.h>
-#include <sys/intr.h>
+#include <sys/once.h>
+#include <sys/systm.h>
 
 #include <dev/i2c/i2cvar.h>
 
@@ -48,7 +49,6 @@
 #endif
 #include <sys/kernhist.h>
 
-KERNHIST_DECL(bsciichist);
 KERNHIST_DEFINE(bsciichist);
 
 struct bsciic_softc {
@@ -75,6 +75,15 @@
     bsciic_match, bsciic_attach, NULL, NULL);
 
 static int
+bsciic_init(void)
+{
+
+       KERNHIST_INIT(bsciichist, 512);
+
+       return 0;
+}
+
+static int
 bsciic_match(device_t parent, cfdata_t match, void *aux)
 {
        struct amba_attach_args * const aaa = aux;
@@ -92,6 +101,7 @@
        struct amba_attach_args * const aaa = aux;
        struct i2cbus_attach_args iba;
        u_int bscunit = ~0;
+       static ONCE_DECL(control);
 
        switch (aaa->aaa_addr) {
        case BCM2835_BSC0_BASE:
@@ -105,7 +115,7 @@
        aprint_naive("\n");
        aprint_normal(": BSC%u\n", bscunit);
 
-       KERNHIST_INIT(bsciichist, 512);
+       RUN_ONCE(&control, bsciic_init);
 
        sc->sc_dev = self;
 



Home | Main Index | Thread Index | Old Index