diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2013-03-27 16:14:46 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-28 14:10:22 -0400 |
commit | 84ebc10294a3d7be4c66f51070b7aedbaa24de9b (patch) | |
tree | 36fc8e5387474ee3b47f6ed4224cb491e1ea7155 /drivers/usb/core/hub.c | |
parent | 0aa2832dd0d9d8609fd8f15139bc7572541a1215 (diff) |
USB: remove CONFIG_USB_SUSPEND option
This patch (as1675) removes the CONFIG_USB_SUSPEND option, essentially
replacing it everywhere with CONFIG_PM_RUNTIME (except for one place
in hub.c, where it is replaced with CONFIG_PM because the code needs
to be used in both runtime and system PM). The net result is code
shrinkage and simplification.
There's very little point in keeping CONFIG_USB_SUSPEND because almost
everybody enables it. The few that don't will find that the usbcore
module has gotten somewhat bigger and they will have to take active
measures if they want to prevent hubs from being runtime suspended.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/hub.c')
-rw-r--r-- | drivers/usb/core/hub.c | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 443d5cc9330b..feef9351463d 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -2827,7 +2827,7 @@ void usb_enable_ltm(struct usb_device *udev) | |||
2827 | } | 2827 | } |
2828 | EXPORT_SYMBOL_GPL(usb_enable_ltm); | 2828 | EXPORT_SYMBOL_GPL(usb_enable_ltm); |
2829 | 2829 | ||
2830 | #ifdef CONFIG_USB_SUSPEND | 2830 | #ifdef CONFIG_PM |
2831 | /* | 2831 | /* |
2832 | * usb_disable_function_remotewakeup - disable usb3.0 | 2832 | * usb_disable_function_remotewakeup - disable usb3.0 |
2833 | * device's function remote wakeup | 2833 | * device's function remote wakeup |
@@ -2886,7 +2886,7 @@ static int usb_disable_function_remotewakeup(struct usb_device *udev) | |||
2886 | * Linux (2.6) currently has NO mechanisms to initiate that: no khubd | 2886 | * Linux (2.6) currently has NO mechanisms to initiate that: no khubd |
2887 | * timer, no SRP, no requests through sysfs. | 2887 | * timer, no SRP, no requests through sysfs. |
2888 | * | 2888 | * |
2889 | * If CONFIG_USB_SUSPEND isn't enabled, non-SuperSpeed devices really get | 2889 | * If Runtime PM isn't enabled or used, non-SuperSpeed devices really get |
2890 | * suspended only when their bus goes into global suspend (i.e., the root | 2890 | * suspended only when their bus goes into global suspend (i.e., the root |
2891 | * hub is suspended). Nevertheless, we change @udev->state to | 2891 | * hub is suspended). Nevertheless, we change @udev->state to |
2892 | * USB_STATE_SUSPENDED as this is the device's "logical" state. The actual | 2892 | * USB_STATE_SUSPENDED as this is the device's "logical" state. The actual |
@@ -3247,6 +3247,10 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg) | |||
3247 | return status; | 3247 | return status; |
3248 | } | 3248 | } |
3249 | 3249 | ||
3250 | #endif /* CONFIG_PM */ | ||
3251 | |||
3252 | #ifdef CONFIG_PM_RUNTIME | ||
3253 | |||
3250 | /* caller has locked udev */ | 3254 | /* caller has locked udev */ |
3251 | int usb_remote_wakeup(struct usb_device *udev) | 3255 | int usb_remote_wakeup(struct usb_device *udev) |
3252 | { | 3256 | { |
@@ -3263,38 +3267,6 @@ int usb_remote_wakeup(struct usb_device *udev) | |||
3263 | return status; | 3267 | return status; |
3264 | } | 3268 | } |
3265 | 3269 | ||
3266 | #else /* CONFIG_USB_SUSPEND */ | ||
3267 | |||
3268 | /* When CONFIG_USB_SUSPEND isn't set, we never suspend or resume any ports. */ | ||
3269 | |||
3270 | int usb_port_suspend(struct usb_device *udev, pm_message_t msg) | ||
3271 | { | ||
3272 | return 0; | ||
3273 | } | ||
3274 | |||
3275 | /* However we may need to do a reset-resume */ | ||
3276 | |||
3277 | int usb_port_resume(struct usb_device *udev, pm_message_t msg) | ||
3278 | { | ||
3279 | struct usb_hub *hub = usb_hub_to_struct_hub(udev->parent); | ||
3280 | int port1 = udev->portnum; | ||
3281 | int status; | ||
3282 | u16 portchange, portstatus; | ||
3283 | |||
3284 | status = hub_port_status(hub, port1, &portstatus, &portchange); | ||
3285 | status = check_port_resume_type(udev, | ||
3286 | hub, port1, status, portchange, portstatus); | ||
3287 | |||
3288 | if (status) { | ||
3289 | dev_dbg(&udev->dev, "can't resume, status %d\n", status); | ||
3290 | hub_port_logical_disconnect(hub, port1); | ||
3291 | } else if (udev->reset_resume) { | ||
3292 | dev_dbg(&udev->dev, "reset-resume\n"); | ||
3293 | status = usb_reset_and_verify_device(udev); | ||
3294 | } | ||
3295 | return status; | ||
3296 | } | ||
3297 | |||
3298 | #endif | 3270 | #endif |
3299 | 3271 | ||
3300 | static int check_ports_changed(struct usb_hub *hub) | 3272 | static int check_ports_changed(struct usb_hub *hub) |
@@ -4356,7 +4328,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, | |||
4356 | if (portstatus & USB_PORT_STAT_ENABLE) { | 4328 | if (portstatus & USB_PORT_STAT_ENABLE) { |
4357 | status = 0; /* Nothing to do */ | 4329 | status = 0; /* Nothing to do */ |
4358 | 4330 | ||
4359 | #ifdef CONFIG_USB_SUSPEND | 4331 | #ifdef CONFIG_PM_RUNTIME |
4360 | } else if (udev->state == USB_STATE_SUSPENDED && | 4332 | } else if (udev->state == USB_STATE_SUSPENDED && |
4361 | udev->persist_enabled) { | 4333 | udev->persist_enabled) { |
4362 | /* For a suspended device, treat this as a | 4334 | /* For a suspended device, treat this as a |