Module Name:    src
Committed By:   riastradh
Date:           Sun Aug  5 02:36:16 UTC 2012

Modified Files:
        src/sys/dev/ieee1394: firewire.c

Log Message:
Restore config pending stuff, adjusted to avoid the race.

Leave a note about what this code probably should look like for
anyone who comes rummaging around with the intent to really fix it.
I would do that myself if I had time and resources to test this at
the moment, and more comfort with our firewire stack, but I don't.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/ieee1394/firewire.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/ieee1394/firewire.c
diff -u src/sys/dev/ieee1394/firewire.c:1.40 src/sys/dev/ieee1394/firewire.c:1.41
--- src/sys/dev/ieee1394/firewire.c:1.40	Sat Aug  4 03:55:43 2012
+++ src/sys/dev/ieee1394/firewire.c	Sun Aug  5 02:36:16 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewire.c,v 1.40 2012/08/04 03:55:43 riastradh Exp $	*/
+/*	$NetBSD: firewire.c,v 1.41 2012/08/05 02:36:16 riastradh Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.40 2012/08/04 03:55:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.41 2012/08/05 02:36:16 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -255,6 +255,9 @@ firewireattach(device_t parent, device_t
 
 	callout_schedule(&fc->timeout_callout, hz);
 
+	/* Tell config we will have started a thread to scan the bus.  */
+	config_pending_incr();
+
 	/* create thread */
 	if (kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL, fw_bus_probe_thread,
 	    fc, &fc->probe_thread, "fw%dprobe", device_unit(fc->bdev)))
@@ -1943,6 +1946,22 @@ fw_bus_probe_thread(void *arg)
 {
 	struct firewire_comm *fc = (struct firewire_comm *)arg;
 
+	/*
+	 * Tell config we've scanned the bus.
+	 *
+	 * XXX This is not right -- we haven't actually scanned it.  We
+	 * probably ought to call this after the first bus exploration.
+	 *
+	 * bool once = false;
+	 * ...
+	 * 	fw_attach_dev(fc);
+	 * 	if (!once) {
+	 * 		config_pending_decr();
+	 * 		once = true;
+	 * 	}
+	 */
+	config_pending_decr();
+
 	mutex_enter(&fc->wait_lock);
 	while (fc->status != FWBUSDETACH) {
 		if (fc->status == FWBUSEXPLORE) {

Reply via email to