diff options
-rw-r--r-- | sys/dev/usb/ubsa.c | 26 | ||||
-rw-r--r-- | sys/dev/usb/umct.c | 26 |
2 files changed, 24 insertions, 28 deletions
diff --git a/sys/dev/usb/ubsa.c b/sys/dev/usb/ubsa.c index 43484a66606..8de970dba89 100644 --- a/sys/dev/usb/ubsa.c +++ b/sys/dev/usb/ubsa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubsa.c,v 1.57 2013/04/15 09:23:02 mglocker Exp $ */ +/* $OpenBSD: ubsa.c,v 1.58 2013/11/07 07:32:36 pirofti Exp $ */ /* $NetBSD: ubsa.c,v 1.5 2002/11/25 00:51:33 fvdl Exp $ */ /*- * Copyright (c) 2002, Alexander Kabaev <kan.FreeBSD.org>. @@ -164,8 +164,6 @@ struct ubsa_softc { struct device *sc_subdev; /* ucom device */ - u_char sc_dying; /* disconnecting */ - }; void ubsa_intr(struct usbd_xfer *, void *, usbd_status); @@ -280,7 +278,7 @@ ubsa_attach(struct device *parent, struct device *self, void *aux) if (err) { printf("%s: failed to set configuration: %s\n", devname, usbd_errstr(err)); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); goto error; } @@ -290,7 +288,7 @@ ubsa_attach(struct device *parent, struct device *self, void *aux) if (cdesc == NULL) { printf("%s: failed to get configuration descriptor\n", devname); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); goto error; } @@ -300,7 +298,7 @@ ubsa_attach(struct device *parent, struct device *self, void *aux) if (err) { printf("%s: failed to get interface: %s\n", devname, usbd_errstr(err)); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); goto error; } @@ -314,7 +312,7 @@ ubsa_attach(struct device *parent, struct device *self, void *aux) if (ed == NULL) { printf("%s: no endpoint descriptor for %d\n", sc->sc_dev.dv_xname, i); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); goto error; } @@ -335,19 +333,19 @@ ubsa_attach(struct device *parent, struct device *self, void *aux) if (sc->sc_intr_number == -1) { printf("%s: Could not find interrupt in\n", devname); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); goto error; } if (uca.bulkin == -1) { printf("%s: Could not find data bulk in\n", devname); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); goto error; } if (uca.bulkout == -1) { printf("%s: Could not find data bulk out\n", devname); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); goto error; } @@ -404,7 +402,7 @@ ubsa_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); @@ -611,7 +609,7 @@ ubsa_open(void *addr, int portno) struct ubsa_softc *sc = addr; int err; - if (sc->sc_dying) + if (usbd_is_dying(sc->sc_udev)) return (ENXIO); DPRINTF(("ubsa_open: sc = %p\n", sc)); @@ -644,7 +642,7 @@ ubsa_close(void *addr, int portno) struct ubsa_softc *sc = addr; int err; - if (sc->sc_dying) + if (usbd_is_dying(sc->sc_udev)) return; DPRINTF(("ubsa_close: close\n")); @@ -674,7 +672,7 @@ ubsa_intr(struct usbd_xfer *xfer, void *priv, usbd_status status) buf = sc->sc_intr_buf; cdcbuf = (struct usb_cdc_notification *)sc->sc_intr_buf; - if (sc->sc_dying) + if (usbd_is_dying(sc->sc_udev)) return; if (status != USBD_NORMAL_COMPLETION) { diff --git a/sys/dev/usb/umct.c b/sys/dev/usb/umct.c index b4d6ecd5013..e0f32d2b9c3 100644 --- a/sys/dev/usb/umct.c +++ b/sys/dev/usb/umct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umct.c,v 1.36 2013/04/15 09:23:02 mglocker Exp $ */ +/* $OpenBSD: umct.c,v 1.37 2013/11/07 07:32:07 pirofti Exp $ */ /* $NetBSD: umct.c,v 1.10 2003/02/23 04:20:07 simonb Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -92,8 +92,6 @@ struct umct_softc { struct device *sc_subdev; /* ucom device */ - u_char sc_dying; /* disconnecting */ - u_char sc_lsr; /* Local status register */ u_char sc_msr; /* umct status register */ @@ -205,7 +203,7 @@ umct_attach(struct device *parent, struct device *self, void *aux) if (err) { printf("\n%s: failed to set configuration, err=%s\n", devname, usbd_errstr(err)); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); return; } @@ -215,7 +213,7 @@ umct_attach(struct device *parent, struct device *self, void *aux) if (cdesc == NULL) { printf("%s: failed to get configuration descriptor\n", sc->sc_dev.dv_xname); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); return; } @@ -225,7 +223,7 @@ umct_attach(struct device *parent, struct device *self, void *aux) if (err) { printf("\n%s: failed to get interface, err=%s\n", devname, usbd_errstr(err)); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); return; } @@ -239,7 +237,7 @@ umct_attach(struct device *parent, struct device *self, void *aux) if (ed == NULL) { printf("%s: no endpoint descriptor for %d\n", sc->sc_dev.dv_xname, i); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); return; } @@ -265,21 +263,21 @@ umct_attach(struct device *parent, struct device *self, void *aux) if (uca.bulkin == -1) { printf("%s: Could not find data bulk in\n", sc->sc_dev.dv_xname); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); return; } if (uca.bulkout == -1) { printf("%s: Could not find data bulk out\n", sc->sc_dev.dv_xname); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); return; } if (sc->sc_intr_number== -1) { printf("%s: Could not find interrupt in\n", sc->sc_dev.dv_xname); - sc->sc_dying = 1; + usbd_deactivate(sc->sc_udev); return; } @@ -339,7 +337,7 @@ umct_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); @@ -531,7 +529,7 @@ umct_open(void *addr, int portno) struct umct_softc *sc = addr; int err, lcr_data; - if (sc->sc_dying) + if (usbd_is_dying(sc->sc_udev)) return (EIO); DPRINTF(("umct_open: sc=%p\n", sc)); @@ -564,7 +562,7 @@ umct_close(void *addr, int portno) struct umct_softc *sc = addr; int err; - if (sc->sc_dying) + if (usbd_is_dying(sc->sc_udev)) return; DPRINTF(("umct_close: close\n")); @@ -590,7 +588,7 @@ umct_intr(struct usbd_xfer *xfer, void *priv, usbd_status status) u_char *buf = sc->sc_intr_buf; u_char mstatus; - if (sc->sc_dying) + if (usbd_is_dying(sc->sc_udev)) return; if (status != USBD_NORMAL_COMPLETION) { |