diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2011-04-26 13:14:57 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2011-05-11 15:37:15 -0400 |
commit | f5a592f7d74e38c5007876c731e6bf5580072e63 (patch) | |
tree | 893e896facaf984087c950e744eb5e449c40f704 /arch/powerpc/sysdev/ipic.c | |
parent | f98bf4aa39ecce96020631cba910be094c87ac3c (diff) |
PM / PowerPC: Use struct syscore_ops instead of sysdevs for PM
Make some PowerPC architecture's code use struct syscore_ops
objects for power management instead of sysdev classes and sysdevs.
This simplifies the code and reduces the kernel's memory footprint.
It also is necessary for removing sysdevs from the kernel entirely in
the future.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch/powerpc/sysdev/ipic.c')
-rw-r--r-- | arch/powerpc/sysdev/ipic.c | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c index fa438be962b7..596554a8725e 100644 --- a/arch/powerpc/sysdev/ipic.c +++ b/arch/powerpc/sysdev/ipic.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <linux/stddef.h> | 18 | #include <linux/stddef.h> |
19 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
20 | #include <linux/signal.h> | 20 | #include <linux/signal.h> |
21 | #include <linux/sysdev.h> | 21 | #include <linux/syscore_ops.h> |
22 | #include <linux/device.h> | 22 | #include <linux/device.h> |
23 | #include <linux/bootmem.h> | 23 | #include <linux/bootmem.h> |
24 | #include <linux/spinlock.h> | 24 | #include <linux/spinlock.h> |
@@ -902,7 +902,7 @@ static struct { | |||
902 | u32 sercr; | 902 | u32 sercr; |
903 | } ipic_saved_state; | 903 | } ipic_saved_state; |
904 | 904 | ||
905 | static int ipic_suspend(struct sys_device *sdev, pm_message_t state) | 905 | static int ipic_suspend(void) |
906 | { | 906 | { |
907 | struct ipic *ipic = primary_ipic; | 907 | struct ipic *ipic = primary_ipic; |
908 | 908 | ||
@@ -933,7 +933,7 @@ static int ipic_suspend(struct sys_device *sdev, pm_message_t state) | |||
933 | return 0; | 933 | return 0; |
934 | } | 934 | } |
935 | 935 | ||
936 | static int ipic_resume(struct sys_device *sdev) | 936 | static void ipic_resume(void) |
937 | { | 937 | { |
938 | struct ipic *ipic = primary_ipic; | 938 | struct ipic *ipic = primary_ipic; |
939 | 939 | ||
@@ -949,44 +949,26 @@ static int ipic_resume(struct sys_device *sdev) | |||
949 | ipic_write(ipic->regs, IPIC_SECNR, ipic_saved_state.secnr); | 949 | ipic_write(ipic->regs, IPIC_SECNR, ipic_saved_state.secnr); |
950 | ipic_write(ipic->regs, IPIC_SERMR, ipic_saved_state.sermr); | 950 | ipic_write(ipic->regs, IPIC_SERMR, ipic_saved_state.sermr); |
951 | ipic_write(ipic->regs, IPIC_SERCR, ipic_saved_state.sercr); | 951 | ipic_write(ipic->regs, IPIC_SERCR, ipic_saved_state.sercr); |
952 | |||
953 | return 0; | ||
954 | } | 952 | } |
955 | #else | 953 | #else |
956 | #define ipic_suspend NULL | 954 | #define ipic_suspend NULL |
957 | #define ipic_resume NULL | 955 | #define ipic_resume NULL |
958 | #endif | 956 | #endif |
959 | 957 | ||
960 | static struct sysdev_class ipic_sysclass = { | 958 | static struct syscore_ops ipic_syscore_ops = { |
961 | .name = "ipic", | ||
962 | .suspend = ipic_suspend, | 959 | .suspend = ipic_suspend, |
963 | .resume = ipic_resume, | 960 | .resume = ipic_resume, |
964 | }; | 961 | }; |
965 | 962 | ||
966 | static struct sys_device device_ipic = { | 963 | static int __init init_ipic_syscore(void) |
967 | .id = 0, | ||
968 | .cls = &ipic_sysclass, | ||
969 | }; | ||
970 | |||
971 | static int __init init_ipic_sysfs(void) | ||
972 | { | 964 | { |
973 | int rc; | ||
974 | |||
975 | if (!primary_ipic || !primary_ipic->regs) | 965 | if (!primary_ipic || !primary_ipic->regs) |
976 | return -ENODEV; | 966 | return -ENODEV; |
977 | printk(KERN_DEBUG "Registering ipic with sysfs...\n"); | ||
978 | 967 | ||
979 | rc = sysdev_class_register(&ipic_sysclass); | 968 | printk(KERN_DEBUG "Registering ipic system core operations\n"); |
980 | if (rc) { | 969 | register_syscore_ops(&ipic_syscore_ops); |
981 | printk(KERN_ERR "Failed registering ipic sys class\n"); | 970 | |
982 | return -ENODEV; | ||
983 | } | ||
984 | rc = sysdev_register(&device_ipic); | ||
985 | if (rc) { | ||
986 | printk(KERN_ERR "Failed registering ipic sys device\n"); | ||
987 | return -ENODEV; | ||
988 | } | ||
989 | return 0; | 971 | return 0; |
990 | } | 972 | } |
991 | 973 | ||
992 | subsys_initcall(init_ipic_sysfs); | 974 | subsys_initcall(init_ipic_syscore); |