diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2008-04-28 11:07:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-07-21 18:15:52 -0400 |
commit | f2835219ed5e29ec959a0e635af4339d6174b2a7 (patch) | |
tree | 0963c4ec65eb9b01e03a7193a6ccc30d7a5c4043 /drivers | |
parent | 948fea37dcebfef8f0f2faf00930e7ec7e756e07 (diff) |
USB: combine hub_activate and hub_restart
This patch (as1071) combines hub_activate() and hub_restart() into a
single routine. There's no point keeping them separate, since they
are always called together.
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 | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index bc80168957b8..4c629a036aed 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -551,22 +551,6 @@ static void hub_quiesce(struct usb_hub *hub) | |||
551 | cancel_work_sync(&hub->tt.kevent); | 551 | cancel_work_sync(&hub->tt.kevent); |
552 | } | 552 | } |
553 | 553 | ||
554 | static void hub_activate(struct usb_hub *hub) | ||
555 | { | ||
556 | int status; | ||
557 | |||
558 | hub->quiescing = 0; | ||
559 | |||
560 | status = usb_submit_urb(hub->urb, GFP_NOIO); | ||
561 | if (status < 0) | ||
562 | dev_err(hub->intfdev, "activate --> %d\n", status); | ||
563 | if (hub->has_indicators && blinkenlights) | ||
564 | schedule_delayed_work(&hub->leds, LED_CYCLE_PERIOD); | ||
565 | |||
566 | /* scan all ports ASAP */ | ||
567 | kick_khubd(hub); | ||
568 | } | ||
569 | |||
570 | static int hub_hub_status(struct usb_hub *hub, | 554 | static int hub_hub_status(struct usb_hub *hub, |
571 | u16 *status, u16 *change) | 555 | u16 *status, u16 *change) |
572 | { | 556 | { |
@@ -643,18 +627,24 @@ enum hub_activation_type { | |||
643 | HUB_INIT, HUB_POST_RESET, HUB_RESUME, HUB_RESET_RESUME | 627 | HUB_INIT, HUB_POST_RESET, HUB_RESUME, HUB_RESET_RESUME |
644 | }; | 628 | }; |
645 | 629 | ||
646 | static void hub_restart(struct usb_hub *hub, enum hub_activation_type type) | 630 | static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) |
647 | { | 631 | { |
648 | struct usb_device *hdev = hub->hdev; | 632 | struct usb_device *hdev = hub->hdev; |
649 | int port1; | 633 | int port1; |
634 | int status; | ||
650 | bool need_debounce_delay = false; | 635 | bool need_debounce_delay = false; |
651 | 636 | ||
637 | /* After a resume, port power should still be on. | ||
638 | * For any other type of activation, turn it on. | ||
639 | */ | ||
640 | if (type != HUB_RESUME) | ||
641 | hub_power_on(hub); | ||
642 | |||
652 | /* Check each port and set hub->change_bits to let khubd know | 643 | /* Check each port and set hub->change_bits to let khubd know |
653 | * which ports need attention. | 644 | * which ports need attention. |
654 | */ | 645 | */ |
655 | for (port1 = 1; port1 <= hdev->maxchild; ++port1) { | 646 | for (port1 = 1; port1 <= hdev->maxchild; ++port1) { |
656 | struct usb_device *udev = hdev->children[port1-1]; | 647 | struct usb_device *udev = hdev->children[port1-1]; |
657 | int status; | ||
658 | u16 portstatus, portchange; | 648 | u16 portstatus, portchange; |
659 | 649 | ||
660 | portstatus = portchange = 0; | 650 | portstatus = portchange = 0; |
@@ -729,7 +719,17 @@ static void hub_restart(struct usb_hub *hub, enum hub_activation_type type) | |||
729 | */ | 719 | */ |
730 | if (need_debounce_delay) | 720 | if (need_debounce_delay) |
731 | msleep(HUB_DEBOUNCE_STABLE); | 721 | msleep(HUB_DEBOUNCE_STABLE); |
732 | hub_activate(hub); | 722 | |
723 | hub->quiescing = 0; | ||
724 | |||
725 | status = usb_submit_urb(hub->urb, GFP_NOIO); | ||
726 | if (status < 0) | ||
727 | dev_err(hub->intfdev, "activate --> %d\n", status); | ||
728 | if (hub->has_indicators && blinkenlights) | ||
729 | schedule_delayed_work(&hub->leds, LED_CYCLE_PERIOD); | ||
730 | |||
731 | /* Scan all ports that need attention */ | ||
732 | kick_khubd(hub); | ||
733 | } | 733 | } |
734 | 734 | ||
735 | /* caller has locked the hub device */ | 735 | /* caller has locked the hub device */ |
@@ -746,8 +746,7 @@ static int hub_post_reset(struct usb_interface *intf) | |||
746 | { | 746 | { |
747 | struct usb_hub *hub = usb_get_intfdata(intf); | 747 | struct usb_hub *hub = usb_get_intfdata(intf); |
748 | 748 | ||
749 | hub_power_on(hub); | 749 | hub_activate(hub, HUB_POST_RESET); |
750 | hub_restart(hub, HUB_POST_RESET); | ||
751 | return 0; | 750 | return 0; |
752 | } | 751 | } |
753 | 752 | ||
@@ -993,8 +992,7 @@ static int hub_configure(struct usb_hub *hub, | |||
993 | if (hub->has_indicators && blinkenlights) | 992 | if (hub->has_indicators && blinkenlights) |
994 | hub->indicator [0] = INDICATOR_CYCLE; | 993 | hub->indicator [0] = INDICATOR_CYCLE; |
995 | 994 | ||
996 | hub_power_on(hub); | 995 | hub_activate(hub, HUB_INIT); |
997 | hub_activate(hub); | ||
998 | return 0; | 996 | return 0; |
999 | 997 | ||
1000 | fail: | 998 | fail: |
@@ -2178,7 +2176,7 @@ static int hub_resume(struct usb_interface *intf) | |||
2178 | struct usb_hub *hub = usb_get_intfdata(intf); | 2176 | struct usb_hub *hub = usb_get_intfdata(intf); |
2179 | 2177 | ||
2180 | dev_dbg(&intf->dev, "%s\n", __func__); | 2178 | dev_dbg(&intf->dev, "%s\n", __func__); |
2181 | hub_restart(hub, HUB_RESUME); | 2179 | hub_activate(hub, HUB_RESUME); |
2182 | return 0; | 2180 | return 0; |
2183 | } | 2181 | } |
2184 | 2182 | ||
@@ -2187,8 +2185,7 @@ static int hub_reset_resume(struct usb_interface *intf) | |||
2187 | struct usb_hub *hub = usb_get_intfdata(intf); | 2185 | struct usb_hub *hub = usb_get_intfdata(intf); |
2188 | 2186 | ||
2189 | dev_dbg(&intf->dev, "%s\n", __func__); | 2187 | dev_dbg(&intf->dev, "%s\n", __func__); |
2190 | hub_power_on(hub); | 2188 | hub_activate(hub, HUB_RESET_RESUME); |
2191 | hub_restart(hub, HUB_RESET_RESUME); | ||
2192 | return 0; | 2189 | return 0; |
2193 | } | 2190 | } |
2194 | 2191 | ||