From b8cec98cd69e5594d1cc3493194d30873c3f2b09 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Wed, 11 Jul 2012 10:46:28 -0400 Subject: [PATCH] xen/oprofile: Switch from syscore_ops to platform_ops. Signed-off-by: Konrad Rzeszutek Wilk --- drivers/xen/xenoprof/xenoprofile.c | 43 +++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/drivers/xen/xenoprof/xenoprofile.c b/drivers/xen/xenoprof/xenoprofile.c index e6bd672665c0..4be72b92e653 100644 --- a/drivers/xen/xenoprof/xenoprofile.c +++ b/drivers/xen/xenoprof/xenoprofile.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -62,36 +62,53 @@ static char cpu_type[XENOPROF_CPU_TYPE_SIZE]; #ifdef CONFIG_PM -static void xenoprof_suspend(void) +static int xenoprof_suspend(struct platform_device *dev, pm_message_t state) { - if (xenoprof_enabled == 1) + if (xenoprof_enabled) xenoprof_stop(); + return 0; } - -static void xenoprof_resume(void) +static int xenoprof_resume(struct platform_device *dev) { - if (xenoprof_enabled == 1) + if (xenoprof_enabled) xenoprof_start(); + return 0; } - -static struct syscore_ops xen_oprofile_syscore_ops = { - .resume = xenoprof_resume, - .suspend= xenoprof_suspend +static struct platform_driver oprofile_driver = { + .driver = { + .name = "oprofile-xen", + }, + .resume = xenoprof_resume, + .suspend = xenoprof_suspend, }; - +static struct platform_device *oprofile_pdev; static void __init init_driverfs(void) { - register_syscore_ops(&xen_oprofile_syscore_ops); + int ret; + + ret = platform_driver_register(&oprofile_driver); + if (ret) + return ret; + + oprofile_pdev = platform_device_register_simple( + oprofile_driver.driver.name, 0, NULL, 0); + if (IS_ERR(oprofile_pdev)) { + ret = PTR_ERR(oprofile_pdev); + platform_driver_unregister(&oprofile_driver); + } + + return ret; } static void exit_driverfs(void) { - unregister_syscore_ops(&xen_oprofile_syscore_ops); + platform_device_unregister(oprofile_pdev); + platform_driver_unregister(&oprofile_driver); } #else -- 2.50.1