mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -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:
@@ -1944,7 +1944,7 @@ static void mpic_suspend_one(struct mpic *mpic)
|
||||
}
|
||||
}
|
||||
|
||||
static int mpic_suspend(void)
|
||||
static int mpic_suspend(void *data)
|
||||
{
|
||||
struct mpic *mpic = mpics;
|
||||
|
||||
@@ -1986,7 +1986,7 @@ static void mpic_resume_one(struct mpic *mpic)
|
||||
} /* end for loop */
|
||||
}
|
||||
|
||||
static void mpic_resume(void)
|
||||
static void mpic_resume(void *data)
|
||||
{
|
||||
struct mpic *mpic = mpics;
|
||||
|
||||
@@ -1996,19 +1996,23 @@ static void mpic_resume(void)
|
||||
}
|
||||
}
|
||||
|
||||
static struct syscore_ops mpic_syscore_ops = {
|
||||
static const struct syscore_ops mpic_syscore_ops = {
|
||||
.resume = mpic_resume,
|
||||
.suspend = mpic_suspend,
|
||||
};
|
||||
|
||||
static struct syscore mpic_syscore = {
|
||||
.ops = &mpic_syscore_ops,
|
||||
};
|
||||
|
||||
static int mpic_init_sys(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
register_syscore_ops(&mpic_syscore_ops);
|
||||
register_syscore(&mpic_syscore);
|
||||
rc = subsys_system_register(&mpic_subsys, NULL);
|
||||
if (rc) {
|
||||
unregister_syscore_ops(&mpic_syscore_ops);
|
||||
unregister_syscore(&mpic_syscore);
|
||||
pr_err("mpic: Failed to register subsystem!\n");
|
||||
return rc;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user