summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/uhub.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2014-07-09 18:15:04 +0000
committermpi <mpi@openbsd.org>2014-07-09 18:15:04 +0000
commit769226aedb150205bf26e4924b82e044a6ef39e8 (patch)
tree2f0c1c8750c31c2ccbcb8913352a9172621182a8 /sys/dev/usb/uhub.c
parentBetter workaround for OS X sigaltstack() bug (diff)
downloadwireguard-openbsd-769226aedb150205bf26e4924b82e044a6ef39e8.tar.xz
wireguard-openbsd-769226aedb150205bf26e4924b82e044a6ef39e8.zip
autoconf(9) is your friend and it knows you more than you think. It
even knows your children! So let him handle the seperation correctly. Do not rewrite your own custom config_detach_children(9) and as a bonus start removing the usbd_port tentacles from the stack. ok pirofti@, yuo@, miod@, deraadt@
Diffstat (limited to 'sys/dev/usb/uhub.c')
-rw-r--r--sys/dev/usb/uhub.c50
1 files changed, 11 insertions, 39 deletions
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c
index b5974247a7f..f8427849add 100644
--- a/sys/dev/usb/uhub.c
+++ b/sys/dev/usb/uhub.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhub.c,v 1.67 2014/05/28 11:20:55 mpi Exp $ */
+/* $OpenBSD: uhub.c,v 1.68 2014/07/09 18:15:04 mpi Exp $ */
/* $NetBSD: uhub.c,v 1.64 2003/02/08 03:32:51 ichiro Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */
@@ -77,23 +77,17 @@ void uhub_intr(struct usbd_xfer *, void *, usbd_status);
int uhub_match(struct device *, void *, void *);
void uhub_attach(struct device *, struct device *, void *);
int uhub_detach(struct device *, int);
-int uhub_activate(struct device *, int);
struct cfdriver uhub_cd = {
NULL, "uhub", DV_DULL
};
-const struct cfattach uhub_ca = {
- sizeof(struct uhub_softc),
- uhub_match,
- uhub_attach,
- uhub_detach,
- uhub_activate,
+const struct cfattach uhub_ca = {
+ sizeof(struct uhub_softc), uhub_match, uhub_attach, uhub_detach
};
-struct cfattach uhub_uhub_ca = {
- sizeof(struct uhub_softc), uhub_match, uhub_attach,
- uhub_detach, uhub_activate
+const struct cfattach uhub_uhub_ca = {
+ sizeof(struct uhub_softc), uhub_match, uhub_attach, uhub_detach
};
int
@@ -395,7 +389,8 @@ uhub_explore(struct usbd_device *dev)
disco:
if (up->device != NULL) {
/* Disconnected */
- usb_disconnect_port(up, &sc->sc_dev);
+ usbd_detach(up->device, &sc->sc_dev);
+ up->device = NULL;
usbd_clear_port_feature(dev, port,
UHF_C_PORT_CONNECTION);
}
@@ -473,31 +468,6 @@ uhub_explore(struct usbd_device *dev)
return (0);
}
-int
-uhub_activate(struct device *self, int act)
-{
- struct uhub_softc *sc = (struct uhub_softc *)self;
- struct usbd_hub *hub = sc->sc_hub->hub;
- struct usbd_device *dev;
- int nports, port, i;
-
- switch (act) {
- case DVACT_DEACTIVATE:
- if (hub == NULL) /* malfunctioning hub */
- break;
- nports = hub->hubdesc.bNbrPorts;
- for(port = 0; port < nports; port++) {
- dev = hub->ports[port].device;
- if (dev != NULL && dev->subdevs != NULL) {
- for (i = 0; dev->subdevs[i] != NULL; i++)
- config_deactivate(dev->subdevs[i]);
- }
- }
- break;
- }
- return (0);
-}
-
/*
* Called from process context when the hub is gone.
* Detach all devices on active ports.
@@ -519,8 +489,10 @@ uhub_detach(struct device *self, int flags)
nports = hub->hubdesc.bNbrPorts;
for(port = 0; port < nports; port++) {
rup = &hub->ports[port];
- if (rup->device)
- usb_disconnect_port(rup, self);
+ if (rup->device != NULL) {
+ usbd_detach(rup->device, self);
+ rup->device = NULL;
+ }
}
if (hub->ports[0].tt)