This patch sets hub device's default autosuspend delay as 0 to speedup bus suspend, see comments in code for details. Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxxxxx> --- drivers/usb/core/hub.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 382dc41..db17d24 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1625,6 +1625,40 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) desc = intf->cur_altsetting; hdev = interface_to_usbdev(intf); + /* + * Set default autosuspend delay as 0 to speedup bus suspend. + * Based on the below considerations: + * + * - The remote wakeup from child device and new connected + * device doesn't mean that there might be another new device + * which is going to be connected or disconnected to the hub, + * or there might be another wakeup from other devices, in + * the following seconds. + * + * - The wakeup event can be handled completely in hub_resume() + * and khubd, and the submitted status URB is just to check + * future changes on hub downstream ports. + * + * - the introduced hub resume delay during the autosuspend + * delay period doesn't matter for new device to be connected + * into the hub. + * + * - the child device should depend its own autosuspend delay + * to fit its use case and shoudn't depend on the delay of + * parent hub device. + * + * - suppose there is one device which will remote wakeup + * every 2 seconds periodically and does't care the resume + * delay, the bus can't be suspended with previous default + * autosuspend delay at all, not mention in case of several + * hubs connected in the path from the device to root hub. + * + * - it is safe to do so because the hub can't be auto-suspended + * until the remote wakeup is handled by khubd in the device + * remote wakeup path. + */ + pm_runtime_set_autosuspend_delay(&hdev->dev, 0); + /* Hubs have proper suspend/resume support. */ usb_enable_autosuspend(hdev); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html