Lines Matching +full:function +full:- +full:off

1 // SPDX-License-Identifier: GPL-2.0-only
23 * this indicates whether you can reboot with ctrl-alt-del: the default is yes
64 * the system cannot be powered off. This allowes kernel_halt() to notify users
76 * emergency_restart - reboot the system
100 * register_reboot_notifier - Register function to be called at reboot time
101 * @nb: Info about notifier function to be called
103 * Registers a function with the list of functions
116 * unregister_reboot_notifier - Unregister previously registered reboot notifier
120 * notifier function.
122 * Returns zero on success, or %-ENOENT on failure.
143 return -ENOMEM; in devm_register_reboot_notifier()
164 * register_restart_handler - Register function to be called to reset
166 * @nb: Info about handler function to be called
167 * @nb->priority: Handler priority. Handlers should follow the
178 * Registers a function with code to be called to restart the
183 * machine_restart function calls do_kernel_restart - see below
186 * If more than one function is registered, the restart handler priority
187 * selects which function will be called first.
189 * Restart handlers are expected to be registered from non-architecture
208 * unregister_restart_handler - Unregister previously registered
212 * Unregisters a previously registered restart handler function.
214 * Returns zero on success, or %-ENOENT on failure.
223 * do_kernel_restart - Execute kernel restart handler call chain
230 * Restarts the system immediately if a restart handler function has been
250 current->flags |= PF_NO_SETAFFINITY; in migrate_to_reboot_cpu()
268 * kernel_restart - reboot the system
299 * kernel_halt - halt the system
309 pr_emerg("Power off not available: System halted instead\n"); in kernel_halt()
319 * to prepare system for power off.
325 * to power off system.
336 data.cb_data = handler->cb_data; in sys_off_notify()
339 data.dev = handler->dev; in sys_off_notify()
341 return handler->sys_off_cb(&data); in sys_off_notify()
357 if (handler->cb_data) in alloc_sys_off_handler()
358 return ERR_PTR(-EBUSY); in alloc_sys_off_handler()
367 return ERR_PTR(-ENOMEM); in alloc_sys_off_handler()
382 * register_sys_off_handler - Register sys-off handler
383 * @mode: Sys-off mode
385 * @callback: Callback function
388 * Registers system power-off or restart handler that will be invoked
389 * at the step corresponding to the given sys-off mode. Handler's callback
396 * Only one handler can be registered at the non-default priority level,
397 * otherwise ERR_PTR(-EBUSY) is returned.
400 * an ERR_PTR()-encoded error code otherwise.
417 handler->list = &power_off_prep_handler_list; in register_sys_off_handler()
418 handler->blocking = true; in register_sys_off_handler()
422 handler->list = &power_off_handler_list; in register_sys_off_handler()
426 handler->list = &restart_prep_handler_list; in register_sys_off_handler()
427 handler->blocking = true; in register_sys_off_handler()
431 handler->list = &restart_handler_list; in register_sys_off_handler()
436 return ERR_PTR(-EINVAL); in register_sys_off_handler()
439 handler->nb.notifier_call = sys_off_notify; in register_sys_off_handler()
440 handler->nb.priority = priority; in register_sys_off_handler()
441 handler->sys_off_cb = callback; in register_sys_off_handler()
442 handler->cb_data = cb_data; in register_sys_off_handler()
443 handler->mode = mode; in register_sys_off_handler()
445 if (handler->blocking) { in register_sys_off_handler()
447 err = blocking_notifier_chain_register(handler->list, in register_sys_off_handler()
448 &handler->nb); in register_sys_off_handler()
450 err = blocking_notifier_chain_register_unique_prio(handler->list, in register_sys_off_handler()
451 &handler->nb); in register_sys_off_handler()
454 err = atomic_notifier_chain_register(handler->list, in register_sys_off_handler()
455 &handler->nb); in register_sys_off_handler()
457 err = atomic_notifier_chain_register_unique_prio(handler->list, in register_sys_off_handler()
458 &handler->nb); in register_sys_off_handler()
471 * unregister_sys_off_handler - Unregister sys-off handler
472 * @handler: Sys-off handler
474 * Unregisters given sys-off handler.
483 if (handler->blocking) in unregister_sys_off_handler()
484 err = blocking_notifier_chain_unregister(handler->list, in unregister_sys_off_handler()
485 &handler->nb); in unregister_sys_off_handler()
487 err = atomic_notifier_chain_unregister(handler->list, in unregister_sys_off_handler()
488 &handler->nb); in unregister_sys_off_handler()
505 * devm_register_sys_off_handler - Register sys-off handler
507 * @mode: Sys-off mode
509 * @callback: Callback function
512 * Registers resource-managed sys-off handler.
527 handler->dev = dev; in devm_register_sys_off_handler()
535 * devm_register_power_off_handler - Register power-off handler
537 * @callback: Callback function
540 * Registers resource-managed sys-off handler with a default priority
541 * and using power-off mode.
557 * devm_register_restart_handler - Register restart handler
559 * @callback: Callback function
562 * Registers resource-managed sys-off handler with a default priority
582 void (*platform_power_power_off_cb)(void) = data->cb_data; in platform_power_off_notify()
590 * register_platform_power_off - Register platform-level power-off callback
591 * @power_off: Power-off callback
593 * Registers power-off callback that will be called as last step
594 * of the power-off sequence. This callback is expected to be invoked
595 * for the last resort. Only one platform power-off callback is allowed
618 * unregister_platform_power_off - Unregister platform-level power-off callback
619 * @power_off: Power-off callback
621 * Unregisters previously registered platform power-off callback.
626 platform_power_off_handler->cb_data == power_off) { in unregister_platform_power_off()
647 * do_kernel_power_off - Execute kernel power-off handler call chain
649 * Expected to be called as last step of the power-off sequence.
651 * Powers off the system immediately if a power-off handler function has
659 * Register sys-off handlers for legacy PM callback. This allows in do_kernel_power_off()
660 * legacy PM callbacks temporary co-exist with the new sys-off API. in do_kernel_power_off()
663 * switched to the sys-off based APIs. in do_kernel_power_off()
676 * kernel_can_power_off - check whether system can be powered off
678 * Returns true if power-off handler is registered and system can be
679 * powered off, false otherwise.
689 * kernel_power_off - power_off the system
711 * You can also set the meaning of the ctrl-alt-del-key here.
723 if (!ns_capable(pid_ns->user_ns, CAP_SYS_BOOT)) in SYSCALL_DEFINE4()
724 return -EPERM; in SYSCALL_DEFINE4()
732 return -EINVAL; in SYSCALL_DEFINE4()
775 ret = strncpy_from_user(&buffer[0], arg, sizeof(buffer) - 1); in SYSCALL_DEFINE4()
777 ret = -EFAULT; in SYSCALL_DEFINE4()
780 buffer[sizeof(buffer) - 1] = '\0'; in SYSCALL_DEFINE4()
798 ret = -EINVAL; in SYSCALL_DEFINE4()
811 * This function gets called by ctrl-alt-del - ie the keyboard interrupt.
813 * is whether to reboot at once, or just ignore the ctrl-alt-del.
843 ret = -ENOMEM; in run_cmd()
874 * I guess this should try to kick off some daemon to sync and in __orderly_poweroff()
895 * orderly_poweroff - Trigger an orderly system poweroff
917 * orderly_reboot - Trigger an orderly system reboot
929 * hw_failure_emergency_poweroff_func - emergency poweroff work after a known delay
930 * @work: work_struct associated with the emergency poweroff function
932 * This function is called in very critical situations to force
939 * expired. This means orderly_poweroff has not been able to shut off in hw_failure_emergency_poweroff_func()
945 pr_emerg("Hardware protection timed-out. Trying forced poweroff\n"); in hw_failure_emergency_poweroff_func()
959 * hw_failure_emergency_poweroff - Trigger an emergency system poweroff
973 * __hw_protection_shutdown - Trigger an emergency system shutdown or reboot
1139 return -EPERM; in mode_store()
1152 return -EINVAL; in mode_store()
1171 return -EPERM; in force_store()
1174 return -EINVAL; in force_store()
1216 return -EPERM; in type_store()
1231 return -EINVAL; in type_store()
1252 return -EPERM; in cpu_store()
1260 return -ERANGE; in cpu_store()
1292 .procname = "ctrl-alt-del",
1319 return -ENOMEM; in reboot_ksysfs_init()