Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/jmcneill-usbmp]: src/sys/dev fix detach bugs:



details:   https://anonhg.NetBSD.org/src/rev/df01bc4dfddc
branches:  jmcneill-usbmp
changeset: 771838:df01bc4dfddc
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Mar 12 06:42:15 2012 +0000

description:
fix detach bugs:
- need to disestablish the ehci softint's.
- need to destroy needs_explore_cv
- note that ehci.c inits locks, but ehci_pci.c destroys them due to the
  way that the (pci) front end does softint handling, and can only be
  trusted to destroy them.  XXX need to fix this, by looking at the many
  ehci frontends as well and checking ohci/uhci.

diffstat:

 sys/dev/pci/ehci_pci.c |  10 ++++++++--
 sys/dev/usb/ehci.c     |  11 +++++++++--
 sys/dev/usb/usb.c      |   6 ++++--
 3 files changed, 21 insertions(+), 6 deletions(-)

diffs (96 lines):

diff -r f4a4561b5f54 -r df01bc4dfddc sys/dev/pci/ehci_pci.c
--- a/sys/dev/pci/ehci_pci.c    Mon Mar 12 04:11:56 2012 +0000
+++ b/sys/dev/pci/ehci_pci.c    Mon Mar 12 06:42:15 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci_pci.c,v 1.53.6.3 2012/02/18 07:34:36 mrg Exp $    */
+/*     $NetBSD: ehci_pci.c,v 1.53.6.4 2012/03/12 06:42:15 mrg Exp $    */
 
 /*
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.53.6.3 2012/02/18 07:34:36 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.53.6.4 2012/03/12 06:42:15 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -299,9 +299,15 @@
                sc->sc.sc_size = 0;
        }
 
+#if 1
+       /* XXX created in ehci.c */
        mutex_destroy(&sc->sc.sc_lock);
        mutex_destroy(&sc->sc.sc_intr_lock);
 
+       softint_disestablish(sc->sc.sc_doorbell_si);
+       softint_disestablish(sc->sc.sc_pcd_si);
+#endif
+
        return 0;
 }
 
diff -r f4a4561b5f54 -r df01bc4dfddc sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Mon Mar 12 04:11:56 2012 +0000
+++ b/sys/dev/usb/ehci.c        Mon Mar 12 06:42:15 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.181.6.17 2012/03/11 01:52:28 mrg Exp $ */
+/*     $NetBSD: ehci.c,v 1.181.6.18 2012/03/12 06:42:15 mrg Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.181.6.17 2012/03/11 01:52:28 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.181.6.18 2012/03/12 06:42:15 mrg Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -1165,9 +1165,16 @@
        cv_destroy(&sc->sc_doorbell);
        cv_destroy(&sc->sc_softwake_cv);
 
+#if 0
+       /* XXX destroyed in ehci_pci.c as it controls ehci_intr access */
+
        softint_disestablish(sc->sc_doorbell_si);
        softint_disestablish(sc->sc_pcd_si);
 
+       mutex_destroy(&sc->sc_lock);
+       mutex_destroy(&sc->sc_intr_lock);
+#endif
+
        while ((xfer = SIMPLEQ_FIRST(&sc->sc_free_xfers)) != NULL) {
                SIMPLEQ_REMOVE_HEAD(&sc->sc_free_xfers, next);
                kmem_free(xfer, sizeof(struct ehci_xfer));
diff -r f4a4561b5f54 -r df01bc4dfddc sys/dev/usb/usb.c
--- a/sys/dev/usb/usb.c Mon Mar 12 04:11:56 2012 +0000
+++ b/sys/dev/usb/usb.c Mon Mar 12 06:42:15 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb.c,v 1.125.6.12 2012/02/26 05:05:45 mrg Exp $       */
+/*     $NetBSD: usb.c,v 1.125.6.13 2012/03/12 06:42:15 mrg Exp $       */
 
 /*
  * Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.125.6.12 2012/02/26 05:05:45 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.125.6.13 2012/03/12 06:42:15 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_usb.h"
@@ -1053,6 +1053,8 @@
        ue->u.ue_ctrlr.ue_bus = device_unit(self);
        usb_add_event(USB_EVENT_CTRLR_DETACH, ue);
 
+       cv_destroy(&sc->sc_bus->needs_explore_cv);
+
        return (0);
 }
 



Home | Main Index | Thread Index | Old Index