diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index eda2d2c25459b2c83092bb4826faa629be92df65..0a63e968c6831979a0c80c4dafb12228ab424d09 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -27,7 +27,6 @@ #include #include #include -#include #include "usb.h" @@ -1329,7 +1328,7 @@ int usb_resume(struct device *dev, pm_message_t msg) pm_runtime_disable(dev); pm_runtime_set_active(dev); pm_runtime_enable(dev); - udev->last_busy = jiffies; + usb_mark_last_busy(udev); do_unbind_rebind(udev, DO_REBIND); } } @@ -1397,7 +1396,7 @@ void usb_autosuspend_device(struct usb_device *udev) { int status; - udev->last_busy = jiffies; + usb_mark_last_busy(udev); status = pm_runtime_put_sync(&udev->dev); dev_vdbg(&udev->dev, "%s: cnt %d -> %d\n", __func__, atomic_read(&udev->dev.power.usage_count), @@ -1482,7 +1481,7 @@ void usb_autopm_put_interface(struct usb_interface *intf) struct usb_device *udev = interface_to_usbdev(intf); int status; - udev->last_busy = jiffies; + usb_mark_last_busy(udev); atomic_dec(&intf->pm_usage_cnt); status = pm_runtime_put_sync(&intf->dev); dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n", @@ -1512,8 +1511,8 @@ void usb_autopm_put_interface_async(struct usb_interface *intf) unsigned long last_busy; int status = 0; - last_busy = udev->last_busy; - udev->last_busy = jiffies; + last_busy = udev->dev.power.last_busy; + usb_mark_last_busy(udev); atomic_dec(&intf->pm_usage_cnt); pm_runtime_put_noidle(&intf->dev); @@ -1554,7 +1553,7 @@ void usb_autopm_put_interface_no_suspend(struct usb_interface *intf) { struct usb_device *udev = interface_to_usbdev(intf); - udev->last_busy = jiffies; + usb_mark_last_busy(udev); atomic_dec(&intf->pm_usage_cnt); pm_runtime_put_noidle(&intf->dev); } @@ -1641,7 +1640,7 @@ void usb_autopm_get_interface_no_resume(struct usb_interface *intf) { struct usb_device *udev = interface_to_usbdev(intf); - udev->last_busy = jiffies; + usb_mark_last_busy(udev); atomic_inc(&intf->pm_usage_cnt); pm_runtime_get_noresume(&intf->dev); } @@ -1697,7 +1696,7 @@ static int autosuspend_check(struct usb_device *udev) * enough, queue a delayed autosuspend request. */ j = ACCESS_ONCE(jiffies); - suspend_time = udev->last_busy + udev->autosuspend_delay; + suspend_time = udev->dev.power.last_busy + udev->autosuspend_delay; if (time_before(j, suspend_time)) { pm_schedule_suspend(&udev->dev, jiffies_to_msecs( round_jiffies_up_relative(suspend_time - j))); @@ -1725,13 +1724,13 @@ static int usb_runtime_suspend(struct device *dev) * away. */ if (status) { - udev->last_busy = jiffies + + udev->dev.power.last_busy = jiffies + (udev->autosuspend_delay == 0 ? HZ/2 : 0); } /* Prevent the parent from suspending immediately after */ else if (udev->parent) - udev->parent->last_busy = jiffies; + usb_mark_last_busy(udev->parent); return status; } @@ -1745,7 +1744,7 @@ static int usb_runtime_resume(struct device *dev) * and all its interfaces. */ status = usb_resume_both(udev, PMSG_AUTO_RESUME); - udev->last_busy = jiffies; + usb_mark_last_busy(udev); return status; } diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 3799573bd385db30aab6db375bab0d506595e9c0..b55d46070a2519cc6d0b38f5c7b49daf241f5337 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 61800f77dac80f0064cd7184f858241a35e2fc8c..e70aeaf3dc1a1b1e034d486c722cc08f7d3c130e 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #include diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 27115b45edc51fa4462147077be9b3de36f6142a..7c2405eccc4b4e5ee3b62e1919864a1c5a35015b 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index f377e49fcb306a795194c831910be86e7d52ace9..8324874238269004e90cd174eadd4225d07aeda6 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include /* for usbcore internals */ diff --git a/include/linux/usb.h b/include/linux/usb.h index 35fe6ab222bbb8c1247ab73fa7ccad96289b13f6..7d22b3340a7ff6cf494c3b9c076bf238e20144b1 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -20,6 +20,7 @@ #include /* for struct completion */ #include /* for current && schedule_timeout */ #include /* for struct mutex */ +#include /* for runtime PM */ struct usb_device; struct usb_driver; @@ -407,7 +408,6 @@ struct usb_tt; * @quirks: quirks of the whole device * @urbnum: number of URBs submitted for the whole device * @active_duration: total time device is not suspended - * @last_busy: time of last use * @autosuspend_delay: in jiffies * @connect_time: time device was first connected * @do_remote_wakeup: remote wakeup should be enabled @@ -481,7 +481,6 @@ struct usb_device { unsigned long active_duration; #ifdef CONFIG_PM - unsigned long last_busy; int autosuspend_delay; unsigned long connect_time; @@ -527,7 +526,7 @@ extern void usb_autopm_put_interface_no_suspend(struct usb_interface *intf); static inline void usb_mark_last_busy(struct usb_device *udev) { - udev->last_busy = jiffies; + pm_runtime_mark_last_busy(&udev->dev); } #else