summaryrefslogtreecommitdiff
path: root/sys/dev/usb/uhub.c
diff options
context:
space:
mode:
authorAaron Campbell <aaron@cvs.openbsd.org>2000-11-08 18:10:40 +0000
committerAaron Campbell <aaron@cvs.openbsd.org>2000-11-08 18:10:40 +0000
commit96193b435e7220a9f8f67ac9bfc6b65078b640dd (patch)
tree74eb2fdcb11cee875aa2f839f567d32c10c92b5f /sys/dev/usb/uhub.c
parent20c739f74e8cfbfe57d19328e02606c2ed711946 (diff)
Sync with NetBSD. Too many changes to mention. For now I have skipped
umass.c and ukbd.c as the diffs are a bit hairier.
Diffstat (limited to 'sys/dev/usb/uhub.c')
-rw-r--r--sys/dev/usb/uhub.c42
1 files changed, 17 insertions, 25 deletions
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c
index 9d45b72d556..b3298635eca 100644
--- a/sys/dev/usb/uhub.c
+++ b/sys/dev/usb/uhub.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: uhub.c,v 1.10 2000/07/04 11:44:23 fgsch Exp $ */
-/* $NetBSD: uhub.c,v 1.41 2000/03/27 12:33:56 augustss Exp $ */
+/* $OpenBSD: uhub.c,v 1.11 2000/11/08 18:10:38 aaron Exp $ */
+/* $NetBSD: uhub.c,v 1.47 2000/09/24 02:08:38 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */
/*
@@ -82,8 +82,8 @@ struct uhub_softc {
u_char sc_running;
};
-Static usbd_status uhub_explore __P((usbd_device_handle hub));
-Static void uhub_intr __P((usbd_xfer_handle, usbd_private_handle,usbd_status));
+Static usbd_status uhub_explore(usbd_device_handle hub);
+Static void uhub_intr(usbd_xfer_handle, usbd_private_handle,usbd_status);
#if defined(__FreeBSD__)
Static bus_child_detached_t uhub_child_detached;
@@ -317,8 +317,7 @@ USB_ATTACH(uhub)
}
usbd_status
-uhub_explore(dev)
- usbd_device_handle dev;
+uhub_explore(usbd_device_handle dev)
{
usb_hub_descriptor_t *hd = &dev->hub->hubdesc;
struct uhub_softc *sc = dev->hub->hubsoftc;
@@ -356,16 +355,17 @@ uhub_explore(dev)
USBDEVNAME(sc->sc_dev), port);
} else {
/* Port error condition. */
- if (up->restartcnt++ < USBD_RESTART_MAX) {
+ if (up->restartcnt) /* no message first time */
printf("%s: port error, restarting "
"port %d\n",
USBDEVNAME(sc->sc_dev), port);
+
+ if (up->restartcnt++ < USBD_RESTART_MAX)
goto disco;
- } else {
+ else
printf("%s: port error, giving up "
"port %d\n",
USBDEVNAME(sc->sc_dev), port);
- }
}
}
if (!(change & UPS_C_CONNECT_STATUS)) {
@@ -412,8 +412,6 @@ uhub_explore(dev)
printf("%s: strange, connected port %d has no power\n",
USBDEVNAME(sc->sc_dev), port);
- up->restartcnt = 0;
-
/* Wait for maximum device power up time. */
usbd_delay_ms(dev, USB_PORT_POWERUP_DELAY);
@@ -443,9 +441,10 @@ uhub_explore(dev)
printf("%s: device problem, disabling port %d\n",
USBDEVNAME(sc->sc_dev), port);
usbd_clear_port_feature(dev, port, UHF_PORT_ENABLE);
- /* Make sure we don't try to restart it infinitely. */
- up->restartcnt = USBD_RESTART_MAX;
} else {
+ /* The port set up succeeded, reset error count. */
+ up->restartcnt = 0;
+
if (up->device->hub)
up->device->hub->explore(up->device);
}
@@ -455,9 +454,7 @@ uhub_explore(dev)
#if defined(__NetBSD__) || defined(__OpenBSD__)
int
-uhub_activate(self, act)
- device_ptr_t self;
- enum devact act;
+uhub_activate(device_ptr_t self, enum devact act)
{
struct uhub_softc *sc = (struct uhub_softc *)self;
struct usbd_hub *hub = sc->sc_hub->hub;
@@ -475,8 +472,8 @@ uhub_activate(self, act)
nports = hub->hubdesc.bNbrPorts;
for(port = 0; port < nports; port++) {
dev = hub->ports[port].device;
- if (dev != NULL) {
- for (i = 0; dev->subdevs[i]; i++)
+ if (dev != NULL && dev->subdevs != NULL) {
+ for (i = 0; dev->subdevs[i] != NULL; i++)
config_deactivate(dev->subdevs[i]);
}
}
@@ -528,9 +525,7 @@ USB_DETACH(uhub)
#if defined(__FreeBSD__)
/* Called when a device has been detached from it */
Static void
-uhub_child_detached(self, child)
- device_t self;
- device_t child;
+uhub_child_detached(device_t self, device_t child)
{
struct uhub_softc *sc = device_get_softc(self);
usbd_device_handle devhub = sc->sc_hub;
@@ -566,10 +561,7 @@ uhub_child_detached(self, child)
* to be explored again.
*/
void
-uhub_intr(xfer, addr, status)
- usbd_xfer_handle xfer;
- usbd_private_handle addr;
- usbd_status status;
+uhub_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status)
{
struct uhub_softc *sc = addr;