main.c (942e6f8a8314e5550e254519dfba4ccd5170421d) main.c (c052bf82c6b00ca27aab0859addc4b3159dfd3a4)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * kernel/power/main.c - PM subsystem core functionality.
4 *
5 * Copyright (c) 2003 Patrick Mochel
6 * Copyright (c) 2003 Open Source Development Lab
7 */
8

--- 176 unchanged lines hidden (view full) ---

185 error = -EINVAL;
186
187 out:
188 pm_autosleep_unlock();
189 return error ? error : n;
190}
191
192power_attr(mem_sleep);
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * kernel/power/main.c - PM subsystem core functionality.
4 *
5 * Copyright (c) 2003 Patrick Mochel
6 * Copyright (c) 2003 Open Source Development Lab
7 */
8

--- 176 unchanged lines hidden (view full) ---

185 error = -EINVAL;
186
187 out:
188 pm_autosleep_unlock();
189 return error ? error : n;
190}
191
192power_attr(mem_sleep);
193
194/*
195 * sync_on_suspend: invoke ksys_sync_helper() before suspend.
196 *
197 * show() returns whether ksys_sync_helper() is invoked before suspend.
198 * store() accepts 0 or 1. 0 disables ksys_sync_helper() and 1 enables it.
199 */
200bool sync_on_suspend_enabled = !IS_ENABLED(CONFIG_SUSPEND_SKIP_SYNC);
201
202static ssize_t sync_on_suspend_show(struct kobject *kobj,
203 struct kobj_attribute *attr, char *buf)
204{
205 return sprintf(buf, "%d\n", sync_on_suspend_enabled);
206}
207
208static ssize_t sync_on_suspend_store(struct kobject *kobj,
209 struct kobj_attribute *attr,
210 const char *buf, size_t n)
211{
212 unsigned long val;
213
214 if (kstrtoul(buf, 10, &val))
215 return -EINVAL;
216
217 if (val > 1)
218 return -EINVAL;
219
220 sync_on_suspend_enabled = !!val;
221 return n;
222}
223
224power_attr(sync_on_suspend);
193#endif /* CONFIG_SUSPEND */
194
195#ifdef CONFIG_PM_SLEEP_DEBUG
196int pm_test_level = TEST_NONE;
197
198static const char * const pm_tests[__TEST_AFTER_LAST] = {
199 [TEST_NONE] = "none",
200 [TEST_CORE] = "core",

--- 649 unchanged lines hidden (view full) ---

850 &pm_trace_attr.attr,
851 &pm_trace_dev_match_attr.attr,
852#endif
853#ifdef CONFIG_PM_SLEEP
854 &pm_async_attr.attr,
855 &wakeup_count_attr.attr,
856#ifdef CONFIG_SUSPEND
857 &mem_sleep_attr.attr,
225#endif /* CONFIG_SUSPEND */
226
227#ifdef CONFIG_PM_SLEEP_DEBUG
228int pm_test_level = TEST_NONE;
229
230static const char * const pm_tests[__TEST_AFTER_LAST] = {
231 [TEST_NONE] = "none",
232 [TEST_CORE] = "core",

--- 649 unchanged lines hidden (view full) ---

882 &pm_trace_attr.attr,
883 &pm_trace_dev_match_attr.attr,
884#endif
885#ifdef CONFIG_PM_SLEEP
886 &pm_async_attr.attr,
887 &wakeup_count_attr.attr,
888#ifdef CONFIG_SUSPEND
889 &mem_sleep_attr.attr,
890 &sync_on_suspend_attr.attr,
858#endif
859#ifdef CONFIG_PM_AUTOSLEEP
860 &autosleep_attr.attr,
861#endif
862#ifdef CONFIG_PM_WAKELOCKS
863 &wake_lock_attr.attr,
864 &wake_unlock_attr.attr,
865#endif

--- 54 unchanged lines hidden ---
891#endif
892#ifdef CONFIG_PM_AUTOSLEEP
893 &autosleep_attr.attr,
894#endif
895#ifdef CONFIG_PM_WAKELOCKS
896 &wake_lock_attr.attr,
897 &wake_unlock_attr.attr,
898#endif

--- 54 unchanged lines hidden ---