Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28368
b: refs/heads/master
c: 7de18d8
h: refs/heads/master
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Jun 21, 2006
1 parent 92cb295 commit ebc56f4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 79efa097e75018a2918155f343f0e08e61ee8a8c
refs/heads/master: 7de18d8bf4b470752e799e219b38b6dff4b49993
34 changes: 15 additions & 19 deletions trunk/drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,24 +525,27 @@ static int hub_port_disable(struct usb_hub *hub, int port1, int set_state)


/* caller has locked the hub device */
static void hub_pre_reset(struct usb_hub *hub, int disable_ports)
static void hub_pre_reset(struct usb_interface *intf)
{
struct usb_hub *hub = usb_get_intfdata(intf);
struct usb_device *hdev = hub->hdev;
int port1;

for (port1 = 1; port1 <= hdev->maxchild; ++port1) {
if (hdev->children[port1 - 1]) {
usb_disconnect(&hdev->children[port1 - 1]);
if (disable_ports)
if (hub->error == 0)
hub_port_disable(hub, port1, 0);
}
}
hub_quiesce(hub);
}

/* caller has locked the hub device */
static void hub_post_reset(struct usb_hub *hub)
static void hub_post_reset(struct usb_interface *intf)
{
struct usb_hub *hub = usb_get_intfdata(intf);

hub_activate(hub);
hub_power_on(hub);
}
Expand Down Expand Up @@ -802,15 +805,16 @@ static void hub_disconnect(struct usb_interface *intf)
struct usb_hub *hub = usb_get_intfdata (intf);
struct usb_device *hdev;

/* Disconnect all children and quiesce the hub */
hub->error = 0;
hub_pre_reset(intf);

usb_set_intfdata (intf, NULL);
hdev = hub->hdev;

if (hdev->speed == USB_SPEED_HIGH)
highspeed_hubs--;

/* Disconnect all children and quiesce the hub */
hub_pre_reset(hub, 1);

usb_free_urb(hub->urb);
hub->urb = NULL;

Expand Down Expand Up @@ -2747,7 +2751,8 @@ static void hub_events(void)

/* If the hub has died, clean up after it */
if (hdev->state == USB_STATE_NOTATTACHED) {
hub_pre_reset(hub, 0);
hub->error = -ENODEV;
hub_pre_reset(intf);
goto loop;
}

Expand All @@ -2759,7 +2764,7 @@ static void hub_events(void)
dev_dbg (hub_dev, "resetting for error %d\n",
hub->error);

ret = usb_reset_device(hdev);
ret = usb_reset_composite_device(hdev, intf);
if (ret) {
dev_dbg (hub_dev,
"error resetting hub: %d\n", ret);
Expand Down Expand Up @@ -2928,6 +2933,8 @@ static struct usb_driver hub_driver = {
.disconnect = hub_disconnect,
.suspend = hub_suspend,
.resume = hub_resume,
.pre_reset = hub_pre_reset,
.post_reset = hub_post_reset,
.ioctl = hub_ioctl,
.id_table = hub_id_table,
};
Expand Down Expand Up @@ -3033,7 +3040,6 @@ int usb_reset_device(struct usb_device *udev)
struct usb_device *parent_hdev = udev->parent;
struct usb_hub *parent_hub;
struct usb_device_descriptor descriptor = udev->descriptor;
struct usb_hub *hub = NULL;
int i, ret = 0;
int port1 = udev->portnum;

Expand All @@ -3051,14 +3057,6 @@ int usb_reset_device(struct usb_device *udev)
}
parent_hub = hdev_to_hub(parent_hdev);

/* If we're resetting an active hub, take some special actions */
if (udev->actconfig && udev->actconfig->desc.bNumInterfaces > 0 &&
udev->actconfig->interface[0]->dev.driver ==
&hub_driver.driver &&
(hub = hdev_to_hub(udev)) != NULL) {
hub_pre_reset(hub, 0);
}

set_bit(port1, parent_hub->busy_bits);
for (i = 0; i < SET_CONFIG_TRIES; ++i) {

Expand Down Expand Up @@ -3117,8 +3115,6 @@ int usb_reset_device(struct usb_device *udev)
}

done:
if (hub)
hub_post_reset(hub);
return 0;

re_enumerate:
Expand Down

0 comments on commit ebc56f4

Please sign in to comment.