Module Name:    src
Committed By:   msaitoh
Date:           Thu Feb  1 09:47:47 UTC 2018

Modified Files:
        src/sys/dev/usb: ohci.c

Log Message:
- Fix panic on shutdown reported by ozaki-r in PR kern/52961. Use callot_halt()
  correctly. Tested by me and OK'd by Nick.
- Disable interrupt in och_shutdown() to prevent hangup. OK'd by Nick.


To generate a diff of this commit:
cvs rdiff -u -r1.276 -r1.277 src/sys/dev/usb/ohci.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/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.276 src/sys/dev/usb/ohci.c:1.277
--- src/sys/dev/usb/ohci.c:1.276	Fri Nov 17 08:22:02 2017
+++ src/sys/dev/usb/ohci.c	Thu Feb  1 09:47:47 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.276 2017/11/17 08:22:02 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.277 2018/02/01 09:47:47 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.276 2017/11/17 08:22:02 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.277 2018/02/01 09:47:47 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -377,13 +377,11 @@ ohci_detach(struct ohci_softc *sc, int f
 	if (rv != 0)
 		return rv;
 
-	callout_halt(&sc->sc_tmo_rhsc, &sc->sc_lock);
+	softint_disestablish(sc->sc_rhsc_si);
 
-	usb_delay_ms(&sc->sc_bus, 300); /* XXX let stray task complete */
+	callout_halt(&sc->sc_tmo_rhsc, NULL);
 	callout_destroy(&sc->sc_tmo_rhsc);
 
-	softint_disestablish(sc->sc_rhsc_si);
-
 	cv_destroy(&sc->sc_softwake_cv);
 
 	mutex_destroy(&sc->sc_lock);
@@ -1111,6 +1109,7 @@ ohci_shutdown(device_t self, int flags)
 	OHCIHIST_FUNC(); OHCIHIST_CALLED();
 
 	DPRINTF("stopping the HC", 0, 0, 0, 0);
+	OWRITE4(sc, OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTRS);
 	OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET);
 	return true;
 }

Reply via email to