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:
@@ -2600,7 +2600,7 @@ void pmu_blink(int n)
|
||||
#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32)
|
||||
int pmu_sys_suspended;
|
||||
|
||||
static int pmu_syscore_suspend(void)
|
||||
static int pmu_syscore_suspend(void *data)
|
||||
{
|
||||
/* Suspend PMU event interrupts */
|
||||
pmu_suspend();
|
||||
@@ -2614,7 +2614,7 @@ static int pmu_syscore_suspend(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void pmu_syscore_resume(void)
|
||||
static void pmu_syscore_resume(void *data)
|
||||
{
|
||||
struct adb_request req;
|
||||
|
||||
@@ -2634,14 +2634,18 @@ static void pmu_syscore_resume(void)
|
||||
pmu_sys_suspended = 0;
|
||||
}
|
||||
|
||||
static struct syscore_ops pmu_syscore_ops = {
|
||||
static const struct syscore_ops pmu_syscore_ops = {
|
||||
.suspend = pmu_syscore_suspend,
|
||||
.resume = pmu_syscore_resume,
|
||||
};
|
||||
|
||||
static struct syscore pmu_syscore = {
|
||||
.ops = &pmu_syscore_ops,
|
||||
};
|
||||
|
||||
static int pmu_syscore_register(void)
|
||||
{
|
||||
register_syscore_ops(&pmu_syscore_ops);
|
||||
register_syscore(&pmu_syscore);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user