Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/jmcneill-usbmp]: src/sys/dev/usb convert to using SMP usb_detach_wait/wa...
details: https://anonhg.NetBSD.org/src/rev/82286562f93e
branches: jmcneill-usbmp
changeset: 771819:82286562f93e
user: mrg <mrg%NetBSD.org@localhost>
date: Sat Feb 25 20:49:17 2012 +0000
description:
convert to using SMP usb_detach_wait/wakeup().
diffstat:
sys/dev/usb/umass.c | 18 ++++++++++++------
sys/dev/usb/umassvar.h | 5 ++++-
2 files changed, 16 insertions(+), 7 deletions(-)
diffs (85 lines):
diff -r 9485560fb597 -r 82286562f93e sys/dev/usb/umass.c
--- a/sys/dev/usb/umass.c Sat Feb 25 20:47:32 2012 +0000
+++ b/sys/dev/usb/umass.c Sat Feb 25 20:49:17 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: umass.c,v 1.141.6.1 2012/02/24 09:11:43 mrg Exp $ */
+/* $NetBSD: umass.c,v 1.141.6.2 2012/02/25 20:49:17 mrg Exp $ */
/*
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -124,7 +124,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.141.6.1 2012/02/24 09:11:43 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.141.6.2 2012/02/25 20:49:17 mrg Exp $");
#ifdef _KERNEL_OPT
#include "opt_umass.h"
@@ -309,6 +309,9 @@
aprint_naive("\n");
aprint_normal("\n");
+ mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_USB);
+ cv_init(&sc->sc_detach_cv, "umassdet");
+
devinfop = usbd_devinfo_alloc(uaa->device, 0);
aprint_normal_dev(self, "%s\n", devinfop);
usbd_devinfo_free(devinfop);
@@ -658,7 +661,7 @@
{
struct umass_softc *sc = device_private(self);
struct umassbus_softc *scbus;
- int rv = 0, i, s;
+ int rv = 0, i;
DPRINTF(UDMASS_USB, ("%s: detached\n", device_xname(sc->sc_dev)));
@@ -671,15 +674,15 @@
}
/* Do we really need reference counting? Perhaps in ioctl() */
- s = splusb();
+ mutex_enter(&sc->sc_lock);
if (--sc->sc_refcnt >= 0) {
#ifdef DIAGNOSTIC
aprint_normal_dev(self, "waiting for refcnt\n");
#endif
/* Wait for processes to go away. */
- usb_detach_wait(sc->sc_dev);
+ usb_detach_waitcv(sc->sc_dev, &sc->sc_detach_cv, &sc->sc_lock);
}
- splx(s);
+ mutex_exit(&sc->sc_lock);
scbus = sc->bus;
if (scbus != NULL) {
@@ -697,6 +700,9 @@
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
sc->sc_dev);
+ mutex_destroy(&sc->sc_lock);
+ cv_destroy(&sc->sc_detach_cv);
+
return (rv);
}
diff -r 9485560fb597 -r 82286562f93e sys/dev/usb/umassvar.h
--- a/sys/dev/usb/umassvar.h Sat Feb 25 20:47:32 2012 +0000
+++ b/sys/dev/usb/umassvar.h Sat Feb 25 20:49:17 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: umassvar.h,v 1.31 2011/07/31 16:32:02 jakllsch Exp $ */
+/* $NetBSD: umassvar.h,v 1.31.6.1 2012/02/25 20:49:17 mrg Exp $ */
/*-
* Copyright (c) 1999 MAEKAWA Masahide <bishop%rr.iij4u.or.jp@localhost>,
* Nick Hibma <n_hibma%freebsd.org@localhost>
@@ -161,6 +161,9 @@
const struct umass_wire_methods *sc_methods;
+ kmutex_t sc_lock;
+ kcondvar_t sc_detach_cv;
+
u_int8_t sc_wire; /* wire protocol */
#define UMASS_WPROTO_UNSPEC 0
#define UMASS_WPROTO_BBB 1
Home |
Main Index |
Thread Index |
Old Index