aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-04-13 16:15:19 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-05-02 21:57:59 -0400
commit823bccfc4002296ba88c3ad0f049e1abd8108d30 (patch)
tree5338ae0b32409446af4cd00c5107d9405d5bf0b6 /kernel
parent2609e7b9bebfd433254c02538ba803dc516ff674 (diff)
remove "struct subsystem" as it is no longer needed
We need to work on cleaning up the relationship between kobjects, ksets and ktypes. The removal of 'struct subsystem' is the first step of this, especially as it is not really needed at all. Thanks to Kay for fixing the bugs in this patch. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/ksysfs.c12
-rw-r--r--kernel/module.c8
-rw-r--r--kernel/params.c2
-rw-r--r--kernel/power/disk.c14
-rw-r--r--kernel/power/main.c10
-rw-r--r--kernel/power/power.h2
6 files changed, 26 insertions, 22 deletions
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index e0ffe4ab0917..559deca5ed15 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -24,18 +24,18 @@ static struct subsys_attribute _name##_attr = \
24 24
25#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) 25#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
26/* current uevent sequence number */ 26/* current uevent sequence number */
27static ssize_t uevent_seqnum_show(struct subsystem *subsys, char *page) 27static ssize_t uevent_seqnum_show(struct kset *kset, char *page)
28{ 28{
29 return sprintf(page, "%llu\n", (unsigned long long)uevent_seqnum); 29 return sprintf(page, "%llu\n", (unsigned long long)uevent_seqnum);
30} 30}
31KERNEL_ATTR_RO(uevent_seqnum); 31KERNEL_ATTR_RO(uevent_seqnum);
32 32
33/* uevent helper program, used during early boo */ 33/* uevent helper program, used during early boo */
34static ssize_t uevent_helper_show(struct subsystem *subsys, char *page) 34static ssize_t uevent_helper_show(struct kset *kset, char *page)
35{ 35{
36 return sprintf(page, "%s\n", uevent_helper); 36 return sprintf(page, "%s\n", uevent_helper);
37} 37}
38static ssize_t uevent_helper_store(struct subsystem *subsys, const char *page, size_t count) 38static ssize_t uevent_helper_store(struct kset *kset, const char *page, size_t count)
39{ 39{
40 if (count+1 > UEVENT_HELPER_PATH_LEN) 40 if (count+1 > UEVENT_HELPER_PATH_LEN)
41 return -ENOENT; 41 return -ENOENT;
@@ -49,13 +49,13 @@ KERNEL_ATTR_RW(uevent_helper);
49#endif 49#endif
50 50
51#ifdef CONFIG_KEXEC 51#ifdef CONFIG_KEXEC
52static ssize_t kexec_loaded_show(struct subsystem *subsys, char *page) 52static ssize_t kexec_loaded_show(struct kset *kset, char *page)
53{ 53{
54 return sprintf(page, "%d\n", !!kexec_image); 54 return sprintf(page, "%d\n", !!kexec_image);
55} 55}
56KERNEL_ATTR_RO(kexec_loaded); 56KERNEL_ATTR_RO(kexec_loaded);
57 57
58static ssize_t kexec_crash_loaded_show(struct subsystem *subsys, char *page) 58static ssize_t kexec_crash_loaded_show(struct kset *kset, char *page)
59{ 59{
60 return sprintf(page, "%d\n", !!kexec_crash_image); 60 return sprintf(page, "%d\n", !!kexec_crash_image);
61} 61}
@@ -85,7 +85,7 @@ static int __init ksysfs_init(void)
85{ 85{
86 int error = subsystem_register(&kernel_subsys); 86 int error = subsystem_register(&kernel_subsys);
87 if (!error) 87 if (!error)
88 error = sysfs_create_group(&kernel_subsys.kset.kobj, 88 error = sysfs_create_group(&kernel_subsys.kobj,
89 &kernel_attr_group); 89 &kernel_attr_group);
90 90
91 return error; 91 return error;
diff --git a/kernel/module.c b/kernel/module.c
index 9da5af668a20..ff982ec435fc 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -45,6 +45,8 @@
45#include <asm/cacheflush.h> 45#include <asm/cacheflush.h>
46#include <linux/license.h> 46#include <linux/license.h>
47 47
48extern int module_sysfs_initialized;
49
48#if 0 50#if 0
49#define DEBUGP printk 51#define DEBUGP printk
50#else 52#else
@@ -1117,8 +1119,8 @@ int mod_sysfs_init(struct module *mod)
1117{ 1119{
1118 int err; 1120 int err;
1119 1121
1120 if (!module_subsys.kset.subsys) { 1122 if (!module_sysfs_initialized) {
1121 printk(KERN_ERR "%s: module_subsys not initialized\n", 1123 printk(KERN_ERR "%s: module sysfs not initialized\n",
1122 mod->name); 1124 mod->name);
1123 err = -EINVAL; 1125 err = -EINVAL;
1124 goto out; 1126 goto out;
@@ -2385,7 +2387,7 @@ void module_add_driver(struct module *mod, struct device_driver *drv)
2385 struct kobject *mkobj; 2387 struct kobject *mkobj;
2386 2388
2387 /* Lookup built-in module entry in /sys/modules */ 2389 /* Lookup built-in module entry in /sys/modules */
2388 mkobj = kset_find_obj(&module_subsys.kset, drv->mod_name); 2390 mkobj = kset_find_obj(&module_subsys, drv->mod_name);
2389 if (mkobj) { 2391 if (mkobj) {
2390 mk = container_of(mkobj, struct module_kobject, kobj); 2392 mk = container_of(mkobj, struct module_kobject, kobj);
2391 /* remember our module structure */ 2393 /* remember our module structure */
diff --git a/kernel/params.c b/kernel/params.c
index 1fc4ac746cd8..312172320b4c 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -691,6 +691,7 @@ static struct kset_uevent_ops module_uevent_ops = {
691}; 691};
692 692
693decl_subsys(module, &module_ktype, &module_uevent_ops); 693decl_subsys(module, &module_ktype, &module_uevent_ops);
694int module_sysfs_initialized;
694 695
695static struct kobj_type module_ktype = { 696static struct kobj_type module_ktype = {
696 .sysfs_ops = &module_sysfs_ops, 697 .sysfs_ops = &module_sysfs_ops,
@@ -709,6 +710,7 @@ static int __init param_sysfs_init(void)
709 __FILE__, __LINE__, ret); 710 __FILE__, __LINE__, ret);
710 return ret; 711 return ret;
711 } 712 }
713 module_sysfs_initialized = 1;
712 714
713 param_sysfs_builtin(); 715 param_sysfs_builtin();
714 716
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index 02e4fb69111a..8df51c23bba4 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -322,13 +322,13 @@ static const char * const pm_disk_modes[] = {
322 * supports it (as determined from pm_ops->pm_disk_mode). 322 * supports it (as determined from pm_ops->pm_disk_mode).
323 */ 323 */
324 324
325static ssize_t disk_show(struct subsystem * subsys, char * buf) 325static ssize_t disk_show(struct kset *kset, char *buf)
326{ 326{
327 return sprintf(buf, "%s\n", pm_disk_modes[pm_disk_mode]); 327 return sprintf(buf, "%s\n", pm_disk_modes[pm_disk_mode]);
328} 328}
329 329
330 330
331static ssize_t disk_store(struct subsystem * s, const char * buf, size_t n) 331static ssize_t disk_store(struct kset *kset, const char *buf, size_t n)
332{ 332{
333 int error = 0; 333 int error = 0;
334 int i; 334 int i;
@@ -373,13 +373,13 @@ static ssize_t disk_store(struct subsystem * s, const char * buf, size_t n)
373 373
374power_attr(disk); 374power_attr(disk);
375 375
376static ssize_t resume_show(struct subsystem * subsys, char *buf) 376static ssize_t resume_show(struct kset *kset, char *buf)
377{ 377{
378 return sprintf(buf,"%d:%d\n", MAJOR(swsusp_resume_device), 378 return sprintf(buf,"%d:%d\n", MAJOR(swsusp_resume_device),
379 MINOR(swsusp_resume_device)); 379 MINOR(swsusp_resume_device));
380} 380}
381 381
382static ssize_t resume_store(struct subsystem *subsys, const char *buf, size_t n) 382static ssize_t resume_store(struct kset *kset, const char *buf, size_t n)
383{ 383{
384 unsigned int maj, min; 384 unsigned int maj, min;
385 dev_t res; 385 dev_t res;
@@ -405,12 +405,12 @@ static ssize_t resume_store(struct subsystem *subsys, const char *buf, size_t n)
405 405
406power_attr(resume); 406power_attr(resume);
407 407
408static ssize_t image_size_show(struct subsystem * subsys, char *buf) 408static ssize_t image_size_show(struct kset *kset, char *buf)
409{ 409{
410 return sprintf(buf, "%lu\n", image_size); 410 return sprintf(buf, "%lu\n", image_size);
411} 411}
412 412
413static ssize_t image_size_store(struct subsystem * subsys, const char * buf, size_t n) 413static ssize_t image_size_store(struct kset *kset, const char *buf, size_t n)
414{ 414{
415 unsigned long size; 415 unsigned long size;
416 416
@@ -439,7 +439,7 @@ static struct attribute_group attr_group = {
439 439
440static int __init pm_disk_init(void) 440static int __init pm_disk_init(void)
441{ 441{
442 return sysfs_create_group(&power_subsys.kset.kobj,&attr_group); 442 return sysfs_create_group(&power_subsys.kobj, &attr_group);
443} 443}
444 444
445core_initcall(pm_disk_init); 445core_initcall(pm_disk_init);
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 72419a3b1beb..b21c2a56f960 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -285,7 +285,7 @@ decl_subsys(power,NULL,NULL);
285 * proper enumerated value, and initiates a suspend transition. 285 * proper enumerated value, and initiates a suspend transition.
286 */ 286 */
287 287
288static ssize_t state_show(struct subsystem * subsys, char * buf) 288static ssize_t state_show(struct kset *kset, char *buf)
289{ 289{
290 int i; 290 int i;
291 char * s = buf; 291 char * s = buf;
@@ -298,7 +298,7 @@ static ssize_t state_show(struct subsystem * subsys, char * buf)
298 return (s - buf); 298 return (s - buf);
299} 299}
300 300
301static ssize_t state_store(struct subsystem * subsys, const char * buf, size_t n) 301static ssize_t state_store(struct kset *kset, const char *buf, size_t n)
302{ 302{
303 suspend_state_t state = PM_SUSPEND_STANDBY; 303 suspend_state_t state = PM_SUSPEND_STANDBY;
304 const char * const *s; 304 const char * const *s;
@@ -325,13 +325,13 @@ power_attr(state);
325#ifdef CONFIG_PM_TRACE 325#ifdef CONFIG_PM_TRACE
326int pm_trace_enabled; 326int pm_trace_enabled;
327 327
328static ssize_t pm_trace_show(struct subsystem * subsys, char * buf) 328static ssize_t pm_trace_show(struct kset *kset, char *buf)
329{ 329{
330 return sprintf(buf, "%d\n", pm_trace_enabled); 330 return sprintf(buf, "%d\n", pm_trace_enabled);
331} 331}
332 332
333static ssize_t 333static ssize_t
334pm_trace_store(struct subsystem * subsys, const char * buf, size_t n) 334pm_trace_store(struct kset *kset, const char *buf, size_t n)
335{ 335{
336 int val; 336 int val;
337 337
@@ -365,7 +365,7 @@ static int __init pm_init(void)
365{ 365{
366 int error = subsystem_register(&power_subsys); 366 int error = subsystem_register(&power_subsys);
367 if (!error) 367 if (!error)
368 error = sysfs_create_group(&power_subsys.kset.kobj,&attr_group); 368 error = sysfs_create_group(&power_subsys.kobj,&attr_group);
369 return error; 369 return error;
370} 370}
371 371
diff --git a/kernel/power/power.h b/kernel/power/power.h
index eb461b816bf4..5f842c3efc4b 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -35,7 +35,7 @@ static struct subsys_attribute _name##_attr = { \
35 .store = _name##_store, \ 35 .store = _name##_store, \
36} 36}
37 37
38extern struct subsystem power_subsys; 38extern struct kset power_subsys;
39 39
40/* References to section boundaries */ 40/* References to section boundaries */
41extern const void __nosave_begin, __nosave_end; 41extern const void __nosave_begin, __nosave_end;