summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpirofti <pirofti@openbsd.org>2013-11-11 09:16:03 +0000
committerpirofti <pirofti@openbsd.org>2013-11-11 09:16:03 +0000
commitc021bf9edf1c4272a338b906acf11d270f731318 (patch)
treef2d580146888c44ab944bf986a80dc8a0ce72df7
parentReplace most of our formating functions to convert IPv4/6 addresses from (diff)
downloadwireguard-openbsd-c021bf9edf1c4272a338b906acf11d270f731318.tar.xz
wireguard-openbsd-c021bf9edf1c4272a338b906acf11d270f731318.zip
Clean-up the activate routines from the uoak*(4) drivers.
Leave the deactivate bits to the parent. Simplify by making a single dying check in uhidev(4) interrupt routine instead of having each child doing it. Okay mpi@
-rw-r--r--sys/dev/usb/uhidev.c6
-rw-r--r--sys/dev/usb/uoaklux.c20
-rw-r--r--sys/dev/usb/uoakrh.c20
-rw-r--r--sys/dev/usb/uoakv.c20
4 files changed, 8 insertions, 58 deletions
diff --git a/sys/dev/usb/uhidev.c b/sys/dev/usb/uhidev.c
index d111176c8ba..de4258898b5 100644
--- a/sys/dev/usb/uhidev.c
+++ b/sys/dev/usb/uhidev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhidev.c,v 1.49 2013/11/01 17:42:59 mpi Exp $ */
+/* $OpenBSD: uhidev.c,v 1.50 2013/11/11 09:16:03 pirofti Exp $ */
/* $NetBSD: uhidev.c,v 1.14 2003/03/11 16:44:00 augustss Exp $ */
/*
@@ -354,6 +354,7 @@ uhidev_activate(struct device *self, int act)
if (r && r != EOPNOTSUPP)
rv = r;
}
+ usbd_deactivate(sc->sc_udev);
break;
}
return (rv);
@@ -393,6 +394,9 @@ uhidev_intr(struct usbd_xfer *xfer, void *addr, usbd_status status)
u_int rep;
u_int32_t cc;
+ if (usbd_is_dying(sc->sc_udev))
+ return;
+
usbd_get_xfer_status(xfer, NULL, NULL, &cc, NULL);
#ifdef UHIDEV_DEBUG
diff --git a/sys/dev/usb/uoaklux.c b/sys/dev/usb/uoaklux.c
index ffa6c664b2b..990f230f4c0 100644
--- a/sys/dev/usb/uoaklux.c
+++ b/sys/dev/usb/uoaklux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uoaklux.c,v 1.4 2013/04/15 09:23:02 mglocker Exp $ */
+/* $OpenBSD: uoaklux.c,v 1.5 2013/11/11 09:16:03 pirofti Exp $ */
/*
* Copyright (c) 2012 Yojiro UO <yuo@nui.org>
@@ -62,7 +62,6 @@ struct uoaklux_sensor {
struct uoaklux_softc {
struct uhidev sc_hdev;
- u_char sc_dying;
/* uoak common */
struct uoak_softc sc_uoak_softc;
@@ -81,7 +80,6 @@ const struct usb_devno uoaklux_devs[] = {
int uoaklux_match(struct device *, void *, void *);
void uoaklux_attach(struct device *, struct device *, void *);
int uoaklux_detach(struct device *, int);
-int uoaklux_activate(struct device *, int);
void uoaklux_intr(struct uhidev *, void *, u_int);
void uoaklux_refresh(void *);
@@ -101,7 +99,6 @@ const struct cfattach uoaklux_ca = {
uoaklux_match,
uoaklux_attach,
uoaklux_detach,
- uoaklux_activate,
};
struct uoak_methods uoaklux_methods = {
@@ -221,19 +218,6 @@ uoaklux_detach(struct device *self, int flags)
return (rv);
}
-int
-uoaklux_activate(struct device *self, int act)
-{
- struct uoaklux_softc *sc = (struct uoaklux_softc *)self;
-
- switch (act) {
- case DVACT_DEACTIVATE:
- sc->sc_dying = 1;
- break;
- }
- return (0);
-}
-
void
uoaklux_intr(struct uhidev *addr, void *ibuf, u_int len)
{
@@ -241,8 +225,6 @@ uoaklux_intr(struct uhidev *addr, void *ibuf, u_int len)
struct uoak_softc *scc = &sc->sc_uoak_softc;
int frame, val;
- if (sc->sc_dying)
- return;
if (scc->sc_ibuf == NULL)
return;
diff --git a/sys/dev/usb/uoakrh.c b/sys/dev/usb/uoakrh.c
index 769b97d7233..bd29ba1ab3d 100644
--- a/sys/dev/usb/uoakrh.c
+++ b/sys/dev/usb/uoakrh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uoakrh.c,v 1.5 2013/04/15 09:23:02 mglocker Exp $ */
+/* $OpenBSD: uoakrh.c,v 1.6 2013/11/11 09:16:03 pirofti Exp $ */
/*
* Copyright (c) 2012 Yojiro UO <yuo@nui.org>
@@ -62,7 +62,6 @@ struct uoakrh_sensor {
struct uoakrh_softc {
struct uhidev sc_hdev;
- u_char sc_dying;
/* uoak common */
struct uoak_softc sc_uoak_softc;
@@ -84,7 +83,6 @@ const struct usb_devno uoakrh_devs[] = {
int uoakrh_match(struct device *, void *, void *);
void uoakrh_attach(struct device *, struct device *, void *);
int uoakrh_detach(struct device *, int);
-int uoakrh_activate(struct device *, int);
void uoakrh_intr(struct uhidev *, void *, u_int);
void uoakrh_refresh(void *);
@@ -104,7 +102,6 @@ const struct cfattach uoakrh_ca = {
uoakrh_match,
uoakrh_attach,
uoakrh_detach,
- uoakrh_activate,
};
struct uoak_methods uoakrh_methods = {
@@ -237,19 +234,6 @@ uoakrh_detach(struct device *self, int flags)
return (rv);
}
-int
-uoakrh_activate(struct device *self, int act)
-{
- struct uoakrh_softc *sc = (struct uoakrh_softc *)self;
-
- switch (act) {
- case DVACT_DEACTIVATE:
- sc->sc_dying = 1;
- break;
- }
- return (0);
-}
-
void
uoakrh_intr(struct uhidev *addr, void *ibuf, u_int len)
{
@@ -258,8 +242,6 @@ uoakrh_intr(struct uhidev *addr, void *ibuf, u_int len)
struct uoak_softc *scc = &sc->sc_uoak_softc;
int frame, temp, humi;
- if (sc->sc_dying)
- return;
if (scc->sc_ibuf == NULL)
return;
diff --git a/sys/dev/usb/uoakv.c b/sys/dev/usb/uoakv.c
index 4f9996a64e9..93243a2aab0 100644
--- a/sys/dev/usb/uoakv.c
+++ b/sys/dev/usb/uoakv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uoakv.c,v 1.4 2013/04/15 09:23:02 mglocker Exp $ */
+/* $OpenBSD: uoakv.c,v 1.5 2013/11/11 09:16:03 pirofti Exp $ */
/*
* Copyright (c) 2012 Yojiro UO <yuo@nui.org>
@@ -60,7 +60,6 @@ struct uoakv_sensor {
struct uoakv_softc {
struct uhidev sc_hdev;
- u_char sc_dying;
/* uoak common */
struct uoak_softc sc_uoak_softc;
@@ -83,7 +82,6 @@ const struct usb_devno uoakv_devs[] = {
int uoakv_match(struct device *, void *, void *);
void uoakv_attach(struct device *, struct device *, void *);
int uoakv_detach(struct device *, int);
-int uoakv_activate(struct device *, int);
void uoakv_intr(struct uhidev *, void *, u_int);
void uoakv_refresh(void *);
@@ -104,7 +102,6 @@ const struct cfattach uoakv_ca = {
uoakv_match,
uoakv_attach,
uoakv_detach,
- uoakv_activate,
};
@@ -225,19 +222,6 @@ uoakv_detach(struct device *self, int flags)
return (rv);
}
-int
-uoakv_activate(struct device *self, int act)
-{
- struct uoakv_softc *sc = (struct uoakv_softc *)self;
-
- switch (act) {
- case DVACT_DEACTIVATE:
- sc->sc_dying = 1;
- break;
- }
- return (0);
-}
-
void
uoakv_intr(struct uhidev *addr, void *ibuf, u_int len)
{
@@ -246,8 +230,6 @@ uoakv_intr(struct uhidev *addr, void *ibuf, u_int len)
int i, idx, frame;
int16_t val;
- if (sc->sc_dying)
- return;
if (scc->sc_ibuf == NULL)
return;