Module Name: src
Committed By: skrll
Date: Thu Sep 11 07:06:13 UTC 2014
Modified Files:
src/sys/arch/arm/broadcom: bcm2835_bsc.c
Log Message:
Initialise bsciichist only once, otherwise the kern_histories list
never ends.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/broadcom/bcm2835_bsc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/arm/broadcom/bcm2835_bsc.c
diff -u src/sys/arch/arm/broadcom/bcm2835_bsc.c:1.2 src/sys/arch/arm/broadcom/bcm2835_bsc.c:1.3
--- src/sys/arch/arm/broadcom/bcm2835_bsc.c:1.2 Thu Mar 20 05:39:11 2014
+++ src/sys/arch/arm/broadcom/bcm2835_bsc.c Thu Sep 11 07:06:13 2014
@@ -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/device.h>
-#include <sys/systm.h>
-#include <sys/mutex.h>
#include <sys/bus.h>
+#include <sys/device.h>
#include <sys/intr.h>
+#include <sys/mutex.h>
+#include <sys/once.h>
+#include <sys/systm.h>
#include <dev/i2c/i2cvar.h>
@@ -48,7 +49,6 @@ __KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc.
#endif
#include <sys/kernhist.h>
-KERNHIST_DECL(bsciichist);
KERNHIST_DEFINE(bsciichist);
struct bsciic_softc {
@@ -75,6 +75,15 @@ CFATTACH_DECL_NEW(bsciic, sizeof(struct
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 @@ bsciic_attach(device_t parent, device_t
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 @@ bsciic_attach(device_t parent, device_t
aprint_naive("\n");
aprint_normal(": BSC%u\n", bscunit);
- KERNHIST_INIT(bsciichist, 512);
+ RUN_ONCE(&control, bsciic_init);
sc->sc_dev = self;