Loading drivers/base/base.h +3 −0 Original line number Diff line number Diff line Loading @@ -161,3 +161,6 @@ extern void device_links_driver_cleanup(struct device *dev); extern void device_links_no_driver(struct device *dev); extern bool device_links_busy(struct device *dev); extern void device_links_unbind_consumers(struct device *dev); /* device pm support */ void device_pm_move_to_tail(struct device *dev); drivers/base/core.c +20 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,26 @@ static int device_reorder_to_tail(struct device *dev, void *not_used) return 0; } /** * device_pm_move_to_tail - Move set of devices to the end of device lists * @dev: Device to move * * This is a device_reorder_to_tail() wrapper taking the requisite locks. * * It moves the @dev along with all of its children and all of its consumers * to the ends of the device_kset and dpm_list, recursively. */ void device_pm_move_to_tail(struct device *dev) { int idx; idx = device_links_read_lock(); device_pm_lock(); device_reorder_to_tail(dev, NULL); device_pm_unlock(); device_links_read_unlock(idx); } /** * device_link_add - Create a link between two devices. * @consumer: Consumer end of the link. Loading drivers/base/dd.c +1 −3 Original line number Diff line number Diff line Loading @@ -122,9 +122,7 @@ static void deferred_probe_work_func(struct work_struct *work) * the list is a good order for suspend but deferred * probe makes that very unsafe. */ device_pm_lock(); device_pm_move_last(dev); device_pm_unlock(); device_pm_move_to_tail(dev); dev_dbg(dev, "Retrying from deferred list\n"); if (initcall_debug && !initcalls_done) Loading drivers/base/power/main.c +17 −20 Original line number Diff line number Diff line Loading @@ -192,34 +192,31 @@ void device_pm_move_last(struct device *dev) list_move_tail(&dev->power.entry, &dpm_list); } static ktime_t initcall_debug_start(struct device *dev) static ktime_t initcall_debug_start(struct device *dev, void *cb) { ktime_t calltime = 0; if (!pm_print_times_enabled) return 0; if (pm_print_times_enabled) { pr_info("calling %s+ @ %i, parent: %s\n", dev_name(dev), task_pid_nr(current), dev_info(dev, "calling %pF @ %i, parent: %s\n", cb, task_pid_nr(current), dev->parent ? dev_name(dev->parent) : "none"); calltime = ktime_get(); } return calltime; return ktime_get(); } static void initcall_debug_report(struct device *dev, ktime_t calltime, int error, pm_message_t state, const char *info) void *cb, int error) { ktime_t rettime; s64 nsecs; if (!pm_print_times_enabled) return; rettime = ktime_get(); nsecs = (s64) ktime_to_ns(ktime_sub(rettime, calltime)); if (pm_print_times_enabled) { pr_info("call %s+ returned %d after %Ld usecs\n", dev_name(dev), error, (unsigned long long)nsecs >> 10); } dev_info(dev, "%pF returned %d after %Ld usecs\n", cb, error, (unsigned long long)nsecs >> 10); } /** Loading Loading @@ -446,7 +443,7 @@ static int dpm_run_callback(pm_callback_t cb, struct device *dev, if (!cb) return 0; calltime = initcall_debug_start(dev); calltime = initcall_debug_start(dev, cb); pm_dev_dbg(dev, state, info); trace_device_pm_callback_start(dev, info, state.event); Loading @@ -454,7 +451,7 @@ static int dpm_run_callback(pm_callback_t cb, struct device *dev, trace_device_pm_callback_end(dev, error); suspend_report_result(cb, error); initcall_debug_report(dev, calltime, error, state, info); initcall_debug_report(dev, calltime, cb, error); return error; } Loading Loading @@ -1664,14 +1661,14 @@ static int legacy_suspend(struct device *dev, pm_message_t state, int error; ktime_t calltime; calltime = initcall_debug_start(dev); calltime = initcall_debug_start(dev, cb); trace_device_pm_callback_start(dev, info, state.event); error = cb(dev, state); trace_device_pm_callback_end(dev, error); suspend_report_result(cb, error); initcall_debug_report(dev, calltime, error, state, info); initcall_debug_report(dev, calltime, cb, error); return error; } Loading drivers/base/power/power.h +0 −30 Original line number Diff line number Diff line Loading @@ -56,14 +56,6 @@ static inline void device_wakeup_detach_irq(struct device *dev) { } static inline void device_wakeup_arm_wake_irqs(void) { } static inline void device_wakeup_disarm_wake_irqs(void) { } #endif /* CONFIG_PM_SLEEP */ /* Loading Loading @@ -95,28 +87,6 @@ static inline void pm_runtime_remove(struct device *dev) {} static inline int dpm_sysfs_add(struct device *dev) { return 0; } static inline void dpm_sysfs_remove(struct device *dev) {} static inline void rpm_sysfs_remove(struct device *dev) {} static inline int wakeup_sysfs_add(struct device *dev) { return 0; } static inline void wakeup_sysfs_remove(struct device *dev) {} static inline int pm_qos_sysfs_add(struct device *dev) { return 0; } static inline void pm_qos_sysfs_remove(struct device *dev) {} static inline void dev_pm_arm_wake_irq(struct wake_irq *wirq) { } static inline void dev_pm_disarm_wake_irq(struct wake_irq *wirq) { } static inline void dev_pm_enable_wake_irq_check(struct device *dev, bool can_change_status) { } static inline void dev_pm_disable_wake_irq_check(struct device *dev) { } #endif Loading Loading
drivers/base/base.h +3 −0 Original line number Diff line number Diff line Loading @@ -161,3 +161,6 @@ extern void device_links_driver_cleanup(struct device *dev); extern void device_links_no_driver(struct device *dev); extern bool device_links_busy(struct device *dev); extern void device_links_unbind_consumers(struct device *dev); /* device pm support */ void device_pm_move_to_tail(struct device *dev);
drivers/base/core.c +20 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,26 @@ static int device_reorder_to_tail(struct device *dev, void *not_used) return 0; } /** * device_pm_move_to_tail - Move set of devices to the end of device lists * @dev: Device to move * * This is a device_reorder_to_tail() wrapper taking the requisite locks. * * It moves the @dev along with all of its children and all of its consumers * to the ends of the device_kset and dpm_list, recursively. */ void device_pm_move_to_tail(struct device *dev) { int idx; idx = device_links_read_lock(); device_pm_lock(); device_reorder_to_tail(dev, NULL); device_pm_unlock(); device_links_read_unlock(idx); } /** * device_link_add - Create a link between two devices. * @consumer: Consumer end of the link. Loading
drivers/base/dd.c +1 −3 Original line number Diff line number Diff line Loading @@ -122,9 +122,7 @@ static void deferred_probe_work_func(struct work_struct *work) * the list is a good order for suspend but deferred * probe makes that very unsafe. */ device_pm_lock(); device_pm_move_last(dev); device_pm_unlock(); device_pm_move_to_tail(dev); dev_dbg(dev, "Retrying from deferred list\n"); if (initcall_debug && !initcalls_done) Loading
drivers/base/power/main.c +17 −20 Original line number Diff line number Diff line Loading @@ -192,34 +192,31 @@ void device_pm_move_last(struct device *dev) list_move_tail(&dev->power.entry, &dpm_list); } static ktime_t initcall_debug_start(struct device *dev) static ktime_t initcall_debug_start(struct device *dev, void *cb) { ktime_t calltime = 0; if (!pm_print_times_enabled) return 0; if (pm_print_times_enabled) { pr_info("calling %s+ @ %i, parent: %s\n", dev_name(dev), task_pid_nr(current), dev_info(dev, "calling %pF @ %i, parent: %s\n", cb, task_pid_nr(current), dev->parent ? dev_name(dev->parent) : "none"); calltime = ktime_get(); } return calltime; return ktime_get(); } static void initcall_debug_report(struct device *dev, ktime_t calltime, int error, pm_message_t state, const char *info) void *cb, int error) { ktime_t rettime; s64 nsecs; if (!pm_print_times_enabled) return; rettime = ktime_get(); nsecs = (s64) ktime_to_ns(ktime_sub(rettime, calltime)); if (pm_print_times_enabled) { pr_info("call %s+ returned %d after %Ld usecs\n", dev_name(dev), error, (unsigned long long)nsecs >> 10); } dev_info(dev, "%pF returned %d after %Ld usecs\n", cb, error, (unsigned long long)nsecs >> 10); } /** Loading Loading @@ -446,7 +443,7 @@ static int dpm_run_callback(pm_callback_t cb, struct device *dev, if (!cb) return 0; calltime = initcall_debug_start(dev); calltime = initcall_debug_start(dev, cb); pm_dev_dbg(dev, state, info); trace_device_pm_callback_start(dev, info, state.event); Loading @@ -454,7 +451,7 @@ static int dpm_run_callback(pm_callback_t cb, struct device *dev, trace_device_pm_callback_end(dev, error); suspend_report_result(cb, error); initcall_debug_report(dev, calltime, error, state, info); initcall_debug_report(dev, calltime, cb, error); return error; } Loading Loading @@ -1664,14 +1661,14 @@ static int legacy_suspend(struct device *dev, pm_message_t state, int error; ktime_t calltime; calltime = initcall_debug_start(dev); calltime = initcall_debug_start(dev, cb); trace_device_pm_callback_start(dev, info, state.event); error = cb(dev, state); trace_device_pm_callback_end(dev, error); suspend_report_result(cb, error); initcall_debug_report(dev, calltime, error, state, info); initcall_debug_report(dev, calltime, cb, error); return error; } Loading
drivers/base/power/power.h +0 −30 Original line number Diff line number Diff line Loading @@ -56,14 +56,6 @@ static inline void device_wakeup_detach_irq(struct device *dev) { } static inline void device_wakeup_arm_wake_irqs(void) { } static inline void device_wakeup_disarm_wake_irqs(void) { } #endif /* CONFIG_PM_SLEEP */ /* Loading Loading @@ -95,28 +87,6 @@ static inline void pm_runtime_remove(struct device *dev) {} static inline int dpm_sysfs_add(struct device *dev) { return 0; } static inline void dpm_sysfs_remove(struct device *dev) {} static inline void rpm_sysfs_remove(struct device *dev) {} static inline int wakeup_sysfs_add(struct device *dev) { return 0; } static inline void wakeup_sysfs_remove(struct device *dev) {} static inline int pm_qos_sysfs_add(struct device *dev) { return 0; } static inline void pm_qos_sysfs_remove(struct device *dev) {} static inline void dev_pm_arm_wake_irq(struct wake_irq *wirq) { } static inline void dev_pm_disarm_wake_irq(struct wake_irq *wirq) { } static inline void dev_pm_enable_wake_irq_check(struct device *dev, bool can_change_status) { } static inline void dev_pm_disable_wake_irq_check(struct device *dev) { } #endif Loading