#include <linux/usb.h>
#include <linux/usb/quirks.h>
#include <linux/usb/hcd.h>
-#include <linux/pm_runtime.h>
#include "usb.h"
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);
}
}
{
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),
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",
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);
{
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);
}
{
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);
}
* 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)));
* 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;
}
* and all its interfaces.
*/
status = usb_resume_both(udev, PMSG_AUTO_RESUME);
- udev->last_busy = jiffies;
+ usb_mark_last_busy(udev);
return status;
}
#include <linux/completion.h> /* for struct completion */
#include <linux/sched.h> /* for current && schedule_timeout */
#include <linux/mutex.h> /* for struct mutex */
+#include <linux/pm_runtime.h> /* for runtime PM */
struct usb_device;
struct usb_driver;
* @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
unsigned long active_duration;
#ifdef CONFIG_PM
- unsigned long last_busy;
int autosuspend_delay;
unsigned long connect_time;
static inline void usb_mark_last_busy(struct usb_device *udev)
{
- udev->last_busy = jiffies;
+ pm_runtime_mark_last_busy(&udev->dev);
}
#else