summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPaul Irofti <pirofti@cvs.openbsd.org>2013-11-07 12:53:15 +0000
committerPaul Irofti <pirofti@cvs.openbsd.org>2013-11-07 12:53:15 +0000
commitb26328f2fed1ecc939e5ae30382e81b5c9fbfc45 (patch)
tree37877fd3508af1863980b2062dde2bf0055d2cdc /sys
parentd82ae2ffad4b74060b0644d5cebc3aa6c20d0b63 (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/moscom.c16
-rw-r--r--sys/dev/usb/ucycom.c13
-rw-r--r--sys/dev/usb/umodem.c11
3 files changed, 17 insertions, 23 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;