aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/via-pmu.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-05-20 01:37:22 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-05-20 01:37:22 -0400
commite83b906c99eb87a11cd731f6726e60cd8ac9ec4b (patch)
tree31074cac87503e4d66e732ab9ca5ee2648ac8d39 /drivers/macintosh/via-pmu.c
parent880102e78547c1db158a17e36cf0cdd98e7ad710 (diff)
powerpc/pmac: Update via-pmu to new syscore_ops
This was left as a sysdev, breaking the build Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/macintosh/via-pmu.c')
-rw-r--r--drivers/macintosh/via-pmu.c56
1 files changed, 12 insertions, 44 deletions
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 8b021eb0d48c..6cccd60c594e 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -40,7 +40,7 @@
40#include <linux/init.h> 40#include <linux/init.h>
41#include <linux/interrupt.h> 41#include <linux/interrupt.h>
42#include <linux/device.h> 42#include <linux/device.h>
43#include <linux/sysdev.h> 43#include <linux/syscore_ops.h>
44#include <linux/freezer.h> 44#include <linux/freezer.h>
45#include <linux/syscalls.h> 45#include <linux/syscalls.h>
46#include <linux/suspend.h> 46#include <linux/suspend.h>
@@ -2527,12 +2527,9 @@ void pmu_blink(int n)
2527#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32) 2527#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32)
2528int pmu_sys_suspended; 2528int pmu_sys_suspended;
2529 2529
2530static int pmu_sys_suspend(struct sys_device *sysdev, pm_message_t state) 2530static int pmu_syscore_suspend(void)
2531{ 2531{
2532 if (state.event != PM_EVENT_SUSPEND || pmu_sys_suspended) 2532 /* Suspend PMU event interrupts */
2533 return 0;
2534
2535 /* Suspend PMU event interrupts */\
2536 pmu_suspend(); 2533 pmu_suspend();
2537 pmu_sys_suspended = 1; 2534 pmu_sys_suspended = 1;
2538 2535
@@ -2544,12 +2541,12 @@ static int pmu_sys_suspend(struct sys_device *sysdev, pm_message_t state)
2544 return 0; 2541 return 0;
2545} 2542}
2546 2543
2547static int pmu_sys_resume(struct sys_device *sysdev) 2544static void pmu_syscore_resume(void)
2548{ 2545{
2549 struct adb_request req; 2546 struct adb_request req;
2550 2547
2551 if (!pmu_sys_suspended) 2548 if (!pmu_sys_suspended)
2552 return 0; 2549 return;
2553 2550
2554 /* Tell PMU we are ready */ 2551 /* Tell PMU we are ready */
2555 pmu_request(&req, NULL, 2, PMU_SYSTEM_READY, 2); 2552 pmu_request(&req, NULL, 2, PMU_SYSTEM_READY, 2);
@@ -2562,50 +2559,21 @@ static int pmu_sys_resume(struct sys_device *sysdev)
2562 /* Resume PMU event interrupts */ 2559 /* Resume PMU event interrupts */
2563 pmu_resume(); 2560 pmu_resume();
2564 pmu_sys_suspended = 0; 2561 pmu_sys_suspended = 0;
2565
2566 return 0;
2567} 2562}
2568 2563
2569#endif /* CONFIG_SUSPEND && CONFIG_PPC32 */ 2564static struct syscore_ops pmu_syscore_ops = {
2570 2565 .suspend = pmu_syscore_suspend,
2571static struct sysdev_class pmu_sysclass = { 2566 .resume = pmu_syscore_resume,
2572 .name = "pmu",
2573};
2574
2575static struct sys_device device_pmu = {
2576 .cls = &pmu_sysclass,
2577};
2578
2579static struct sysdev_driver driver_pmu = {
2580#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32)
2581 .suspend = &pmu_sys_suspend,
2582 .resume = &pmu_sys_resume,
2583#endif /* CONFIG_SUSPEND && CONFIG_PPC32 */
2584}; 2567};
2585 2568
2586static int __init init_pmu_sysfs(void) 2569static int pmu_syscore_register(void)
2587{ 2570{
2588 int rc; 2571 register_syscore_ops(&pmu_syscore_ops);
2589 2572
2590 rc = sysdev_class_register(&pmu_sysclass);
2591 if (rc) {
2592 printk(KERN_ERR "Failed registering PMU sys class\n");
2593 return -ENODEV;
2594 }
2595 rc = sysdev_register(&device_pmu);
2596 if (rc) {
2597 printk(KERN_ERR "Failed registering PMU sys device\n");
2598 return -ENODEV;
2599 }
2600 rc = sysdev_driver_register(&pmu_sysclass, &driver_pmu);
2601 if (rc) {
2602 printk(KERN_ERR "Failed registering PMU sys driver\n");
2603 return -ENODEV;
2604 }
2605 return 0; 2573 return 0;
2606} 2574}
2607 2575subsys_initcall(pmu_syscore_register);
2608subsys_initcall(init_pmu_sysfs); 2576#endif /* CONFIG_SUSPEND && CONFIG_PPC32 */
2609 2577
2610EXPORT_SYMBOL(pmu_request); 2578EXPORT_SYMBOL(pmu_request);
2611EXPORT_SYMBOL(pmu_queue_request); 2579EXPORT_SYMBOL(pmu_queue_request);