suspend.c (8dd06ef34b6e2f41b29fbf5fc1663780f2524285) suspend.c (70d932985757fbe978024db313001218e9f8fe5c)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * kernel/power/suspend.c - Suspend to RAM and standby functionality.
4 *
5 * Copyright (c) 2003 Patrick Mochel
6 * Copyright (c) 2003 Open Source Development Lab
7 * Copyright (c) 2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc.
8 */

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

337 * suspend_prepare - Prepare for entering system sleep state.
338 *
339 * Common code run for every system sleep state that can be entered (except for
340 * hibernation). Run suspend notifiers, allocate the "suspend" console and
341 * freeze processes.
342 */
343static int suspend_prepare(suspend_state_t state)
344{
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * kernel/power/suspend.c - Suspend to RAM and standby functionality.
4 *
5 * Copyright (c) 2003 Patrick Mochel
6 * Copyright (c) 2003 Open Source Development Lab
7 * Copyright (c) 2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc.
8 */

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

337 * suspend_prepare - Prepare for entering system sleep state.
338 *
339 * Common code run for every system sleep state that can be entered (except for
340 * hibernation). Run suspend notifiers, allocate the "suspend" console and
341 * freeze processes.
342 */
343static int suspend_prepare(suspend_state_t state)
344{
345 int error, nr_calls = 0;
345 int error;
346
347 if (!sleep_state_supported(state))
348 return -EPERM;
349
350 pm_prepare_console();
351
346
347 if (!sleep_state_supported(state))
348 return -EPERM;
349
350 pm_prepare_console();
351
352 error = __pm_notifier_call_chain(PM_SUSPEND_PREPARE, -1, &nr_calls);
353 if (error) {
354 nr_calls--;
355 goto Finish;
356 }
352 error = pm_notifier_call_chain_robust(PM_SUSPEND_PREPARE, PM_POST_SUSPEND);
353 if (error)
354 goto Restore;
357
358 trace_suspend_resume(TPS("freeze_processes"), 0, true);
359 error = suspend_freeze_processes();
360 trace_suspend_resume(TPS("freeze_processes"), 0, false);
361 if (!error)
362 return 0;
363
364 suspend_stats.failed_freeze++;
365 dpm_save_failed_step(SUSPEND_FREEZE);
355
356 trace_suspend_resume(TPS("freeze_processes"), 0, true);
357 error = suspend_freeze_processes();
358 trace_suspend_resume(TPS("freeze_processes"), 0, false);
359 if (!error)
360 return 0;
361
362 suspend_stats.failed_freeze++;
363 dpm_save_failed_step(SUSPEND_FREEZE);
366 Finish:
367 __pm_notifier_call_chain(PM_POST_SUSPEND, nr_calls, NULL);
364 pm_notifier_call_chain(PM_POST_SUSPEND);
365 Restore:
368 pm_restore_console();
369 return error;
370}
371
372/* default implementation */
373void __weak arch_suspend_disable_irqs(void)
374{
375 local_irq_disable();

--- 248 unchanged lines hidden ---
366 pm_restore_console();
367 return error;
368}
369
370/* default implementation */
371void __weak arch_suspend_disable_irqs(void)
372{
373 local_irq_disable();

--- 248 unchanged lines hidden ---