diff options
author | Paul Irofti <pirofti@cvs.openbsd.org> | 2013-11-07 13:11:11 +0000 |
---|---|---|
committer | Paul Irofti <pirofti@cvs.openbsd.org> | 2013-11-07 13:11:11 +0000 |
commit | 4a5c8765dbadba00e3803c71c974da535df652ef (patch) | |
tree | 6a6fc0e1650ca8d5763cf745796192748431aaf6 /sys | |
parent | 134114f3cfe784b63ecb5a7f822bc470792cec45 (diff) |
Replace sc_dying in favour of usbd_is_dying() and usbd_deactivate().
Okay mpi@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb/ulpt.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/urio.c | 13 |
2 files changed, 13 insertions, 15 deletions
diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index da457f59b69..00e6974c84e 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ulpt.c,v 1.44 2013/09/20 15:34:51 mpi Exp $ */ +/* $OpenBSD: ulpt.c,v 1.45 2013/11/07 13:11:10 pirofti Exp $ */ /* $NetBSD: ulpt.c,v 1.57 2003/01/05 10:19:42 scw Exp $ */ /* $FreeBSD: src/sys/dev/usb/ulpt.c,v 1.24 1999/11/17 22:33:44 n_hibma Exp $ */ @@ -103,7 +103,6 @@ struct ulpt_softc { u_char sc_laststatus; int sc_refcnt; - u_char sc_dying; struct ulpt_fwdev *sc_fwdev; }; @@ -266,7 +265,7 @@ ulpt_attach(struct device *parent, struct device *self, void *aux) if (err) { printf("%s: setting alternate interface failed\n", sc->sc_dev.dv_xname); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); return; } } @@ -294,7 +293,7 @@ ulpt_attach(struct device *parent, struct device *self, void *aux) if (sc->sc_out == -1) { printf("%s: could not find bulk out endpoint\n", sc->sc_dev.dv_xname); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); return; } @@ -365,7 +364,7 @@ ulpt_activate(struct device *self, int act) switch (act) { case DVACT_DEACTIVATE: - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); break; } return (0); @@ -482,7 +481,7 @@ ulptopen(dev_t dev, int flag, int mode, struct proc *p) if (sc == NULL) return (ENXIO); - if (sc == NULL || sc->sc_iface == NULL || sc->sc_dying) + if (sc == NULL || sc->sc_iface == NULL || usbd_is_dying(sc->sc_udev)) return (ENXIO); if (sc->sc_state) @@ -497,7 +496,7 @@ ulptopen(dev_t dev, int flag, int mode, struct proc *p) if ((flags & ULPT_NOPRIME) == 0) { ulpt_reset(sc); - if (sc->sc_dying) { + if (usbd_is_dying(sc->sc_udev)) { error = ENXIO; sc->sc_state = 0; goto done; @@ -659,7 +658,7 @@ ulptwrite(dev_t dev, struct uio *uio, int flags) sc = ulpt_cd.cd_devs[ULPTUNIT(dev)]; - if (sc->sc_dying) + if (usbd_is_dying(sc->sc_udev)) return (EIO); sc->sc_refcnt++; diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c index e900d8b455a..73b7a22f1b9 100644 --- a/sys/dev/usb/urio.c +++ b/sys/dev/usb/urio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: urio.c,v 1.43 2013/09/20 15:34:51 mpi Exp $ */ +/* $OpenBSD: urio.c,v 1.44 2013/11/07 13:10:43 pirofti Exp $ */ /* $NetBSD: urio.c,v 1.15 2002/10/23 09:14:02 jdolecek Exp $ */ /* @@ -80,7 +80,6 @@ struct urio_softc { struct usbd_pipe *sc_out_pipe; int sc_refcnt; - char sc_dying; }; #define URIOUNIT(n) (minor(n)) @@ -231,7 +230,7 @@ urio_activate(struct device *self, int act) switch (act) { case DVACT_DEACTIVATE: - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); break; } return (0); @@ -252,7 +251,7 @@ urioopen(dev_t dev, int flag, int mode, struct proc *p) DPRINTFN(5, ("urioopen: flag=%d, mode=%d, unit=%d\n", flag, mode, URIOUNIT(dev))); - if (sc->sc_dying) + if (usbd_is_dying(sc->sc_udev)) return (EIO); if (sc->sc_in_pipe != NULL) @@ -311,7 +310,7 @@ urioread(dev_t dev, struct uio *uio, int flag) DPRINTFN(5, ("urioread: %d\n", URIOUNIT(dev))); - if (sc->sc_dying) + if (usbd_is_dying(sc->sc_udev)) return (EIO); xfer = usbd_alloc_xfer(sc->sc_udev); @@ -368,7 +367,7 @@ uriowrite(dev_t dev, struct uio *uio, int flag) DPRINTFN(5, ("uriowrite: unit=%d, len=%ld\n", URIOUNIT(dev), (long)uio->uio_resid)); - if (sc->sc_dying) + if (usbd_is_dying(sc->sc_udev)) return (EIO); xfer = usbd_alloc_xfer(sc->sc_udev); @@ -432,7 +431,7 @@ urioioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) sc = urio_cd.cd_devs[unit]; - if (sc->sc_dying) + if (usbd_is_dying(sc->sc_udev)) return (EIO); rcmd = (struct urio_command *)addr; |