diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2005-08-10 17:04:13 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-09-08 19:28:19 -0400 |
commit | 8b28c7526a302bbfa618f7eab4ef961edd68c9a0 (patch) | |
tree | 4a0e692239ccd523b9103af867419db3c1a4a997 /drivers | |
parent | 68a6457edb8a64fdcc231a4fc5406f6e3f6c9b33 (diff) |
[PATCH] USB: Code motion in the hub driver
This patch (as553) merely moves some code and deletes an unneeded test in
the hub driver. This is in preparation for the patch that follows.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/core/hub.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index a220a5e7f4a5..4a4b41f2665a 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -492,6 +492,23 @@ static int hub_hub_status(struct usb_hub *hub, | |||
492 | return ret; | 492 | return ret; |
493 | } | 493 | } |
494 | 494 | ||
495 | static int hub_port_disable(struct usb_hub *hub, int port1, int set_state) | ||
496 | { | ||
497 | struct usb_device *hdev = hub->hdev; | ||
498 | int ret; | ||
499 | |||
500 | if (hdev->children[port1-1] && set_state) { | ||
501 | usb_set_device_state(hdev->children[port1-1], | ||
502 | USB_STATE_NOTATTACHED); | ||
503 | } | ||
504 | ret = clear_port_feature(hdev, port1, USB_PORT_FEAT_ENABLE); | ||
505 | if (ret) | ||
506 | dev_err(hub->intfdev, "cannot disable port %d (err = %d)\n", | ||
507 | port1, ret); | ||
508 | |||
509 | return ret; | ||
510 | } | ||
511 | |||
495 | static int hub_configure(struct usb_hub *hub, | 512 | static int hub_configure(struct usb_hub *hub, |
496 | struct usb_endpoint_descriptor *endpoint) | 513 | struct usb_endpoint_descriptor *endpoint) |
497 | { | 514 | { |
@@ -717,15 +734,12 @@ static void hub_disconnect(struct usb_interface *intf) | |||
717 | struct usb_hub *hub = usb_get_intfdata (intf); | 734 | struct usb_hub *hub = usb_get_intfdata (intf); |
718 | struct usb_device *hdev; | 735 | struct usb_device *hdev; |
719 | 736 | ||
720 | if (!hub) | 737 | usb_set_intfdata (intf, NULL); |
721 | return; | ||
722 | hdev = hub->hdev; | 738 | hdev = hub->hdev; |
723 | 739 | ||
724 | if (hdev->speed == USB_SPEED_HIGH) | 740 | if (hdev->speed == USB_SPEED_HIGH) |
725 | highspeed_hubs--; | 741 | highspeed_hubs--; |
726 | 742 | ||
727 | usb_set_intfdata (intf, NULL); | ||
728 | |||
729 | hub_quiesce(hub); | 743 | hub_quiesce(hub); |
730 | usb_free_urb(hub->urb); | 744 | usb_free_urb(hub->urb); |
731 | hub->urb = NULL; | 745 | hub->urb = NULL; |
@@ -1430,23 +1444,6 @@ static int hub_port_reset(struct usb_hub *hub, int port1, | |||
1430 | return status; | 1444 | return status; |
1431 | } | 1445 | } |
1432 | 1446 | ||
1433 | static int hub_port_disable(struct usb_hub *hub, int port1, int set_state) | ||
1434 | { | ||
1435 | struct usb_device *hdev = hub->hdev; | ||
1436 | int ret; | ||
1437 | |||
1438 | if (hdev->children[port1-1] && set_state) { | ||
1439 | usb_set_device_state(hdev->children[port1-1], | ||
1440 | USB_STATE_NOTATTACHED); | ||
1441 | } | ||
1442 | ret = clear_port_feature(hdev, port1, USB_PORT_FEAT_ENABLE); | ||
1443 | if (ret) | ||
1444 | dev_err(hub->intfdev, "cannot disable port %d (err = %d)\n", | ||
1445 | port1, ret); | ||
1446 | |||
1447 | return ret; | ||
1448 | } | ||
1449 | |||
1450 | /* | 1447 | /* |
1451 | * Disable a port and mark a logical connnect-change event, so that some | 1448 | * Disable a port and mark a logical connnect-change event, so that some |
1452 | * time later khubd will disconnect() any existing usb_device on the port | 1449 | * time later khubd will disconnect() any existing usb_device on the port |