mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-21 04:53:46 -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:
@@ -350,7 +350,7 @@ err:
|
||||
#ifdef CONFIG_SUSPEND
|
||||
|
||||
/* save lbc registers */
|
||||
static int fsl_lbc_syscore_suspend(void)
|
||||
static int fsl_lbc_syscore_suspend(void *data)
|
||||
{
|
||||
struct fsl_lbc_ctrl *ctrl;
|
||||
struct fsl_lbc_regs __iomem *lbc;
|
||||
@@ -374,7 +374,7 @@ out:
|
||||
}
|
||||
|
||||
/* restore lbc registers */
|
||||
static void fsl_lbc_syscore_resume(void)
|
||||
static void fsl_lbc_syscore_resume(void *data)
|
||||
{
|
||||
struct fsl_lbc_ctrl *ctrl;
|
||||
struct fsl_lbc_regs __iomem *lbc;
|
||||
@@ -408,10 +408,14 @@ static const struct of_device_id fsl_lbc_match[] = {
|
||||
};
|
||||
|
||||
#ifdef CONFIG_SUSPEND
|
||||
static struct syscore_ops lbc_syscore_pm_ops = {
|
||||
static const struct syscore_ops lbc_syscore_pm_ops = {
|
||||
.suspend = fsl_lbc_syscore_suspend,
|
||||
.resume = fsl_lbc_syscore_resume,
|
||||
};
|
||||
|
||||
static struct syscore lbc_syscore_pm = {
|
||||
.ops = &lbc_syscore_pm_ops,
|
||||
};
|
||||
#endif
|
||||
|
||||
static struct platform_driver fsl_lbc_ctrl_driver = {
|
||||
@@ -425,7 +429,7 @@ static struct platform_driver fsl_lbc_ctrl_driver = {
|
||||
static int __init fsl_lbc_init(void)
|
||||
{
|
||||
#ifdef CONFIG_SUSPEND
|
||||
register_syscore_ops(&lbc_syscore_pm_ops);
|
||||
register_syscore(&lbc_syscore_pm);
|
||||
#endif
|
||||
return platform_driver_register(&fsl_lbc_ctrl_driver);
|
||||
}
|
||||
|
||||
@@ -1258,7 +1258,7 @@ static void fsl_pci_syscore_do_suspend(struct pci_controller *hose)
|
||||
send_pme_turnoff_message(hose);
|
||||
}
|
||||
|
||||
static int fsl_pci_syscore_suspend(void)
|
||||
static int fsl_pci_syscore_suspend(void *data)
|
||||
{
|
||||
struct pci_controller *hose, *tmp;
|
||||
|
||||
@@ -1291,7 +1291,7 @@ static void fsl_pci_syscore_do_resume(struct pci_controller *hose)
|
||||
setup_pci_atmu(hose);
|
||||
}
|
||||
|
||||
static void fsl_pci_syscore_resume(void)
|
||||
static void fsl_pci_syscore_resume(void *data)
|
||||
{
|
||||
struct pci_controller *hose, *tmp;
|
||||
|
||||
@@ -1299,10 +1299,14 @@ static void fsl_pci_syscore_resume(void)
|
||||
fsl_pci_syscore_do_resume(hose);
|
||||
}
|
||||
|
||||
static struct syscore_ops pci_syscore_pm_ops = {
|
||||
static const struct syscore_ops pci_syscore_pm_ops = {
|
||||
.suspend = fsl_pci_syscore_suspend,
|
||||
.resume = fsl_pci_syscore_resume,
|
||||
};
|
||||
|
||||
static struct syscore pci_syscore_pm = {
|
||||
.ops = &pci_syscore_pm_ops,
|
||||
};
|
||||
#endif
|
||||
|
||||
void fsl_pcibios_fixup_phb(struct pci_controller *phb)
|
||||
@@ -1359,7 +1363,7 @@ static struct platform_driver fsl_pci_driver = {
|
||||
static int __init fsl_pci_init(void)
|
||||
{
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
register_syscore_ops(&pci_syscore_pm_ops);
|
||||
register_syscore(&pci_syscore_pm);
|
||||
#endif
|
||||
return platform_driver_register(&fsl_pci_driver);
|
||||
}
|
||||
|
||||
@@ -817,7 +817,7 @@ static struct {
|
||||
u32 sercr;
|
||||
} ipic_saved_state;
|
||||
|
||||
static int ipic_suspend(void)
|
||||
static int ipic_suspend(void *data)
|
||||
{
|
||||
struct ipic *ipic = primary_ipic;
|
||||
|
||||
@@ -848,7 +848,7 @@ static int ipic_suspend(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ipic_resume(void)
|
||||
static void ipic_resume(void *data)
|
||||
{
|
||||
struct ipic *ipic = primary_ipic;
|
||||
|
||||
@@ -870,18 +870,22 @@ static void ipic_resume(void)
|
||||
#define ipic_resume NULL
|
||||
#endif
|
||||
|
||||
static struct syscore_ops ipic_syscore_ops = {
|
||||
static const struct syscore_ops ipic_syscore_ops = {
|
||||
.suspend = ipic_suspend,
|
||||
.resume = ipic_resume,
|
||||
};
|
||||
|
||||
static struct syscore ipic_syscore = {
|
||||
.ops = &ipic_syscore_ops,
|
||||
};
|
||||
|
||||
static int __init init_ipic_syscore(void)
|
||||
{
|
||||
if (!primary_ipic || !primary_ipic->regs)
|
||||
return -ENODEV;
|
||||
|
||||
printk(KERN_DEBUG "Registering ipic system core operations\n");
|
||||
register_syscore_ops(&ipic_syscore_ops);
|
||||
register_syscore(&ipic_syscore);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -519,7 +519,7 @@ out:
|
||||
kfree(priv);
|
||||
}
|
||||
|
||||
static void mpic_timer_resume(void)
|
||||
static void mpic_timer_resume(void *data)
|
||||
{
|
||||
struct timer_group_priv *priv;
|
||||
|
||||
@@ -535,10 +535,14 @@ static const struct of_device_id mpic_timer_ids[] = {
|
||||
{},
|
||||
};
|
||||
|
||||
static struct syscore_ops mpic_timer_syscore_ops = {
|
||||
static const struct syscore_ops mpic_timer_syscore_ops = {
|
||||
.resume = mpic_timer_resume,
|
||||
};
|
||||
|
||||
static struct syscore mpic_timer_syscore = {
|
||||
.ops = &mpic_timer_syscore_ops,
|
||||
};
|
||||
|
||||
static int __init mpic_timer_init(void)
|
||||
{
|
||||
struct device_node *np = NULL;
|
||||
@@ -546,7 +550,7 @@ static int __init mpic_timer_init(void)
|
||||
for_each_matching_node(np, mpic_timer_ids)
|
||||
timer_group_init(np);
|
||||
|
||||
register_syscore_ops(&mpic_timer_syscore_ops);
|
||||
register_syscore(&mpic_timer_syscore);
|
||||
|
||||
if (list_empty(&timer_group_list))
|
||||
return -ENODEV;
|
||||
|
||||
Reference in New Issue
Block a user