mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
syscore: Pass context data to callbacks
Several drivers can benefit from registering per-instance data along with the syscore operations. To achieve this, move the modifiable fields out of the syscore_ops structure and into a separate struct syscore that can be registered with the framework. Add a void * driver data field for drivers to store contextual data that will be passed to the syscore ops. Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org> Signed-off-by: Thierry Reding <treding@nvidia.com>
This commit is contained in:
@@ -3639,12 +3639,13 @@ static bool legacy_kthread_create(void)
|
||||
|
||||
/**
|
||||
* printk_kthreads_shutdown - shutdown all threaded printers
|
||||
* @data: syscore context
|
||||
*
|
||||
* On system shutdown all threaded printers are stopped. This allows printk
|
||||
* to transition back to atomic printing, thus providing a robust mechanism
|
||||
* for the final shutdown/reboot messages to be output.
|
||||
*/
|
||||
static void printk_kthreads_shutdown(void)
|
||||
static void printk_kthreads_shutdown(void *data)
|
||||
{
|
||||
struct console *con;
|
||||
|
||||
@@ -3666,10 +3667,14 @@ static void printk_kthreads_shutdown(void)
|
||||
console_list_unlock();
|
||||
}
|
||||
|
||||
static struct syscore_ops printk_syscore_ops = {
|
||||
static const struct syscore_ops printk_syscore_ops = {
|
||||
.shutdown = printk_kthreads_shutdown,
|
||||
};
|
||||
|
||||
static struct syscore printk_syscore = {
|
||||
.ops = &printk_syscore_ops,
|
||||
};
|
||||
|
||||
/*
|
||||
* If appropriate, start nbcon kthreads and set @printk_kthreads_running.
|
||||
* If any kthreads fail to start, those consoles are unregistered.
|
||||
@@ -3737,7 +3742,7 @@ static void printk_kthreads_check_locked(void)
|
||||
|
||||
static int __init printk_set_kthreads_ready(void)
|
||||
{
|
||||
register_syscore_ops(&printk_syscore_ops);
|
||||
register_syscore(&printk_syscore);
|
||||
|
||||
console_list_lock();
|
||||
printk_kthreads_ready = true;
|
||||
|
||||
Reference in New Issue
Block a user