Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Avoid accessing the device if it is dying.
details: https://anonhg.NetBSD.org/src/rev/c7beefdcbf02
branches: trunk
changeset: 483556:c7beefdcbf02
user: augustss <augustss%NetBSD.org@localhost>
date: Sun Mar 12 21:57:50 2000 +0000
description:
Avoid accessing the device if it is dying.
diffstat:
sys/dev/usb/if_aue.c | 14 +++++++++++++-
sys/dev/usb/if_kue.c | 23 +++++++++++++----------
2 files changed, 26 insertions(+), 11 deletions(-)
diffs (122 lines):
diff -r fdac7ba25a95 -r c7beefdcbf02 sys/dev/usb/if_aue.c
--- a/sys/dev/usb/if_aue.c Sun Mar 12 21:47:16 2000 +0000
+++ b/sys/dev/usb/if_aue.c Sun Mar 12 21:57:50 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_aue.c,v 1.29 2000/03/08 15:33:24 augustss Exp $ */
+/* $NetBSD: if_aue.c,v 1.30 2000/03/12 21:57:50 augustss Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
* Bill Paul <wpaul%ee.columbia.edu@localhost>. All rights reserved.
@@ -280,6 +280,9 @@
uByte val = 0;
int s;
+ if (sc->aue_dying)
+ return (0);
+
req.bmRequestType = UT_READ_VENDOR_DEVICE;
req.bRequest = AUE_UR_READREG;
USETW(req.wValue, 0);
@@ -309,6 +312,9 @@
uWord val;
int s;
+ if (sc->aue_dying)
+ return (0);
+
req.bmRequestType = UT_READ_VENDOR_DEVICE;
req.bRequest = AUE_UR_READREG;
USETW(req.wValue, 0);
@@ -338,6 +344,9 @@
int s;
uByte val;
+ if (sc->aue_dying)
+ return (0);
+
val = aval;
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
req.bRequest = AUE_UR_WRITEREG;
@@ -368,6 +377,9 @@
int s;
uWord val;
+ if (sc->aue_dying)
+ return (0);
+
USETW(val, aval);
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
req.bRequest = AUE_UR_WRITEREG;
diff -r fdac7ba25a95 -r c7beefdcbf02 sys/dev/usb/if_kue.c
--- a/sys/dev/usb/if_kue.c Sun Mar 12 21:47:16 2000 +0000
+++ b/sys/dev/usb/if_kue.c Sun Mar 12 21:57:50 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_kue.c,v 1.14 2000/03/08 15:33:38 augustss Exp $ */
+/* $NetBSD: if_kue.c,v 1.15 2000/03/12 21:59:38 augustss Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
* Bill Paul <wpaul%ee.columbia.edu@localhost>. All rights reserved.
@@ -195,7 +195,7 @@
static void kue_reset __P((struct kue_softc *));
static usbd_status kue_do_request
- __P((usbd_device_handle,
+ __P((struct kue_softc *,
usb_device_request_t *, void *, u_int16_t,
u_int32_t *));
static usbd_status kue_ctl_l __P((struct kue_softc *, int, u_int8_t,
@@ -247,8 +247,8 @@
* than the default timeout.
*/
static usbd_status
-kue_do_request(dev, req, data, flags, lenp)
- usbd_device_handle dev;
+kue_do_request(sc, req, data, flags, lenp)
+ struct kue_softc *sc;
usb_device_request_t *req;
void *data;
u_int16_t flags;
@@ -259,9 +259,12 @@
DPRINTFN(15,("kue_do_request: enter\n"));
- xfer = usbd_alloc_xfer(dev);
+ if (sc->kue_dying)
+ return (0);
+
+ xfer = usbd_alloc_xfer(sc->kue_udev);
/* XXX 20000 */
- usbd_setup_default_xfer(xfer, dev, 0, 20000, req,
+ usbd_setup_default_xfer(xfer, sc->kue_udev, 0, 20000, req,
data, UGETW(req->wLength), flags, 0);
err = usbd_sync_transfer(xfer);
if (lenp != NULL)
@@ -269,7 +272,8 @@
usbd_free_xfer(xfer);
if (err) {
- DPRINTF(("kue_do_request: err=%s\n", usbd_errstr(err)));
+ DPRINTF(("%s: kue_do_request: err=%s\n",
+ USBDEVNAME(sc->kue_dev), usbd_errstr(err)));
}
return (err);
@@ -294,7 +298,7 @@
USETW(req.wLength, 0);
s = splusb();
- err = kue_do_request(sc->kue_udev, &req, NULL, sc->kue_xfer_flags, 0);
+ err = kue_do_request(sc, &req, NULL, sc->kue_xfer_flags, 0);
splx(s);
return (err);
@@ -329,8 +333,7 @@
USETW(req.wLength, len);
s = splusb();
- err = kue_do_request(sc->kue_udev, &req, data,
- sc->kue_xfer_flags | flags, lenp);
+ err = kue_do_request(sc, &req, data, sc->kue_xfer_flags | flags, lenp);
splx(s);
return (err);
Home |
Main Index |
Thread Index |
Old Index