diff options
author | 2013-11-07 12:52:15 +0000 | |
---|---|---|
committer | 2013-11-07 12:52:15 +0000 | |
commit | 9f2e12365917845a407c9b164be62bfd8690b3dd (patch) | |
tree | a46eee086a065b933a83807466ac9fedc0f5fd61 | |
parent | Replace sc_dying in favour of usbd_is_dying() and usbd_deactivate(). (diff) | |
download | wireguard-openbsd-9f2e12365917845a407c9b164be62bfd8690b3dd.tar.xz wireguard-openbsd-9f2e12365917845a407c9b164be62bfd8690b3dd.zip |
Replace sc_dying in favour of usbd_is_dying() and usbd_deactivate().
Okay mpi@
-rw-r--r-- | sys/dev/usb/moscom.c | 16 | ||||
-rw-r--r-- | sys/dev/usb/ucycom.c | 13 | ||||
-rw-r--r-- | sys/dev/usb/umodem.c | 11 | ||||
-rw-r--r-- | sys/dev/usb/uvisor.c | 10 |
4 files changed, 21 insertions, 29 deletions
diff --git a/sys/dev/usb/moscom.c b/sys/dev/usb/moscom.c index df072b619e9..d18f8550cd8 100644 --- a/sys/dev/usb/moscom.c +++ b/sys/dev/usb/moscom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: moscom.c,v 1.17 2013/04/15 09:23:01 mglocker Exp $ */ +/* $OpenBSD: moscom.c,v 1.18 2013/11/07 12:52:42 pirofti Exp $ */ /* * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> @@ -141,8 +141,6 @@ struct moscom_softc { u_char sc_msr; u_char sc_lsr; u_char sc_lcr; - - u_char sc_dying; }; void moscom_set(void *, int, int, int); @@ -211,7 +209,7 @@ moscom_attach(struct device *parent, struct device *self, void *aux) if (usbd_set_config_index(sc->sc_udev, MOSCOM_CONFIG_NO, 1) != 0) { printf("%s: could not set configuration no\n", sc->sc_dev.dv_xname); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); return; } @@ -221,7 +219,7 @@ moscom_attach(struct device *parent, struct device *self, void *aux) if (error != 0) { printf("%s: could not get interface handle\n", sc->sc_dev.dv_xname); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); return; } @@ -233,7 +231,7 @@ moscom_attach(struct device *parent, struct device *self, void *aux) if (ed == NULL) { printf("%s: no endpoint descriptor found for %d\n", sc->sc_dev.dv_xname, i); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); return; } @@ -247,7 +245,7 @@ moscom_attach(struct device *parent, struct device *self, void *aux) if (uca.bulkin == -1 || uca.bulkout == -1) { printf("%s: missing endpoint\n", sc->sc_dev.dv_xname); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); return; } @@ -288,7 +286,7 @@ moscom_activate(struct device *self, int act) case DVACT_DEACTIVATE: if (sc->sc_subdev != NULL) rv = config_deactivate(sc->sc_subdev); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); break; } return (rv); @@ -300,7 +298,7 @@ moscom_open(void *vsc, int portno) struct moscom_softc *sc = vsc; usb_device_request_t req; - if (sc->sc_dying) + if (usbd_is_dying(sc->sc_udev)) return (EIO); /* Purge FIFOs or odd things happen */ diff --git a/sys/dev/usb/ucycom.c b/sys/dev/usb/ucycom.c index ef3c06ff899..a45e24bda7e 100644 --- a/sys/dev/usb/ucycom.c +++ b/sys/dev/usb/ucycom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ucycom.c,v 1.22 2013/04/15 09:23:02 mglocker Exp $ */ +/* $OpenBSD: ucycom.c,v 1.23 2013/11/07 12:52:15 pirofti Exp $ */ /* $NetBSD: ucycom.c,v 1.3 2005/08/05 07:27:47 skrll Exp $ */ /* @@ -120,9 +120,6 @@ struct ucycom_softc { int sc_swflags; struct device *sc_subdev; - - /* flags */ - u_char sc_dying; }; /* Callback routines */ @@ -264,7 +261,7 @@ ucycom_open(void *addr, int portno) DPRINTF(("ucycom_open: complete\n")); - if (sc->sc_dying) + if (usbd_is_dying(sc->sc_udev)) return (EIO); /* Allocate an output report buffer */ @@ -297,7 +294,7 @@ ucycom_close(void *addr, int portno) struct ucycom_softc *sc = addr; int s; - if (sc->sc_dying) + if (usbd_is_dying(sc->sc_udev)) return; s = splusb(); @@ -393,7 +390,7 @@ ucycom_param(void *addr, int portno, struct termios *t) uint8_t cfg; int err; - if (sc->sc_dying) + if (usbd_is_dying(sc->sc_udev)) return (EIO); switch (t->c_ospeed) { @@ -598,7 +595,7 @@ ucycom_activate(struct device *self, int act) case DVACT_DEACTIVATE: if (sc->sc_subdev != NULL) rv = config_deactivate(sc->sc_subdev); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); break; } return (rv); diff --git a/sys/dev/usb/umodem.c b/sys/dev/usb/umodem.c index d55b4a282f0..256bffc6a7a 100644 --- a/sys/dev/usb/umodem.c +++ b/sys/dev/usb/umodem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umodem.c,v 1.50 2013/07/05 07:56:36 mpi Exp $ */ +/* $OpenBSD: umodem.c,v 1.51 2013/11/07 12:53:14 pirofti Exp $ */ /* $NetBSD: umodem.c,v 1.45 2002/09/23 05:51:23 simonb Exp $ */ /* @@ -103,7 +103,6 @@ struct umodem_softc { struct device *sc_subdev; /* ucom device */ u_char sc_opening; /* lock during open */ - u_char sc_dying; /* disconnecting */ int sc_ctl_notify; /* Notification endpoint */ struct usbd_pipe *sc_notify_pipe; /* Notification pipe */ @@ -402,7 +401,7 @@ umodem_attach(struct device *parent, struct device *self, void *aux) return; bad: - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); } int @@ -456,7 +455,7 @@ umodem_intr(struct usbd_xfer *xfer, void *priv, usbd_status status) struct umodem_softc *sc = priv; u_char mstatus; - if (sc->sc_dying) + if (usbd_is_dying(sc->sc_udev)) return; if (status != USBD_NORMAL_COMPLETION) { @@ -575,7 +574,7 @@ umodem_ioctl(void *addr, int portno, u_long cmd, caddr_t data, int flag, struct umodem_softc *sc = addr; int error = 0; - if (sc->sc_dying) + if (usbd_is_dying(sc->sc_udev)) return (EIO); DPRINTF(("umodemioctl: cmd=0x%08lx\n", cmd)); @@ -750,7 +749,7 @@ umodem_activate(struct device *self, int act) switch (act) { case DVACT_DEACTIVATE: - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); if (sc->sc_subdev) rv = config_deactivate(sc->sc_subdev); break; diff --git a/sys/dev/usb/uvisor.c b/sys/dev/usb/uvisor.c index dc8684d07bd..d053ec62f1a 100644 --- a/sys/dev/usb/uvisor.c +++ b/sys/dev/usb/uvisor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvisor.c,v 1.46 2013/04/15 09:23:02 mglocker Exp $ */ +/* $OpenBSD: uvisor.c,v 1.47 2013/11/07 12:54:35 pirofti Exp $ */ /* $NetBSD: uvisor.c,v 1.21 2003/08/03 21:59:26 nathanw Exp $ */ /* @@ -138,8 +138,6 @@ struct uvisor_softc { int sc_numcon; u_int16_t sc_flags; - - u_char sc_dying; }; usbd_status uvisor_init(struct uvisor_softc *, @@ -372,7 +370,7 @@ uvisor_attach(struct device *parent, struct device *self, void *aux) bad: DPRINTF(("uvisor_attach: ATTACH ERROR\n")); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); } int @@ -389,7 +387,7 @@ uvisor_activate(struct device *self, int act) if (r) rv = r; } - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); break; } return (rv); @@ -482,7 +480,7 @@ uvisor_close(void *addr, int portno) struct uvisor_connection_info coninfo; /* XXX ? */ int actlen; - if (sc->sc_dying) + if (usbd_is_dying(sc->sc_udev)) return; req.bmRequestType = UT_READ_VENDOR_ENDPOINT; /* XXX read? */ |