aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-11-01 13:39:50 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:16 -0500
commit039a5dcd2fc45188a2d522df630db4f7ef903a0f (patch)
treedbadc8ef13f00f90acf3c9caad8a3834a34f6ce9
parent7405c1e15edfe43b137bfbc5882f1af34d6d414d (diff)
kset: convert /sys/power to use kset_create
Dynamically create the kset instead of declaring it statically. We also rename power_subsys to power_kset to catch all users of the variable and we properly export it so that people don't have to guess that it really is present in the system. The pseries code is wierd, why is it createing /sys/power if CONFIG_PM is disabled? Oh well, stupid big boxes ignoring config options... Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--arch/arm/mach-omap1/pm.c3
-rw-r--r--arch/powerpc/platforms/pseries/power.c14
-rw-r--r--include/linux/kobject.h2
-rw-r--r--kernel/power/disk.c2
-rw-r--r--kernel/power/main.c11
-rw-r--r--kernel/power/power.h2
6 files changed, 15 insertions, 19 deletions
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 3bf01e28df33..402113c72981 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -97,7 +97,6 @@ static struct subsys_attribute sleep_while_idle_attr = {
97 .store = omap_pm_sleep_while_idle_store, 97 .store = omap_pm_sleep_while_idle_store,
98}; 98};
99 99
100extern struct kset power_subsys;
101static void (*omap_sram_idle)(void) = NULL; 100static void (*omap_sram_idle)(void) = NULL;
102static void (*omap_sram_suspend)(unsigned long r0, unsigned long r1) = NULL; 101static void (*omap_sram_suspend)(unsigned long r0, unsigned long r1) = NULL;
103 102
@@ -726,7 +725,7 @@ static int __init omap_pm_init(void)
726 omap_pm_init_proc(); 725 omap_pm_init_proc();
727#endif 726#endif
728 727
729 error = subsys_create_file(&power_subsys, &sleep_while_idle_attr); 728 error = subsys_create_file(power_kset, &sleep_while_idle_attr);
730 if (error) 729 if (error)
731 printk(KERN_ERR "subsys_create_file failed: %d\n", error); 730 printk(KERN_ERR "subsys_create_file failed: %d\n", error);
732 731
diff --git a/arch/powerpc/platforms/pseries/power.c b/arch/powerpc/platforms/pseries/power.c
index 08d7a5007167..c36febe7ce7d 100644
--- a/arch/powerpc/platforms/pseries/power.c
+++ b/arch/powerpc/platforms/pseries/power.c
@@ -57,7 +57,7 @@ static struct subsys_attribute auto_poweron_attr = {
57}; 57};
58 58
59#ifndef CONFIG_PM 59#ifndef CONFIG_PM
60decl_subsys(power, NULL); 60struct kset *power_kset;
61 61
62static struct attribute *g[] = { 62static struct attribute *g[] = {
63 &auto_poweron_attr.attr, 63 &auto_poweron_attr.attr,
@@ -70,18 +70,16 @@ static struct attribute_group attr_group = {
70 70
71static int __init pm_init(void) 71static int __init pm_init(void)
72{ 72{
73 int error = subsystem_register(&power_subsys); 73 power_kset = kset_create_and_add("power", NULL, NULL);
74 if (!error) 74 if (!power_kset)
75 error = sysfs_create_group(&power_subsys.kobj, &attr_group); 75 return -ENOMEM;
76 return error; 76 return sysfs_create_group(&power_kset->kobj, &attr_group);
77} 77}
78core_initcall(pm_init); 78core_initcall(pm_init);
79#else 79#else
80extern struct kset power_subsys;
81
82static int __init apo_pm_init(void) 80static int __init apo_pm_init(void)
83{ 81{
84 return (subsys_create_file(&power_subsys, &auto_poweron_attr)); 82 return (subsys_create_file(power_kset, &auto_poweron_attr));
85} 83}
86__initcall(apo_pm_init); 84__initcall(apo_pm_init);
87#endif 85#endif
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index f2483f6fd639..a6dd669cda9d 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -198,6 +198,8 @@ struct kset _name##_subsys = { \
198extern struct kset *kernel_kset; 198extern struct kset *kernel_kset;
199/* The global /sys/hypervisor/ kobject for people to chain off of */ 199/* The global /sys/hypervisor/ kobject for people to chain off of */
200extern struct kobject *hypervisor_kobj; 200extern struct kobject *hypervisor_kobj;
201/* The global /sys/power/ kset for people to chain off of */
202extern struct kset *power_kset;
201 203
202extern int __must_check subsystem_register(struct kset *); 204extern int __must_check subsystem_register(struct kset *);
203extern void subsystem_unregister(struct kset *); 205extern void subsystem_unregister(struct kset *);
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index 05b64790fe83..c3f0e61365dd 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -708,7 +708,7 @@ static struct attribute_group attr_group = {
708 708
709static int __init pm_disk_init(void) 709static int __init pm_disk_init(void)
710{ 710{
711 return sysfs_create_group(&power_subsys.kobj, &attr_group); 711 return sysfs_create_group(&power_kset->kobj, &attr_group);
712} 712}
713 713
714core_initcall(pm_disk_init); 714core_initcall(pm_disk_init);
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 1ef31c91ce0e..dce2d76d66de 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -276,8 +276,7 @@ EXPORT_SYMBOL(pm_suspend);
276 276
277#endif /* CONFIG_SUSPEND */ 277#endif /* CONFIG_SUSPEND */
278 278
279decl_subsys(power, NULL); 279struct kset *power_kset;
280
281 280
282/** 281/**
283 * state - control system power state. 282 * state - control system power state.
@@ -386,10 +385,10 @@ static struct attribute_group attr_group = {
386 385
387static int __init pm_init(void) 386static int __init pm_init(void)
388{ 387{
389 int error = subsystem_register(&power_subsys); 388 power_kset = kset_create_and_add("power", NULL, NULL);
390 if (!error) 389 if (!power_kset)
391 error = sysfs_create_group(&power_subsys.kobj,&attr_group); 390 return -ENOMEM;
392 return error; 391 return sysfs_create_group(&power_kset->kobj, &attr_group);
393} 392}
394 393
395core_initcall(pm_init); 394core_initcall(pm_init);
diff --git a/kernel/power/power.h b/kernel/power/power.h
index 195dc4611764..1083e6b188ab 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -63,8 +63,6 @@ static struct subsys_attribute _name##_attr = { \
63 .store = _name##_store, \ 63 .store = _name##_store, \
64} 64}
65 65
66extern struct kset power_subsys;
67
68/* Preferred image size in bytes (default 500 MB) */ 66/* Preferred image size in bytes (default 500 MB) */
69extern unsigned long image_size; 67extern unsigned long image_size;
70extern int in_suspend; 68extern int in_suspend;