MFC rev 1.2:
authorHasso Tepper <hasso@dragonflybsd.org>
Sat, 9 Aug 2008 09:15:05 +0000 (9 09:15 +0000)
committerHasso Tepper <hasso@dragonflybsd.org>
Sat, 9 Aug 2008 09:15:05 +0000 (9 09:15 +0000)
  Detach correctly so there is no need to panic during reattach.

sys/dev/misc/cmx/cmx.c

index 373870f..0010386 100644 (file)
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/cmx/cmx.c,v 1.1 2008/03/06 08:09:45 rink Exp $
- * $DragonFly: src/sys/dev/misc/cmx/cmx.c,v 1.1 2008/04/23 08:57:10 hasso Exp $
+ * $DragonFly: src/sys/dev/misc/cmx/cmx.c,v 1.1.2.1 2008/08/09 09:15:05 hasso Exp $
  */
 
 /*
@@ -284,10 +284,10 @@ cmx_detach(device_t dev)
        }
 
        wakeup(sc);
-       destroy_dev(sc->cdev);
-
        DEBUG_printf(dev, "releasing resources\n");
        cmx_release_resources(dev);
+       dev_ops_remove(&cmx_ops, -1, device_get_unit(dev));
+
        return 0;
 }