Module Name: src
Committed By: pgoyette
Date: Thu Dec 10 05:29:41 UTC 2015
Modified Files:
src/sys/dev/pci: ichsmb.c piixpm.c
Log Message:
Initialize the mutex before calling xxx_rescan(). Otherwise if we
load/attach an i2cbus at a later time (ie, load the iic module),
we'll end-up re-initializing the mutex.
(Caught with a LOCKDEBUG kernel)
To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/pci/ichsmb.c
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/pci/piixpm.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/dev/pci/ichsmb.c
diff -u src/sys/dev/pci/ichsmb.c:1.44 src/sys/dev/pci/ichsmb.c:1.45
--- src/sys/dev/pci/ichsmb.c:1.44 Tue Dec 1 10:08:03 2015
+++ src/sys/dev/pci/ichsmb.c Thu Dec 10 05:29:41 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: ichsmb.c,v 1.44 2015/12/01 10:08:03 msaitoh Exp $ */
+/* $NetBSD: ichsmb.c,v 1.45 2015/12/10 05:29:41 pgoyette Exp $ */
/* $OpenBSD: ichiic.c,v 1.18 2007/05/03 09:36:26 dlg Exp $ */
/*
@@ -22,7 +22,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.44 2015/12/01 10:08:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.45 2015/12/10 05:29:41 pgoyette Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -188,6 +188,7 @@ ichsmb_attach(device_t parent, device_t
sc->sc_i2c_device = NULL;
flags = 0;
+ mutex_init(&sc->sc_i2c_mutex, MUTEX_DEFAULT, IPL_NONE);
ichsmb_rescan(self, "i2cbus", &flags);
out: if (!pmf_device_register(self, NULL, NULL))
@@ -207,7 +208,6 @@ ichsmb_rescan(device_t self, const char
return 0;
/* Attach I2C bus */
- mutex_init(&sc->sc_i2c_mutex, MUTEX_DEFAULT, IPL_NONE);
sc->sc_i2c_tag.ic_cookie = sc;
sc->sc_i2c_tag.ic_acquire_bus = ichsmb_i2c_acquire_bus;
sc->sc_i2c_tag.ic_release_bus = ichsmb_i2c_release_bus;
Index: src/sys/dev/pci/piixpm.c
diff -u src/sys/dev/pci/piixpm.c:1.46 src/sys/dev/pci/piixpm.c:1.47
--- src/sys/dev/pci/piixpm.c:1.46 Sun May 3 22:51:11 2015
+++ src/sys/dev/pci/piixpm.c Thu Dec 10 05:29:41 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpm.c,v 1.46 2015/05/03 22:51:11 pgoyette Exp $ */
+/* $NetBSD: piixpm.c,v 1.47 2015/12/10 05:29:41 pgoyette Exp $ */
/* $OpenBSD: piixpm.c,v 1.20 2006/02/27 08:25:02 grange Exp $ */
/*
@@ -22,7 +22,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.46 2015/05/03 22:51:11 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.47 2015/12/10 05:29:41 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -257,6 +257,7 @@ attach_i2c:
sc->sc_i2c_device[i] = NULL;
flags = 0;
+ mutex_init(&sc->sc_i2c_mutex, MUTEX_DEFAULT, IPL_NONE);
piixpm_rescan(self, "i2cbus", &flags);
}
@@ -271,7 +272,6 @@ piixpm_rescan(device_t self, const char
return 0;
/* Attach I2C bus */
- mutex_init(&sc->sc_i2c_mutex, MUTEX_DEFAULT, IPL_NONE);
for (i = 0; i < sc->sc_numbusses; i++) {
if (sc->sc_i2c_device[i])