summaryrefslogtreecommitdiffstats
path: root/sys/dev/cy
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2004-04-05 07:43:18 +0000
committerbde <bde@FreeBSD.org>2004-04-05 07:43:18 +0000
commite061b47c7ce99c64b583508213a4121e588085f6 (patch)
treecc7c7d5f055d427ebf5ab297784099813b68cd30 /sys/dev/cy
parentdfeeeaf38c52be58a1dd8d4d0ec53741bad8fe76 (diff)
downloadFreeBSD-src-e061b47c7ce99c64b583508213a4121e588085f6.zip
FreeBSD-src-e061b47c7ce99c64b583508213a4121e588085f6.tar.gz
Moved initialization of the lock from the (isa) probe function to the
common attach function so that the lock gets initialized in all cases. This fixes breakage of the initialization of the lock in the pci case in rev.1.135 (between the releases of 5.1 and 5.2). The lock is only used in the SMP case, so this bug was not always fatal.
Diffstat (limited to 'sys/dev/cy')
-rw-r--r--sys/dev/cy/cy.c12
-rw-r--r--sys/dev/cy/cy_isa.c12
2 files changed, 12 insertions, 12 deletions
diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c
index 7207846..218f57f 100644
--- a/sys/dev/cy/cy.c
+++ b/sys/dev/cy/cy.c
@@ -428,12 +428,6 @@ sioprobe(dev)
{
cy_addr iobase;
- while (sio_inited != 2)
- if (atomic_cmpset_int(&sio_inited, 0, 1)) {
- mtx_init(&sio_lock, driver_name, NULL, MTX_SPIN);
- atomic_store_rel_int(&sio_inited, 2);
- }
-
iobase = (cy_addr)dev->id_maddr;
/* Cyclom-16Y hardware reset (Cyclom-8Ys don't care) */
@@ -538,6 +532,12 @@ cyattach_common(cy_iobase, cy_align)
int ncyu;
int unit;
+ while (sio_inited != 2)
+ if (atomic_cmpset_int(&sio_inited, 0, 1)) {
+ mtx_init(&sio_lock, driver_name, NULL, MTX_SPIN);
+ atomic_store_rel_int(&sio_inited, 2);
+ }
+
adapter = cy_total_devices;
if ((u_int)adapter >= NCY) {
printf(
diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c
index 7207846..218f57f 100644
--- a/sys/dev/cy/cy_isa.c
+++ b/sys/dev/cy/cy_isa.c
@@ -428,12 +428,6 @@ sioprobe(dev)
{
cy_addr iobase;
- while (sio_inited != 2)
- if (atomic_cmpset_int(&sio_inited, 0, 1)) {
- mtx_init(&sio_lock, driver_name, NULL, MTX_SPIN);
- atomic_store_rel_int(&sio_inited, 2);
- }
-
iobase = (cy_addr)dev->id_maddr;
/* Cyclom-16Y hardware reset (Cyclom-8Ys don't care) */
@@ -538,6 +532,12 @@ cyattach_common(cy_iobase, cy_align)
int ncyu;
int unit;
+ while (sio_inited != 2)
+ if (atomic_cmpset_int(&sio_inited, 0, 1)) {
+ mtx_init(&sio_lock, driver_name, NULL, MTX_SPIN);
+ atomic_store_rel_int(&sio_inited, 2);
+ }
+
adapter = cy_total_devices;
if ((u_int)adapter >= NCY) {
printf(
OpenPOWER on IntegriCloud