aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--arch/arm/mach-omap1/pm.c6
-rw-r--r--arch/powerpc/kernel/vio.c4
-rw-r--r--arch/powerpc/platforms/pseries/power.c8
-rw-r--r--arch/s390/kernel/ipl.c32
-rw-r--r--block/genhd.c12
-rw-r--r--drivers/base/base.h2
-rw-r--r--drivers/base/bus.c16
-rw-r--r--drivers/base/class.c18
-rw-r--r--drivers/base/core.c22
-rw-r--r--drivers/base/firmware.c6
-rw-r--r--drivers/base/power/shutdown.c4
-rw-r--r--drivers/base/sys.c14
-rw-r--r--drivers/firmware/efivars.c12
-rw-r--r--drivers/input/evdev.c4
-rw-r--r--drivers/input/joydev.c4
-rw-r--r--drivers/input/mousedev.c4
-rw-r--r--drivers/input/tsdev.c4
-rw-r--r--drivers/parisc/pdc_stable.c94
-rw-r--r--drivers/pci/hotplug/acpiphp_ibm.c4
-rw-r--r--drivers/pci/hotplug/pci_hotplug_core.c4
-rw-r--r--fs/configfs/mount.c2
-rw-r--r--fs/debugfs/inode.c2
-rw-r--r--fs/dlm/lockspace.c2
-rw-r--r--fs/ecryptfs/main.c12
-rw-r--r--fs/fuse/inode.c4
-rw-r--r--fs/gfs2/locking/dlm/sysfs.c2
-rw-r--r--fs/gfs2/sys.c2
-rw-r--r--fs/ocfs2/cluster/masklog.c4
-rw-r--r--fs/ocfs2/cluster/masklog.h2
-rw-r--r--fs/ocfs2/cluster/sys.c7
-rw-r--r--fs/partitions/check.c6
-rw-r--r--fs/sysfs/file.c11
-rw-r--r--include/acpi/acpi_bus.h2
-rw-r--r--include/linux/device.h8
-rw-r--r--include/linux/fs.h2
-rw-r--r--include/linux/kobject.h58
-rw-r--r--include/linux/module.h2
-rw-r--r--include/linux/pci_hotplug.h2
-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
-rw-r--r--lib/kobject.c69
-rw-r--r--security/inode.c2
46 files changed, 231 insertions, 292 deletions
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 0383ab334270..6f4ea4bda5e0 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -72,12 +72,12 @@ static unsigned int mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_SIZE];
72 72
73static unsigned short enable_dyn_sleep = 1; 73static unsigned short enable_dyn_sleep = 1;
74 74
75static ssize_t omap_pm_sleep_while_idle_show(struct subsystem * subsys, char *buf) 75static ssize_t omap_pm_sleep_while_idle_show(struct kset *kset, char *buf)
76{ 76{
77 return sprintf(buf, "%hu\n", enable_dyn_sleep); 77 return sprintf(buf, "%hu\n", enable_dyn_sleep);
78} 78}
79 79
80static ssize_t omap_pm_sleep_while_idle_store(struct subsystem * subsys, 80static ssize_t omap_pm_sleep_while_idle_store(struct kset *kset,
81 const char * buf, 81 const char * buf,
82 size_t n) 82 size_t n)
83{ 83{
@@ -100,7 +100,7 @@ static struct subsys_attribute sleep_while_idle_attr = {
100 .store = omap_pm_sleep_while_idle_store, 100 .store = omap_pm_sleep_while_idle_store,
101}; 101};
102 102
103extern struct subsystem power_subsys; 103extern struct kset power_subsys;
104static void (*omap_sram_idle)(void) = NULL; 104static void (*omap_sram_idle)(void) = NULL;
105static void (*omap_sram_suspend)(unsigned long r0, unsigned long r1) = NULL; 105static void (*omap_sram_suspend)(unsigned long r0, unsigned long r1) = NULL;
106 106
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 9eaefac5053f..b2c1b67a10a7 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -37,7 +37,7 @@
37#include <asm/iseries/hv_call_xm.h> 37#include <asm/iseries/hv_call_xm.h>
38#include <asm/iseries/iommu.h> 38#include <asm/iseries/iommu.h>
39 39
40extern struct subsystem devices_subsys; /* needed for vio_find_name() */ 40extern struct kset devices_subsys; /* needed for vio_find_name() */
41 41
42static struct vio_dev vio_bus_device = { /* fake "parent" device */ 42static struct vio_dev vio_bus_device = { /* fake "parent" device */
43 .name = vio_bus_device.dev.bus_id, 43 .name = vio_bus_device.dev.bus_id,
@@ -427,7 +427,7 @@ static struct vio_dev *vio_find_name(const char *kobj_name)
427{ 427{
428 struct kobject *found; 428 struct kobject *found;
429 429
430 found = kset_find_obj(&devices_subsys.kset, kobj_name); 430 found = kset_find_obj(&devices_subsys, kobj_name);
431 if (!found) 431 if (!found)
432 return NULL; 432 return NULL;
433 433
diff --git a/arch/powerpc/platforms/pseries/power.c b/arch/powerpc/platforms/pseries/power.c
index 2624b71df73d..73e69023d90a 100644
--- a/arch/powerpc/platforms/pseries/power.c
+++ b/arch/powerpc/platforms/pseries/power.c
@@ -28,13 +28,13 @@
28 28
29unsigned long rtas_poweron_auto; /* default and normal state is 0 */ 29unsigned long rtas_poweron_auto; /* default and normal state is 0 */
30 30
31static ssize_t auto_poweron_show(struct subsystem *subsys, char *buf) 31static ssize_t auto_poweron_show(struct kset *kset, char *buf)
32{ 32{
33 return sprintf(buf, "%lu\n", rtas_poweron_auto); 33 return sprintf(buf, "%lu\n", rtas_poweron_auto);
34} 34}
35 35
36static ssize_t 36static ssize_t
37auto_poweron_store(struct subsystem *subsys, const char *buf, size_t n) 37auto_poweron_store(struct kset *kset, const char *buf, size_t n)
38{ 38{
39 int ret; 39 int ret;
40 unsigned long ups_restart; 40 unsigned long ups_restart;
@@ -72,12 +72,12 @@ static int __init pm_init(void)
72{ 72{
73 int error = subsystem_register(&power_subsys); 73 int error = subsystem_register(&power_subsys);
74 if (!error) 74 if (!error)
75 error = sysfs_create_group(&power_subsys.kset.kobj,&attr_group); 75 error = sysfs_create_group(&power_subsys.kobj, &attr_group);
76 return error; 76 return error;
77} 77}
78core_initcall(pm_init); 78core_initcall(pm_init);
79#else 79#else
80extern struct subsystem power_subsys; 80extern struct kset power_subsys;
81 81
82static int __init apo_pm_init(void) 82static int __init apo_pm_init(void)
83{ 83{
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 06833ac2b115..0ea048d350d8 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -164,7 +164,7 @@ EXPORT_SYMBOL_GPL(diag308);
164/* SYSFS */ 164/* SYSFS */
165 165
166#define DEFINE_IPL_ATTR_RO(_prefix, _name, _format, _value) \ 166#define DEFINE_IPL_ATTR_RO(_prefix, _name, _format, _value) \
167static ssize_t sys_##_prefix##_##_name##_show(struct subsystem *subsys, \ 167static ssize_t sys_##_prefix##_##_name##_show(struct kset *kset, \
168 char *page) \ 168 char *page) \
169{ \ 169{ \
170 return sprintf(page, _format, _value); \ 170 return sprintf(page, _format, _value); \
@@ -173,13 +173,13 @@ static struct subsys_attribute sys_##_prefix##_##_name##_attr = \
173 __ATTR(_name, S_IRUGO, sys_##_prefix##_##_name##_show, NULL); 173 __ATTR(_name, S_IRUGO, sys_##_prefix##_##_name##_show, NULL);
174 174
175#define DEFINE_IPL_ATTR_RW(_prefix, _name, _fmt_out, _fmt_in, _value) \ 175#define DEFINE_IPL_ATTR_RW(_prefix, _name, _fmt_out, _fmt_in, _value) \
176static ssize_t sys_##_prefix##_##_name##_show(struct subsystem *subsys, \ 176static ssize_t sys_##_prefix##_##_name##_show(struct kset *kset, \
177 char *page) \ 177 char *page) \
178{ \ 178{ \
179 return sprintf(page, _fmt_out, \ 179 return sprintf(page, _fmt_out, \
180 (unsigned long long) _value); \ 180 (unsigned long long) _value); \
181} \ 181} \
182static ssize_t sys_##_prefix##_##_name##_store(struct subsystem *subsys,\ 182static ssize_t sys_##_prefix##_##_name##_store(struct kset *kset, \
183 const char *buf, size_t len) \ 183 const char *buf, size_t len) \
184{ \ 184{ \
185 unsigned long long value; \ 185 unsigned long long value; \
@@ -194,12 +194,12 @@ static struct subsys_attribute sys_##_prefix##_##_name##_attr = \
194 sys_##_prefix##_##_name##_store); 194 sys_##_prefix##_##_name##_store);
195 195
196#define DEFINE_IPL_ATTR_STR_RW(_prefix, _name, _fmt_out, _fmt_in, _value)\ 196#define DEFINE_IPL_ATTR_STR_RW(_prefix, _name, _fmt_out, _fmt_in, _value)\
197static ssize_t sys_##_prefix##_##_name##_show(struct subsystem *subsys, \ 197static ssize_t sys_##_prefix##_##_name##_show(struct kset *kset, \
198 char *page) \ 198 char *page) \
199{ \ 199{ \
200 return sprintf(page, _fmt_out, _value); \ 200 return sprintf(page, _fmt_out, _value); \
201} \ 201} \
202static ssize_t sys_##_prefix##_##_name##_store(struct subsystem *subsys,\ 202static ssize_t sys_##_prefix##_##_name##_store(struct kset *kset, \
203 const char *buf, size_t len) \ 203 const char *buf, size_t len) \
204{ \ 204{ \
205 if (sscanf(buf, _fmt_in, _value) != 1) \ 205 if (sscanf(buf, _fmt_in, _value) != 1) \
@@ -272,14 +272,14 @@ void __init setup_ipl_info(void)
272struct ipl_info ipl_info; 272struct ipl_info ipl_info;
273EXPORT_SYMBOL_GPL(ipl_info); 273EXPORT_SYMBOL_GPL(ipl_info);
274 274
275static ssize_t ipl_type_show(struct subsystem *subsys, char *page) 275static ssize_t ipl_type_show(struct kset *kset, char *page)
276{ 276{
277 return sprintf(page, "%s\n", ipl_type_str(ipl_info.type)); 277 return sprintf(page, "%s\n", ipl_type_str(ipl_info.type));
278} 278}
279 279
280static struct subsys_attribute sys_ipl_type_attr = __ATTR_RO(ipl_type); 280static struct subsys_attribute sys_ipl_type_attr = __ATTR_RO(ipl_type);
281 281
282static ssize_t sys_ipl_device_show(struct subsystem *subsys, char *page) 282static ssize_t sys_ipl_device_show(struct kset *kset, char *page)
283{ 283{
284 struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START; 284 struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START;
285 285
@@ -371,7 +371,7 @@ static struct attribute_group ipl_fcp_attr_group = {
371 371
372/* CCW ipl device attributes */ 372/* CCW ipl device attributes */
373 373
374static ssize_t ipl_ccw_loadparm_show(struct subsystem *subsys, char *page) 374static ssize_t ipl_ccw_loadparm_show(struct kset *kset, char *page)
375{ 375{
376 char loadparm[LOADPARM_LEN + 1] = {}; 376 char loadparm[LOADPARM_LEN + 1] = {};
377 377
@@ -469,7 +469,7 @@ static void reipl_get_ascii_loadparm(char *loadparm)
469 strstrip(loadparm); 469 strstrip(loadparm);
470} 470}
471 471
472static ssize_t reipl_ccw_loadparm_show(struct subsystem *subsys, char *page) 472static ssize_t reipl_ccw_loadparm_show(struct kset *kset, char *page)
473{ 473{
474 char buf[LOADPARM_LEN + 1]; 474 char buf[LOADPARM_LEN + 1];
475 475
@@ -477,7 +477,7 @@ static ssize_t reipl_ccw_loadparm_show(struct subsystem *subsys, char *page)
477 return sprintf(page, "%s\n", buf); 477 return sprintf(page, "%s\n", buf);
478} 478}
479 479
480static ssize_t reipl_ccw_loadparm_store(struct subsystem *subsys, 480static ssize_t reipl_ccw_loadparm_store(struct kset *kset,
481 const char *buf, size_t len) 481 const char *buf, size_t len)
482{ 482{
483 int i, lp_len; 483 int i, lp_len;
@@ -572,12 +572,12 @@ static int reipl_set_type(enum ipl_type type)
572 return 0; 572 return 0;
573} 573}
574 574
575static ssize_t reipl_type_show(struct subsystem *subsys, char *page) 575static ssize_t reipl_type_show(struct kset *kset, char *page)
576{ 576{
577 return sprintf(page, "%s\n", ipl_type_str(reipl_type)); 577 return sprintf(page, "%s\n", ipl_type_str(reipl_type));
578} 578}
579 579
580static ssize_t reipl_type_store(struct subsystem *subsys, const char *buf, 580static ssize_t reipl_type_store(struct kset *kset, const char *buf,
581 size_t len) 581 size_t len)
582{ 582{
583 int rc = -EINVAL; 583 int rc = -EINVAL;
@@ -665,12 +665,12 @@ static int dump_set_type(enum dump_type type)
665 return 0; 665 return 0;
666} 666}
667 667
668static ssize_t dump_type_show(struct subsystem *subsys, char *page) 668static ssize_t dump_type_show(struct kset *kset, char *page)
669{ 669{
670 return sprintf(page, "%s\n", dump_type_str(dump_type)); 670 return sprintf(page, "%s\n", dump_type_str(dump_type));
671} 671}
672 672
673static ssize_t dump_type_store(struct subsystem *subsys, const char *buf, 673static ssize_t dump_type_store(struct kset *kset, const char *buf,
674 size_t len) 674 size_t len)
675{ 675{
676 int rc = -EINVAL; 676 int rc = -EINVAL;
@@ -697,12 +697,12 @@ static decl_subsys(shutdown_actions, NULL, NULL);
697 697
698/* on panic */ 698/* on panic */
699 699
700static ssize_t on_panic_show(struct subsystem *subsys, char *page) 700static ssize_t on_panic_show(struct kset *kset, char *page)
701{ 701{
702 return sprintf(page, "%s\n", shutdown_action_str(on_panic_action)); 702 return sprintf(page, "%s\n", shutdown_action_str(on_panic_action));
703} 703}
704 704
705static ssize_t on_panic_store(struct subsystem *subsys, const char *buf, 705static ssize_t on_panic_store(struct kset *kset, const char *buf,
706 size_t len) 706 size_t len)
707{ 707{
708 if (strncmp(buf, SHUTDOWN_REIPL_STR, strlen(SHUTDOWN_REIPL_STR)) == 0) 708 if (strncmp(buf, SHUTDOWN_REIPL_STR, strlen(SHUTDOWN_REIPL_STR)) == 0)
diff --git a/block/genhd.c b/block/genhd.c
index 441432a142f2..b5664440896c 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -17,7 +17,7 @@
17#include <linux/buffer_head.h> 17#include <linux/buffer_head.h>
18#include <linux/mutex.h> 18#include <linux/mutex.h>
19 19
20struct subsystem block_subsys; 20struct kset block_subsys;
21static DEFINE_MUTEX(block_subsys_lock); 21static DEFINE_MUTEX(block_subsys_lock);
22 22
23/* 23/*
@@ -221,7 +221,7 @@ static void *part_start(struct seq_file *part, loff_t *pos)
221 loff_t l = *pos; 221 loff_t l = *pos;
222 222
223 mutex_lock(&block_subsys_lock); 223 mutex_lock(&block_subsys_lock);
224 list_for_each(p, &block_subsys.kset.list) 224 list_for_each(p, &block_subsys.list)
225 if (!l--) 225 if (!l--)
226 return list_entry(p, struct gendisk, kobj.entry); 226 return list_entry(p, struct gendisk, kobj.entry);
227 return NULL; 227 return NULL;
@@ -231,7 +231,7 @@ static void *part_next(struct seq_file *part, void *v, loff_t *pos)
231{ 231{
232 struct list_head *p = ((struct gendisk *)v)->kobj.entry.next; 232 struct list_head *p = ((struct gendisk *)v)->kobj.entry.next;
233 ++*pos; 233 ++*pos;
234 return p==&block_subsys.kset.list ? NULL : 234 return p==&block_subsys.list ? NULL :
235 list_entry(p, struct gendisk, kobj.entry); 235 list_entry(p, struct gendisk, kobj.entry);
236} 236}
237 237
@@ -246,7 +246,7 @@ static int show_partition(struct seq_file *part, void *v)
246 int n; 246 int n;
247 char buf[BDEVNAME_SIZE]; 247 char buf[BDEVNAME_SIZE];
248 248
249 if (&sgp->kobj.entry == block_subsys.kset.list.next) 249 if (&sgp->kobj.entry == block_subsys.list.next)
250 seq_puts(part, "major minor #blocks name\n\n"); 250 seq_puts(part, "major minor #blocks name\n\n");
251 251
252 /* Don't show non-partitionable removeable devices or empty devices */ 252 /* Don't show non-partitionable removeable devices or empty devices */
@@ -565,7 +565,7 @@ static void *diskstats_start(struct seq_file *part, loff_t *pos)
565 struct list_head *p; 565 struct list_head *p;
566 566
567 mutex_lock(&block_subsys_lock); 567 mutex_lock(&block_subsys_lock);
568 list_for_each(p, &block_subsys.kset.list) 568 list_for_each(p, &block_subsys.list)
569 if (!k--) 569 if (!k--)
570 return list_entry(p, struct gendisk, kobj.entry); 570 return list_entry(p, struct gendisk, kobj.entry);
571 return NULL; 571 return NULL;
@@ -575,7 +575,7 @@ static void *diskstats_next(struct seq_file *part, void *v, loff_t *pos)
575{ 575{
576 struct list_head *p = ((struct gendisk *)v)->kobj.entry.next; 576 struct list_head *p = ((struct gendisk *)v)->kobj.entry.next;
577 ++*pos; 577 ++*pos;
578 return p==&block_subsys.kset.list ? NULL : 578 return p==&block_subsys.list ? NULL :
579 list_entry(p, struct gendisk, kobj.entry); 579 list_entry(p, struct gendisk, kobj.entry);
580} 580}
581 581
diff --git a/drivers/base/base.h b/drivers/base/base.h
index d597f2659b23..5512d84452f2 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -45,3 +45,5 @@ struct class_device_attribute *to_class_dev_attr(struct attribute *_attr)
45extern char *make_class_name(const char *name, struct kobject *kobj); 45extern char *make_class_name(const char *name, struct kobject *kobj);
46 46
47extern void devres_release_all(struct device *dev); 47extern void devres_release_all(struct device *dev);
48
49extern struct kset devices_subsys;
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 1d76e2349654..dca734819e50 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -17,7 +17,7 @@
17#include "power/power.h" 17#include "power/power.h"
18 18
19#define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr) 19#define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr)
20#define to_bus(obj) container_of(obj, struct bus_type, subsys.kset.kobj) 20#define to_bus(obj) container_of(obj, struct bus_type, subsys.kobj)
21 21
22/* 22/*
23 * sysfs bindings for drivers 23 * sysfs bindings for drivers
@@ -123,7 +123,7 @@ int bus_create_file(struct bus_type * bus, struct bus_attribute * attr)
123{ 123{
124 int error; 124 int error;
125 if (get_bus(bus)) { 125 if (get_bus(bus)) {
126 error = sysfs_create_file(&bus->subsys.kset.kobj, &attr->attr); 126 error = sysfs_create_file(&bus->subsys.kobj, &attr->attr);
127 put_bus(bus); 127 put_bus(bus);
128 } else 128 } else
129 error = -EINVAL; 129 error = -EINVAL;
@@ -133,7 +133,7 @@ int bus_create_file(struct bus_type * bus, struct bus_attribute * attr)
133void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr) 133void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr)
134{ 134{
135 if (get_bus(bus)) { 135 if (get_bus(bus)) {
136 sysfs_remove_file(&bus->subsys.kset.kobj, &attr->attr); 136 sysfs_remove_file(&bus->subsys.kobj, &attr->attr);
137 put_bus(bus); 137 put_bus(bus);
138 } 138 }
139} 139}
@@ -397,7 +397,7 @@ static void device_remove_attrs(struct bus_type * bus, struct device * dev)
397static int make_deprecated_bus_links(struct device *dev) 397static int make_deprecated_bus_links(struct device *dev)
398{ 398{
399 return sysfs_create_link(&dev->kobj, 399 return sysfs_create_link(&dev->kobj,
400 &dev->bus->subsys.kset.kobj, "bus"); 400 &dev->bus->subsys.kobj, "bus");
401} 401}
402 402
403static void remove_deprecated_bus_links(struct device *dev) 403static void remove_deprecated_bus_links(struct device *dev)
@@ -431,7 +431,7 @@ int bus_add_device(struct device * dev)
431 if (error) 431 if (error)
432 goto out_id; 432 goto out_id;
433 error = sysfs_create_link(&dev->kobj, 433 error = sysfs_create_link(&dev->kobj,
434 &dev->bus->subsys.kset.kobj, "subsystem"); 434 &dev->bus->subsys.kobj, "subsystem");
435 if (error) 435 if (error)
436 goto out_subsys; 436 goto out_subsys;
437 error = make_deprecated_bus_links(dev); 437 error = make_deprecated_bus_links(dev);
@@ -810,7 +810,7 @@ int bus_register(struct bus_type * bus)
810 810
811 BLOCKING_INIT_NOTIFIER_HEAD(&bus->bus_notifier); 811 BLOCKING_INIT_NOTIFIER_HEAD(&bus->bus_notifier);
812 812
813 retval = kobject_set_name(&bus->subsys.kset.kobj, "%s", bus->name); 813 retval = kobject_set_name(&bus->subsys.kobj, "%s", bus->name);
814 if (retval) 814 if (retval)
815 goto out; 815 goto out;
816 816
@@ -820,13 +820,13 @@ int bus_register(struct bus_type * bus)
820 goto out; 820 goto out;
821 821
822 kobject_set_name(&bus->devices.kobj, "devices"); 822 kobject_set_name(&bus->devices.kobj, "devices");
823 bus->devices.subsys = &bus->subsys; 823 bus->devices.kobj.parent = &bus->subsys.kobj;
824 retval = kset_register(&bus->devices); 824 retval = kset_register(&bus->devices);
825 if (retval) 825 if (retval)
826 goto bus_devices_fail; 826 goto bus_devices_fail;
827 827
828 kobject_set_name(&bus->drivers.kobj, "drivers"); 828 kobject_set_name(&bus->drivers.kobj, "drivers");
829 bus->drivers.subsys = &bus->subsys; 829 bus->drivers.kobj.parent = &bus->subsys.kobj;
830 bus->drivers.ktype = &ktype_driver; 830 bus->drivers.ktype = &ktype_driver;
831 retval = kset_register(&bus->drivers); 831 retval = kset_register(&bus->drivers);
832 if (retval) 832 if (retval)
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 80bbb2074636..20c4ea6eb50d 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -19,10 +19,8 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include "base.h" 20#include "base.h"
21 21
22extern struct subsystem devices_subsys;
23
24#define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr) 22#define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr)
25#define to_class(obj) container_of(obj, struct class, subsys.kset.kobj) 23#define to_class(obj) container_of(obj, struct class, subsys.kobj)
26 24
27static ssize_t 25static ssize_t
28class_attr_show(struct kobject * kobj, struct attribute * attr, char * buf) 26class_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
@@ -80,7 +78,7 @@ int class_create_file(struct class * cls, const struct class_attribute * attr)
80{ 78{
81 int error; 79 int error;
82 if (cls) { 80 if (cls) {
83 error = sysfs_create_file(&cls->subsys.kset.kobj, &attr->attr); 81 error = sysfs_create_file(&cls->subsys.kobj, &attr->attr);
84 } else 82 } else
85 error = -EINVAL; 83 error = -EINVAL;
86 return error; 84 return error;
@@ -89,7 +87,7 @@ int class_create_file(struct class * cls, const struct class_attribute * attr)
89void class_remove_file(struct class * cls, const struct class_attribute * attr) 87void class_remove_file(struct class * cls, const struct class_attribute * attr)
90{ 88{
91 if (cls) 89 if (cls)
92 sysfs_remove_file(&cls->subsys.kset.kobj, &attr->attr); 90 sysfs_remove_file(&cls->subsys.kobj, &attr->attr);
93} 91}
94 92
95static struct class *class_get(struct class *cls) 93static struct class *class_get(struct class *cls)
@@ -147,7 +145,7 @@ int class_register(struct class * cls)
147 INIT_LIST_HEAD(&cls->interfaces); 145 INIT_LIST_HEAD(&cls->interfaces);
148 kset_init(&cls->class_dirs); 146 kset_init(&cls->class_dirs);
149 init_MUTEX(&cls->sem); 147 init_MUTEX(&cls->sem);
150 error = kobject_set_name(&cls->subsys.kset.kobj, "%s", cls->name); 148 error = kobject_set_name(&cls->subsys.kobj, "%s", cls->name);
151 if (error) 149 if (error)
152 return error; 150 return error;
153 151
@@ -611,7 +609,7 @@ int class_device_add(struct class_device *class_dev)
611 if (parent_class_dev) 609 if (parent_class_dev)
612 class_dev->kobj.parent = &parent_class_dev->kobj; 610 class_dev->kobj.parent = &parent_class_dev->kobj;
613 else 611 else
614 class_dev->kobj.parent = &parent_class->subsys.kset.kobj; 612 class_dev->kobj.parent = &parent_class->subsys.kobj;
615 613
616 error = kobject_add(&class_dev->kobj); 614 error = kobject_add(&class_dev->kobj);
617 if (error) 615 if (error)
@@ -619,7 +617,7 @@ int class_device_add(struct class_device *class_dev)
619 617
620 /* add the needed attributes to this device */ 618 /* add the needed attributes to this device */
621 error = sysfs_create_link(&class_dev->kobj, 619 error = sysfs_create_link(&class_dev->kobj,
622 &parent_class->subsys.kset.kobj, "subsystem"); 620 &parent_class->subsys.kobj, "subsystem");
623 if (error) 621 if (error)
624 goto out3; 622 goto out3;
625 class_dev->uevent_attr.attr.name = "uevent"; 623 class_dev->uevent_attr.attr.name = "uevent";
@@ -917,8 +915,8 @@ int __init classes_init(void)
917 /* ick, this is ugly, the things we go through to keep from showing up 915 /* ick, this is ugly, the things we go through to keep from showing up
918 * in sysfs... */ 916 * in sysfs... */
919 subsystem_init(&class_obj_subsys); 917 subsystem_init(&class_obj_subsys);
920 if (!class_obj_subsys.kset.subsys) 918 if (!class_obj_subsys.kobj.parent)
921 class_obj_subsys.kset.subsys = &class_obj_subsys; 919 class_obj_subsys.kobj.parent = &class_obj_subsys.kobj;
922 return 0; 920 return 0;
923} 921}
924 922
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 59d9816c332e..b78fc1e68264 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -565,7 +565,7 @@ static struct kobject * get_device_parent(struct device *dev,
565 /* Set the parent to the class, not the parent device */ 565 /* Set the parent to the class, not the parent device */
566 /* this keeps sysfs from having a symlink to make old udevs happy */ 566 /* this keeps sysfs from having a symlink to make old udevs happy */
567 if (dev->class) 567 if (dev->class)
568 return &dev->class->subsys.kset.kobj; 568 return &dev->class->subsys.kobj;
569 else if (parent) 569 else if (parent)
570 return &parent->kobj; 570 return &parent->kobj;
571 571
@@ -577,7 +577,7 @@ static struct kobject *virtual_device_parent(struct device *dev)
577 static struct kobject *virtual_dir = NULL; 577 static struct kobject *virtual_dir = NULL;
578 578
579 if (!virtual_dir) 579 if (!virtual_dir)
580 virtual_dir = kobject_add_dir(&devices_subsys.kset.kobj, "virtual"); 580 virtual_dir = kobject_add_dir(&devices_subsys.kobj, "virtual");
581 581
582 return virtual_dir; 582 return virtual_dir;
583} 583}
@@ -711,12 +711,12 @@ int device_add(struct device *dev)
711 } 711 }
712 712
713 if (dev->class) { 713 if (dev->class) {
714 sysfs_create_link(&dev->kobj, &dev->class->subsys.kset.kobj, 714 sysfs_create_link(&dev->kobj, &dev->class->subsys.kobj,
715 "subsystem"); 715 "subsystem");
716 /* If this is not a "fake" compatible device, then create the 716 /* If this is not a "fake" compatible device, then create the
717 * symlink from the class to the device. */ 717 * symlink from the class to the device. */
718 if (dev->kobj.parent != &dev->class->subsys.kset.kobj) 718 if (dev->kobj.parent != &dev->class->subsys.kobj)
719 sysfs_create_link(&dev->class->subsys.kset.kobj, 719 sysfs_create_link(&dev->class->subsys.kobj,
720 &dev->kobj, dev->bus_id); 720 &dev->kobj, dev->bus_id);
721 if (parent) { 721 if (parent) {
722 sysfs_create_link(&dev->kobj, &dev->parent->kobj, 722 sysfs_create_link(&dev->kobj, &dev->parent->kobj,
@@ -774,8 +774,8 @@ int device_add(struct device *dev)
774 sysfs_remove_link(&dev->kobj, "subsystem"); 774 sysfs_remove_link(&dev->kobj, "subsystem");
775 /* If this is not a "fake" compatible device, remove the 775 /* If this is not a "fake" compatible device, remove the
776 * symlink from the class to the device. */ 776 * symlink from the class to the device. */
777 if (dev->kobj.parent != &dev->class->subsys.kset.kobj) 777 if (dev->kobj.parent != &dev->class->subsys.kobj)
778 sysfs_remove_link(&dev->class->subsys.kset.kobj, 778 sysfs_remove_link(&dev->class->subsys.kobj,
779 dev->bus_id); 779 dev->bus_id);
780 if (parent) { 780 if (parent) {
781#ifdef CONFIG_SYSFS_DEPRECATED 781#ifdef CONFIG_SYSFS_DEPRECATED
@@ -875,8 +875,8 @@ void device_del(struct device * dev)
875 sysfs_remove_link(&dev->kobj, "subsystem"); 875 sysfs_remove_link(&dev->kobj, "subsystem");
876 /* If this is not a "fake" compatible device, remove the 876 /* If this is not a "fake" compatible device, remove the
877 * symlink from the class to the device. */ 877 * symlink from the class to the device. */
878 if (dev->kobj.parent != &dev->class->subsys.kset.kobj) 878 if (dev->kobj.parent != &dev->class->subsys.kobj)
879 sysfs_remove_link(&dev->class->subsys.kset.kobj, 879 sysfs_remove_link(&dev->class->subsys.kobj,
880 dev->bus_id); 880 dev->bus_id);
881 if (parent) { 881 if (parent) {
882#ifdef CONFIG_SYSFS_DEPRECATED 882#ifdef CONFIG_SYSFS_DEPRECATED
@@ -1192,9 +1192,9 @@ int device_rename(struct device *dev, char *new_name)
1192#endif 1192#endif
1193 1193
1194 if (dev->class) { 1194 if (dev->class) {
1195 sysfs_remove_link(&dev->class->subsys.kset.kobj, 1195 sysfs_remove_link(&dev->class->subsys.kobj,
1196 old_symlink_name); 1196 old_symlink_name);
1197 sysfs_create_link(&dev->class->subsys.kset.kobj, &dev->kobj, 1197 sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj,
1198 dev->bus_id); 1198 dev->bus_id);
1199 } 1199 }
1200 put_device(dev); 1200 put_device(dev);
diff --git a/drivers/base/firmware.c b/drivers/base/firmware.c
index cb1b98ae0d58..90c862932169 100644
--- a/drivers/base/firmware.c
+++ b/drivers/base/firmware.c
@@ -17,13 +17,13 @@
17 17
18static decl_subsys(firmware, NULL, NULL); 18static decl_subsys(firmware, NULL, NULL);
19 19
20int firmware_register(struct subsystem * s) 20int firmware_register(struct kset *s)
21{ 21{
22 kset_set_kset_s(s, firmware_subsys); 22 kobj_set_kset_s(s, firmware_subsys);
23 return subsystem_register(s); 23 return subsystem_register(s);
24} 24}
25 25
26void firmware_unregister(struct subsystem * s) 26void firmware_unregister(struct kset *s)
27{ 27{
28 subsystem_unregister(s); 28 subsystem_unregister(s);
29} 29}
diff --git a/drivers/base/power/shutdown.c b/drivers/base/power/shutdown.c
index 58b6f77a1b34..a47ee1b70d20 100644
--- a/drivers/base/power/shutdown.c
+++ b/drivers/base/power/shutdown.c
@@ -16,8 +16,6 @@
16 16
17#define to_dev(node) container_of(node, struct device, kobj.entry) 17#define to_dev(node) container_of(node, struct device, kobj.entry)
18 18
19extern struct subsystem devices_subsys;
20
21 19
22/** 20/**
23 * We handle system devices differently - we suspend and shut them 21 * We handle system devices differently - we suspend and shut them
@@ -36,7 +34,7 @@ void device_shutdown(void)
36{ 34{
37 struct device * dev, *devn; 35 struct device * dev, *devn;
38 36
39 list_for_each_entry_safe_reverse(dev, devn, &devices_subsys.kset.list, 37 list_for_each_entry_safe_reverse(dev, devn, &devices_subsys.list,
40 kobj.entry) { 38 kobj.entry) {
41 if (dev->bus && dev->bus->shutdown) { 39 if (dev->bus && dev->bus->shutdown) {
42 dev_dbg(dev, "shutdown\n"); 40 dev_dbg(dev, "shutdown\n");
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 04e5db445c74..29f1291966c1 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -25,7 +25,7 @@
25 25
26#include "base.h" 26#include "base.h"
27 27
28extern struct subsystem devices_subsys; 28extern struct kset devices_subsys;
29 29
30#define to_sysdev(k) container_of(k, struct sys_device, kobj) 30#define to_sysdev(k) container_of(k, struct sys_device, kobj)
31#define to_sysdev_attr(a) container_of(a, struct sysdev_attribute, attr) 31#define to_sysdev_attr(a) container_of(a, struct sysdev_attribute, attr)
@@ -138,7 +138,7 @@ int sysdev_class_register(struct sysdev_class * cls)
138 pr_debug("Registering sysdev class '%s'\n", 138 pr_debug("Registering sysdev class '%s'\n",
139 kobject_name(&cls->kset.kobj)); 139 kobject_name(&cls->kset.kobj));
140 INIT_LIST_HEAD(&cls->drivers); 140 INIT_LIST_HEAD(&cls->drivers);
141 cls->kset.subsys = &system_subsys; 141 cls->kset.kobj.parent = &system_subsys.kobj;
142 kset_set_kset_s(cls, system_subsys); 142 kset_set_kset_s(cls, system_subsys);
143 return kset_register(&cls->kset); 143 return kset_register(&cls->kset);
144} 144}
@@ -309,7 +309,7 @@ void sysdev_shutdown(void)
309 pr_debug("Shutting Down System Devices\n"); 309 pr_debug("Shutting Down System Devices\n");
310 310
311 down(&sysdev_drivers_lock); 311 down(&sysdev_drivers_lock);
312 list_for_each_entry_reverse(cls, &system_subsys.kset.list, 312 list_for_each_entry_reverse(cls, &system_subsys.list,
313 kset.kobj.entry) { 313 kset.kobj.entry) {
314 struct sys_device * sysdev; 314 struct sys_device * sysdev;
315 315
@@ -384,7 +384,7 @@ int sysdev_suspend(pm_message_t state)
384 384
385 pr_debug("Suspending System Devices\n"); 385 pr_debug("Suspending System Devices\n");
386 386
387 list_for_each_entry_reverse(cls, &system_subsys.kset.list, 387 list_for_each_entry_reverse(cls, &system_subsys.list,
388 kset.kobj.entry) { 388 kset.kobj.entry) {
389 389
390 pr_debug("Suspending type '%s':\n", 390 pr_debug("Suspending type '%s':\n",
@@ -457,7 +457,7 @@ gbl_driver:
457 } 457 }
458 458
459 /* resume other classes */ 459 /* resume other classes */
460 list_for_each_entry_continue(cls, &system_subsys.kset.list, 460 list_for_each_entry_continue(cls, &system_subsys.list,
461 kset.kobj.entry) { 461 kset.kobj.entry) {
462 list_for_each_entry(err_dev, &cls->kset.list, kobj.entry) { 462 list_for_each_entry(err_dev, &cls->kset.list, kobj.entry) {
463 pr_debug(" %s\n", kobject_name(&err_dev->kobj)); 463 pr_debug(" %s\n", kobject_name(&err_dev->kobj));
@@ -483,7 +483,7 @@ int sysdev_resume(void)
483 483
484 pr_debug("Resuming System Devices\n"); 484 pr_debug("Resuming System Devices\n");
485 485
486 list_for_each_entry(cls, &system_subsys.kset.list, kset.kobj.entry) { 486 list_for_each_entry(cls, &system_subsys.list, kset.kobj.entry) {
487 struct sys_device * sysdev; 487 struct sys_device * sysdev;
488 488
489 pr_debug("Resuming type '%s':\n", 489 pr_debug("Resuming type '%s':\n",
@@ -501,7 +501,7 @@ int sysdev_resume(void)
501 501
502int __init system_bus_init(void) 502int __init system_bus_init(void)
503{ 503{
504 system_subsys.kset.kobj.parent = &devices_subsys.kset.kobj; 504 system_subsys.kobj.parent = &devices_subsys.kobj;
505 return subsystem_register(&system_subsys); 505 return subsystem_register(&system_subsys);
506} 506}
507 507
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index c6281ccd4fe7..1324984a4c35 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -409,7 +409,7 @@ static struct kobj_type ktype_efivar = {
409}; 409};
410 410
411static ssize_t 411static ssize_t
412dummy(struct subsystem *sub, char *buf) 412dummy(struct kset *kset, char *buf)
413{ 413{
414 return -ENODEV; 414 return -ENODEV;
415} 415}
@@ -422,7 +422,7 @@ efivar_unregister(struct efivar_entry *var)
422 422
423 423
424static ssize_t 424static ssize_t
425efivar_create(struct subsystem *sub, const char *buf, size_t count) 425efivar_create(struct kset *kset, const char *buf, size_t count)
426{ 426{
427 struct efi_variable *new_var = (struct efi_variable *)buf; 427 struct efi_variable *new_var = (struct efi_variable *)buf;
428 struct efivar_entry *search_efivar, *n; 428 struct efivar_entry *search_efivar, *n;
@@ -480,7 +480,7 @@ efivar_create(struct subsystem *sub, const char *buf, size_t count)
480} 480}
481 481
482static ssize_t 482static ssize_t
483efivar_delete(struct subsystem *sub, const char *buf, size_t count) 483efivar_delete(struct kset *kset, const char *buf, size_t count)
484{ 484{
485 struct efi_variable *del_var = (struct efi_variable *)buf; 485 struct efi_variable *del_var = (struct efi_variable *)buf;
486 struct efivar_entry *search_efivar, *n; 486 struct efivar_entry *search_efivar, *n;
@@ -551,11 +551,11 @@ static struct subsys_attribute *var_subsys_attrs[] = {
551 * the efivars driver 551 * the efivars driver
552 */ 552 */
553static ssize_t 553static ssize_t
554systab_read(struct subsystem *entry, char *buf) 554systab_read(struct kset *kset, char *buf)
555{ 555{
556 char *str = buf; 556 char *str = buf;
557 557
558 if (!entry || !buf) 558 if (!kset || !buf)
559 return -EINVAL; 559 return -EINVAL;
560 560
561 if (efi.mps != EFI_INVALID_TABLE_ADDR) 561 if (efi.mps != EFI_INVALID_TABLE_ADDR)
@@ -687,7 +687,7 @@ efivars_init(void)
687 goto out_free; 687 goto out_free;
688 } 688 }
689 689
690 kset_set_kset_s(&vars_subsys, efi_subsys); 690 kobj_set_kset_s(&vars_subsys, efi_subsys);
691 691
692 error = subsystem_register(&vars_subsys); 692 error = subsystem_register(&vars_subsys);
693 693
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 6439f378f6cc..6e55b2c5874e 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -650,7 +650,7 @@ static struct input_handle *evdev_connect(struct input_handler *handler, struct
650 dev->cdev.dev, evdev->name); 650 dev->cdev.dev, evdev->name);
651 651
652 /* temporary symlink to keep userspace happy */ 652 /* temporary symlink to keep userspace happy */
653 sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, 653 sysfs_create_link(&input_class.subsys.kobj, &cdev->kobj,
654 evdev->name); 654 evdev->name);
655 655
656 return &evdev->handle; 656 return &evdev->handle;
@@ -661,7 +661,7 @@ static void evdev_disconnect(struct input_handle *handle)
661 struct evdev *evdev = handle->private; 661 struct evdev *evdev = handle->private;
662 struct evdev_list *list; 662 struct evdev_list *list;
663 663
664 sysfs_remove_link(&input_class.subsys.kset.kobj, evdev->name); 664 sysfs_remove_link(&input_class.subsys.kobj, evdev->name);
665 class_device_destroy(&input_class, 665 class_device_destroy(&input_class,
666 MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor)); 666 MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor));
667 evdev->exist = 0; 667 evdev->exist = 0;
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 9f3529ad3fda..d2482e4f71be 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -539,7 +539,7 @@ static struct input_handle *joydev_connect(struct input_handler *handler, struct
539 dev->cdev.dev, joydev->name); 539 dev->cdev.dev, joydev->name);
540 540
541 /* temporary symlink to keep userspace happy */ 541 /* temporary symlink to keep userspace happy */
542 sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, 542 sysfs_create_link(&input_class.subsys.kobj, &cdev->kobj,
543 joydev->name); 543 joydev->name);
544 544
545 return &joydev->handle; 545 return &joydev->handle;
@@ -550,7 +550,7 @@ static void joydev_disconnect(struct input_handle *handle)
550 struct joydev *joydev = handle->private; 550 struct joydev *joydev = handle->private;
551 struct joydev_list *list; 551 struct joydev_list *list;
552 552
553 sysfs_remove_link(&input_class.subsys.kset.kobj, joydev->name); 553 sysfs_remove_link(&input_class.subsys.kobj, joydev->name);
554 class_device_destroy(&input_class, MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor)); 554 class_device_destroy(&input_class, MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor));
555 joydev->exist = 0; 555 joydev->exist = 0;
556 556
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index 664bcc8116fc..074fee429d1b 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -661,7 +661,7 @@ static struct input_handle *mousedev_connect(struct input_handler *handler, stru
661 dev->cdev.dev, mousedev->name); 661 dev->cdev.dev, mousedev->name);
662 662
663 /* temporary symlink to keep userspace happy */ 663 /* temporary symlink to keep userspace happy */
664 sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, 664 sysfs_create_link(&input_class.subsys.kobj, &cdev->kobj,
665 mousedev->name); 665 mousedev->name);
666 666
667 return &mousedev->handle; 667 return &mousedev->handle;
@@ -672,7 +672,7 @@ static void mousedev_disconnect(struct input_handle *handle)
672 struct mousedev *mousedev = handle->private; 672 struct mousedev *mousedev = handle->private;
673 struct mousedev_list *list; 673 struct mousedev_list *list;
674 674
675 sysfs_remove_link(&input_class.subsys.kset.kobj, mousedev->name); 675 sysfs_remove_link(&input_class.subsys.kobj, mousedev->name);
676 class_device_destroy(&input_class, 676 class_device_destroy(&input_class,
677 MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor)); 677 MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor));
678 mousedev->exist = 0; 678 mousedev->exist = 0;
diff --git a/drivers/input/tsdev.c b/drivers/input/tsdev.c
index 0300dca8591d..05dfc10bc079 100644
--- a/drivers/input/tsdev.c
+++ b/drivers/input/tsdev.c
@@ -420,7 +420,7 @@ static struct input_handle *tsdev_connect(struct input_handler *handler,
420 dev->cdev.dev, tsdev->name); 420 dev->cdev.dev, tsdev->name);
421 421
422 /* temporary symlink to keep userspace happy */ 422 /* temporary symlink to keep userspace happy */
423 sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, 423 sysfs_create_link(&input_class.subsys.kobj, &cdev->kobj,
424 tsdev->name); 424 tsdev->name);
425 425
426 return &tsdev->handle; 426 return &tsdev->handle;
@@ -431,7 +431,7 @@ static void tsdev_disconnect(struct input_handle *handle)
431 struct tsdev *tsdev = handle->private; 431 struct tsdev *tsdev = handle->private;
432 struct tsdev_list *list; 432 struct tsdev_list *list;
433 433
434 sysfs_remove_link(&input_class.subsys.kset.kobj, tsdev->name); 434 sysfs_remove_link(&input_class.subsys.kobj, tsdev->name);
435 class_device_destroy(&input_class, 435 class_device_destroy(&input_class,
436 MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + tsdev->minor)); 436 MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + tsdev->minor));
437 tsdev->exist = 0; 437 tsdev->exist = 0;
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
index ea1b7a63598e..815e445c3125 100644
--- a/drivers/parisc/pdc_stable.c
+++ b/drivers/parisc/pdc_stable.c
@@ -520,17 +520,17 @@ static struct pdcspath_entry *pdcspath_entries[] = {
520 520
521/** 521/**
522 * pdcs_size_read - Stable Storage size output. 522 * pdcs_size_read - Stable Storage size output.
523 * @entry: An allocated and populated subsytem struct. We don't use it tho. 523 * @kset: An allocated and populated struct kset. We don't use it tho.
524 * @buf: The output buffer to write to. 524 * @buf: The output buffer to write to.
525 */ 525 */
526static ssize_t 526static ssize_t
527pdcs_size_read(struct subsystem *entry, char *buf) 527pdcs_size_read(struct kset *kset, char *buf)
528{ 528{
529 char *out = buf; 529 char *out = buf;
530 530
531 if (!entry || !buf) 531 if (!kset || !buf)
532 return -EINVAL; 532 return -EINVAL;
533 533
534 /* show the size of the stable storage */ 534 /* show the size of the stable storage */
535 out += sprintf(out, "%ld\n", pdcs_size); 535 out += sprintf(out, "%ld\n", pdcs_size);
536 536
@@ -539,17 +539,17 @@ pdcs_size_read(struct subsystem *entry, char *buf)
539 539
540/** 540/**
541 * pdcs_auto_read - Stable Storage autoboot/search flag output. 541 * pdcs_auto_read - Stable Storage autoboot/search flag output.
542 * @entry: An allocated and populated subsytem struct. We don't use it tho. 542 * @kset: An allocated and populated struct kset. We don't use it tho.
543 * @buf: The output buffer to write to. 543 * @buf: The output buffer to write to.
544 * @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag 544 * @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag
545 */ 545 */
546static ssize_t 546static ssize_t
547pdcs_auto_read(struct subsystem *entry, char *buf, int knob) 547pdcs_auto_read(struct kset *kset, char *buf, int knob)
548{ 548{
549 char *out = buf; 549 char *out = buf;
550 struct pdcspath_entry *pathentry; 550 struct pdcspath_entry *pathentry;
551 551
552 if (!entry || !buf) 552 if (!kset || !buf)
553 return -EINVAL; 553 return -EINVAL;
554 554
555 /* Current flags are stored in primary boot path entry */ 555 /* Current flags are stored in primary boot path entry */
@@ -565,40 +565,40 @@ pdcs_auto_read(struct subsystem *entry, char *buf, int knob)
565 565
566/** 566/**
567 * pdcs_autoboot_read - Stable Storage autoboot flag output. 567 * pdcs_autoboot_read - Stable Storage autoboot flag output.
568 * @entry: An allocated and populated subsytem struct. We don't use it tho. 568 * @kset: An allocated and populated struct kset. We don't use it tho.
569 * @buf: The output buffer to write to. 569 * @buf: The output buffer to write to.
570 */ 570 */
571static inline ssize_t 571static inline ssize_t
572pdcs_autoboot_read(struct subsystem *entry, char *buf) 572pdcs_autoboot_read(struct kset *kset, char *buf)
573{ 573{
574 return pdcs_auto_read(entry, buf, PF_AUTOBOOT); 574 return pdcs_auto_read(kset, buf, PF_AUTOBOOT);
575} 575}
576 576
577/** 577/**
578 * pdcs_autosearch_read - Stable Storage autoboot flag output. 578 * pdcs_autosearch_read - Stable Storage autoboot flag output.
579 * @entry: An allocated and populated subsytem struct. We don't use it tho. 579 * @kset: An allocated and populated struct kset. We don't use it tho.
580 * @buf: The output buffer to write to. 580 * @buf: The output buffer to write to.
581 */ 581 */
582static inline ssize_t 582static inline ssize_t
583pdcs_autosearch_read(struct subsystem *entry, char *buf) 583pdcs_autosearch_read(struct kset *kset, char *buf)
584{ 584{
585 return pdcs_auto_read(entry, buf, PF_AUTOSEARCH); 585 return pdcs_auto_read(kset, buf, PF_AUTOSEARCH);
586} 586}
587 587
588/** 588/**
589 * pdcs_timer_read - Stable Storage timer count output (in seconds). 589 * pdcs_timer_read - Stable Storage timer count output (in seconds).
590 * @entry: An allocated and populated subsytem struct. We don't use it tho. 590 * @kset: An allocated and populated struct kset. We don't use it tho.
591 * @buf: The output buffer to write to. 591 * @buf: The output buffer to write to.
592 * 592 *
593 * The value of the timer field correponds to a number of seconds in powers of 2. 593 * The value of the timer field correponds to a number of seconds in powers of 2.
594 */ 594 */
595static ssize_t 595static ssize_t
596pdcs_timer_read(struct subsystem *entry, char *buf) 596pdcs_timer_read(struct kset *kset, char *buf)
597{ 597{
598 char *out = buf; 598 char *out = buf;
599 struct pdcspath_entry *pathentry; 599 struct pdcspath_entry *pathentry;
600 600
601 if (!entry || !buf) 601 if (!kset || !buf)
602 return -EINVAL; 602 return -EINVAL;
603 603
604 /* Current flags are stored in primary boot path entry */ 604 /* Current flags are stored in primary boot path entry */
@@ -615,15 +615,15 @@ pdcs_timer_read(struct subsystem *entry, char *buf)
615 615
616/** 616/**
617 * pdcs_osid_read - Stable Storage OS ID register output. 617 * pdcs_osid_read - Stable Storage OS ID register output.
618 * @entry: An allocated and populated subsytem struct. We don't use it tho. 618 * @kset: An allocated and populated struct kset. We don't use it tho.
619 * @buf: The output buffer to write to. 619 * @buf: The output buffer to write to.
620 */ 620 */
621static ssize_t 621static ssize_t
622pdcs_osid_read(struct subsystem *entry, char *buf) 622pdcs_osid_read(struct kset *kset, char *buf)
623{ 623{
624 char *out = buf; 624 char *out = buf;
625 625
626 if (!entry || !buf) 626 if (!kset || !buf)
627 return -EINVAL; 627 return -EINVAL;
628 628
629 out += sprintf(out, "%s dependent data (0x%.4x)\n", 629 out += sprintf(out, "%s dependent data (0x%.4x)\n",
@@ -634,18 +634,18 @@ pdcs_osid_read(struct subsystem *entry, char *buf)
634 634
635/** 635/**
636 * pdcs_osdep1_read - Stable Storage OS-Dependent data area 1 output. 636 * pdcs_osdep1_read - Stable Storage OS-Dependent data area 1 output.
637 * @entry: An allocated and populated subsytem struct. We don't use it tho. 637 * @kset: An allocated and populated struct kset. We don't use it tho.
638 * @buf: The output buffer to write to. 638 * @buf: The output buffer to write to.
639 * 639 *
640 * This can hold 16 bytes of OS-Dependent data. 640 * This can hold 16 bytes of OS-Dependent data.
641 */ 641 */
642static ssize_t 642static ssize_t
643pdcs_osdep1_read(struct subsystem *entry, char *buf) 643pdcs_osdep1_read(struct kset *kset, char *buf)
644{ 644{
645 char *out = buf; 645 char *out = buf;
646 u32 result[4]; 646 u32 result[4];
647 647
648 if (!entry || !buf) 648 if (!kset || !buf)
649 return -EINVAL; 649 return -EINVAL;
650 650
651 if (pdc_stable_read(PDCS_ADDR_OSD1, &result, sizeof(result)) != PDC_OK) 651 if (pdc_stable_read(PDCS_ADDR_OSD1, &result, sizeof(result)) != PDC_OK)
@@ -661,18 +661,18 @@ pdcs_osdep1_read(struct subsystem *entry, char *buf)
661 661
662/** 662/**
663 * pdcs_diagnostic_read - Stable Storage Diagnostic register output. 663 * pdcs_diagnostic_read - Stable Storage Diagnostic register output.
664 * @entry: An allocated and populated subsytem struct. We don't use it tho. 664 * @kset: An allocated and populated struct kset. We don't use it tho.
665 * @buf: The output buffer to write to. 665 * @buf: The output buffer to write to.
666 * 666 *
667 * I have NFC how to interpret the content of that register ;-). 667 * I have NFC how to interpret the content of that register ;-).
668 */ 668 */
669static ssize_t 669static ssize_t
670pdcs_diagnostic_read(struct subsystem *entry, char *buf) 670pdcs_diagnostic_read(struct kset *kset, char *buf)
671{ 671{
672 char *out = buf; 672 char *out = buf;
673 u32 result; 673 u32 result;
674 674
675 if (!entry || !buf) 675 if (!kset || !buf)
676 return -EINVAL; 676 return -EINVAL;
677 677
678 /* get diagnostic */ 678 /* get diagnostic */
@@ -686,18 +686,18 @@ pdcs_diagnostic_read(struct subsystem *entry, char *buf)
686 686
687/** 687/**
688 * pdcs_fastsize_read - Stable Storage FastSize register output. 688 * pdcs_fastsize_read - Stable Storage FastSize register output.
689 * @entry: An allocated and populated subsytem struct. We don't use it tho. 689 * @kset: An allocated and populated struct kset. We don't use it tho.
690 * @buf: The output buffer to write to. 690 * @buf: The output buffer to write to.
691 * 691 *
692 * This register holds the amount of system RAM to be tested during boot sequence. 692 * This register holds the amount of system RAM to be tested during boot sequence.
693 */ 693 */
694static ssize_t 694static ssize_t
695pdcs_fastsize_read(struct subsystem *entry, char *buf) 695pdcs_fastsize_read(struct kset *kset, char *buf)
696{ 696{
697 char *out = buf; 697 char *out = buf;
698 u32 result; 698 u32 result;
699 699
700 if (!entry || !buf) 700 if (!kset || !buf)
701 return -EINVAL; 701 return -EINVAL;
702 702
703 /* get fast-size */ 703 /* get fast-size */
@@ -715,13 +715,13 @@ pdcs_fastsize_read(struct subsystem *entry, char *buf)
715 715
716/** 716/**
717 * pdcs_osdep2_read - Stable Storage OS-Dependent data area 2 output. 717 * pdcs_osdep2_read - Stable Storage OS-Dependent data area 2 output.
718 * @entry: An allocated and populated subsytem struct. We don't use it tho. 718 * @kset: An allocated and populated struct kset. We don't use it tho.
719 * @buf: The output buffer to write to. 719 * @buf: The output buffer to write to.
720 * 720 *
721 * This can hold pdcs_size - 224 bytes of OS-Dependent data, when available. 721 * This can hold pdcs_size - 224 bytes of OS-Dependent data, when available.
722 */ 722 */
723static ssize_t 723static ssize_t
724pdcs_osdep2_read(struct subsystem *entry, char *buf) 724pdcs_osdep2_read(struct kset *kset, char *buf)
725{ 725{
726 char *out = buf; 726 char *out = buf;
727 unsigned long size; 727 unsigned long size;
@@ -733,7 +733,7 @@ pdcs_osdep2_read(struct subsystem *entry, char *buf)
733 733
734 size = pdcs_size - 224; 734 size = pdcs_size - 224;
735 735
736 if (!entry || !buf) 736 if (!kset || !buf)
737 return -EINVAL; 737 return -EINVAL;
738 738
739 for (i=0; i<size; i+=4) { 739 for (i=0; i<size; i+=4) {
@@ -748,7 +748,7 @@ pdcs_osdep2_read(struct subsystem *entry, char *buf)
748 748
749/** 749/**
750 * pdcs_auto_write - This function handles autoboot/search flag modifying. 750 * pdcs_auto_write - This function handles autoboot/search flag modifying.
751 * @entry: An allocated and populated subsytem struct. We don't use it tho. 751 * @kset: An allocated and populated struct kset. We don't use it tho.
752 * @buf: The input buffer to read from. 752 * @buf: The input buffer to read from.
753 * @count: The number of bytes to be read. 753 * @count: The number of bytes to be read.
754 * @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag 754 * @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag
@@ -758,7 +758,7 @@ pdcs_osdep2_read(struct subsystem *entry, char *buf)
758 * \"n\" (n == 0 or 1) to toggle AutoBoot Off or On 758 * \"n\" (n == 0 or 1) to toggle AutoBoot Off or On
759 */ 759 */
760static ssize_t 760static ssize_t
761pdcs_auto_write(struct subsystem *entry, const char *buf, size_t count, int knob) 761pdcs_auto_write(struct kset *kset, const char *buf, size_t count, int knob)
762{ 762{
763 struct pdcspath_entry *pathentry; 763 struct pdcspath_entry *pathentry;
764 unsigned char flags; 764 unsigned char flags;
@@ -768,7 +768,7 @@ pdcs_auto_write(struct subsystem *entry, const char *buf, size_t count, int knob
768 if (!capable(CAP_SYS_ADMIN)) 768 if (!capable(CAP_SYS_ADMIN))
769 return -EACCES; 769 return -EACCES;
770 770
771 if (!entry || !buf || !count) 771 if (!kset || !buf || !count)
772 return -EINVAL; 772 return -EINVAL;
773 773
774 /* We'll use a local copy of buf */ 774 /* We'll use a local copy of buf */
@@ -823,7 +823,7 @@ parse_error:
823 823
824/** 824/**
825 * pdcs_autoboot_write - This function handles autoboot flag modifying. 825 * pdcs_autoboot_write - This function handles autoboot flag modifying.
826 * @entry: An allocated and populated subsytem struct. We don't use it tho. 826 * @kset: An allocated and populated struct kset. We don't use it tho.
827 * @buf: The input buffer to read from. 827 * @buf: The input buffer to read from.
828 * @count: The number of bytes to be read. 828 * @count: The number of bytes to be read.
829 * 829 *
@@ -832,14 +832,14 @@ parse_error:
832 * \"n\" (n == 0 or 1) to toggle AutoSearch Off or On 832 * \"n\" (n == 0 or 1) to toggle AutoSearch Off or On
833 */ 833 */
834static inline ssize_t 834static inline ssize_t
835pdcs_autoboot_write(struct subsystem *entry, const char *buf, size_t count) 835pdcs_autoboot_write(struct kset *kset, const char *buf, size_t count)
836{ 836{
837 return pdcs_auto_write(entry, buf, count, PF_AUTOBOOT); 837 return pdcs_auto_write(kset, buf, count, PF_AUTOBOOT);
838} 838}
839 839
840/** 840/**
841 * pdcs_autosearch_write - This function handles autosearch flag modifying. 841 * pdcs_autosearch_write - This function handles autosearch flag modifying.
842 * @entry: An allocated and populated subsytem struct. We don't use it tho. 842 * @kset: An allocated and populated struct kset. We don't use it tho.
843 * @buf: The input buffer to read from. 843 * @buf: The input buffer to read from.
844 * @count: The number of bytes to be read. 844 * @count: The number of bytes to be read.
845 * 845 *
@@ -848,14 +848,14 @@ pdcs_autoboot_write(struct subsystem *entry, const char *buf, size_t count)
848 * \"n\" (n == 0 or 1) to toggle AutoSearch Off or On 848 * \"n\" (n == 0 or 1) to toggle AutoSearch Off or On
849 */ 849 */
850static inline ssize_t 850static inline ssize_t
851pdcs_autosearch_write(struct subsystem *entry, const char *buf, size_t count) 851pdcs_autosearch_write(struct kset *kset, const char *buf, size_t count)
852{ 852{
853 return pdcs_auto_write(entry, buf, count, PF_AUTOSEARCH); 853 return pdcs_auto_write(kset, buf, count, PF_AUTOSEARCH);
854} 854}
855 855
856/** 856/**
857 * pdcs_osdep1_write - Stable Storage OS-Dependent data area 1 input. 857 * pdcs_osdep1_write - Stable Storage OS-Dependent data area 1 input.
858 * @entry: An allocated and populated subsytem struct. We don't use it tho. 858 * @kset: An allocated and populated struct kset. We don't use it tho.
859 * @buf: The input buffer to read from. 859 * @buf: The input buffer to read from.
860 * @count: The number of bytes to be read. 860 * @count: The number of bytes to be read.
861 * 861 *
@@ -864,14 +864,14 @@ pdcs_autosearch_write(struct subsystem *entry, const char *buf, size_t count)
864 * its input buffer. 864 * its input buffer.
865 */ 865 */
866static ssize_t 866static ssize_t
867pdcs_osdep1_write(struct subsystem *entry, const char *buf, size_t count) 867pdcs_osdep1_write(struct kset *kset, const char *buf, size_t count)
868{ 868{
869 u8 in[16]; 869 u8 in[16];
870 870
871 if (!capable(CAP_SYS_ADMIN)) 871 if (!capable(CAP_SYS_ADMIN))
872 return -EACCES; 872 return -EACCES;
873 873
874 if (!entry || !buf || !count) 874 if (!kset || !buf || !count)
875 return -EINVAL; 875 return -EINVAL;
876 876
877 if (unlikely(pdcs_osid != OS_ID_LINUX)) 877 if (unlikely(pdcs_osid != OS_ID_LINUX))
@@ -892,7 +892,7 @@ pdcs_osdep1_write(struct subsystem *entry, const char *buf, size_t count)
892 892
893/** 893/**
894 * pdcs_osdep2_write - Stable Storage OS-Dependent data area 2 input. 894 * pdcs_osdep2_write - Stable Storage OS-Dependent data area 2 input.
895 * @entry: An allocated and populated subsytem struct. We don't use it tho. 895 * @kset: An allocated and populated struct kset. We don't use it tho.
896 * @buf: The input buffer to read from. 896 * @buf: The input buffer to read from.
897 * @count: The number of bytes to be read. 897 * @count: The number of bytes to be read.
898 * 898 *
@@ -901,7 +901,7 @@ pdcs_osdep1_write(struct subsystem *entry, const char *buf, size_t count)
901 * constructing its input buffer. 901 * constructing its input buffer.
902 */ 902 */
903static ssize_t 903static ssize_t
904pdcs_osdep2_write(struct subsystem *entry, const char *buf, size_t count) 904pdcs_osdep2_write(struct kset *kset, const char *buf, size_t count)
905{ 905{
906 unsigned long size; 906 unsigned long size;
907 unsigned short i; 907 unsigned short i;
@@ -910,7 +910,7 @@ pdcs_osdep2_write(struct subsystem *entry, const char *buf, size_t count)
910 if (!capable(CAP_SYS_ADMIN)) 910 if (!capable(CAP_SYS_ADMIN))
911 return -EACCES; 911 return -EACCES;
912 912
913 if (!entry || !buf || !count) 913 if (!kset || !buf || !count)
914 return -EINVAL; 914 return -EINVAL;
915 915
916 if (unlikely(pdcs_size <= 224)) 916 if (unlikely(pdcs_size <= 224))
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index 7f03881a8b68..e7322c25d377 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -424,7 +424,7 @@ static int __init ibm_acpiphp_init(void)
424 int retval = 0; 424 int retval = 0;
425 acpi_status status; 425 acpi_status status;
426 struct acpi_device *device; 426 struct acpi_device *device;
427 struct kobject *sysdir = &pci_hotplug_slots_subsys.kset.kobj; 427 struct kobject *sysdir = &pci_hotplug_slots_subsys.kobj;
428 428
429 dbg("%s\n", __FUNCTION__); 429 dbg("%s\n", __FUNCTION__);
430 430
@@ -471,7 +471,7 @@ init_return:
471static void __exit ibm_acpiphp_exit(void) 471static void __exit ibm_acpiphp_exit(void)
472{ 472{
473 acpi_status status; 473 acpi_status status;
474 struct kobject *sysdir = &pci_hotplug_slots_subsys.kset.kobj; 474 struct kobject *sysdir = &pci_hotplug_slots_subsys.kobj;
475 475
476 dbg("%s\n", __FUNCTION__); 476 dbg("%s\n", __FUNCTION__);
477 477
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
index f5d632e72323..63f3bd1eecc4 100644
--- a/drivers/pci/hotplug/pci_hotplug_core.c
+++ b/drivers/pci/hotplug/pci_hotplug_core.c
@@ -62,7 +62,7 @@ static int debug;
62 62
63static LIST_HEAD(pci_hotplug_slot_list); 63static LIST_HEAD(pci_hotplug_slot_list);
64 64
65struct subsystem pci_hotplug_slots_subsys; 65struct kset pci_hotplug_slots_subsys;
66 66
67static ssize_t hotplug_slot_attr_show(struct kobject *kobj, 67static ssize_t hotplug_slot_attr_show(struct kobject *kobj,
68 struct attribute *attr, char *buf) 68 struct attribute *attr, char *buf)
@@ -764,7 +764,7 @@ static int __init pci_hotplug_init (void)
764{ 764{
765 int result; 765 int result;
766 766
767 kset_set_kset_s(&pci_hotplug_slots_subsys, pci_bus_type.subsys); 767 kobj_set_kset_s(&pci_hotplug_slots_subsys, pci_bus_type.subsys);
768 result = subsystem_register(&pci_hotplug_slots_subsys); 768 result = subsystem_register(&pci_hotplug_slots_subsys);
769 if (result) { 769 if (result) {
770 err("Register subsys with error %d\n", result); 770 err("Register subsys with error %d\n", result);
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 6f573004cd7d..b00d962de833 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -140,7 +140,7 @@ static int __init configfs_init(void)
140 if (!configfs_dir_cachep) 140 if (!configfs_dir_cachep)
141 goto out; 141 goto out;
142 142
143 kset_set_kset_s(&config_subsys, kernel_subsys); 143 kobj_set_kset_s(&config_subsys, kernel_subsys);
144 err = subsystem_register(&config_subsys); 144 err = subsystem_register(&config_subsys);
145 if (err) { 145 if (err) {
146 kmem_cache_destroy(configfs_dir_cachep); 146 kmem_cache_destroy(configfs_dir_cachep);
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 7b324cfebcb1..ec8896b264de 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -374,7 +374,7 @@ static int __init debugfs_init(void)
374{ 374{
375 int retval; 375 int retval;
376 376
377 kset_set_kset_s(&debug_subsys, kernel_subsys); 377 kobj_set_kset_s(&debug_subsys, kernel_subsys);
378 retval = subsystem_register(&debug_subsys); 378 retval = subsystem_register(&debug_subsys);
379 if (retval) 379 if (retval)
380 return retval; 380 return retval;
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index f40817b53c6f..8e6ad7600236 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -167,7 +167,6 @@ static struct kobj_type dlm_ktype = {
167}; 167};
168 168
169static struct kset dlm_kset = { 169static struct kset dlm_kset = {
170 .subsys = &kernel_subsys,
171 .kobj = {.name = "dlm",}, 170 .kobj = {.name = "dlm",},
172 .ktype = &dlm_ktype, 171 .ktype = &dlm_ktype,
173}; 172};
@@ -218,6 +217,7 @@ int dlm_lockspace_init(void)
218 INIT_LIST_HEAD(&lslist); 217 INIT_LIST_HEAD(&lslist);
219 spin_lock_init(&lslist_lock); 218 spin_lock_init(&lslist_lock);
220 219
220 kobj_set_kset_s(&dlm_kset, kernel_subsys);
221 error = kset_register(&dlm_kset); 221 error = kset_register(&dlm_kset);
222 if (error) 222 if (error)
223 printk("dlm_lockspace_init: cannot register kset %d\n", error); 223 printk("dlm_lockspace_init: cannot register kset %d\n", error);
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index fc4a3a224641..6acc8f4fc588 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -793,7 +793,7 @@ static int do_sysfs_registration(void)
793 "Unable to register ecryptfs sysfs subsystem\n"); 793 "Unable to register ecryptfs sysfs subsystem\n");
794 goto out; 794 goto out;
795 } 795 }
796 rc = sysfs_create_file(&ecryptfs_subsys.kset.kobj, 796 rc = sysfs_create_file(&ecryptfs_subsys.kobj,
797 &sysfs_attr_version.attr); 797 &sysfs_attr_version.attr);
798 if (rc) { 798 if (rc) {
799 printk(KERN_ERR 799 printk(KERN_ERR
@@ -801,12 +801,12 @@ static int do_sysfs_registration(void)
801 subsystem_unregister(&ecryptfs_subsys); 801 subsystem_unregister(&ecryptfs_subsys);
802 goto out; 802 goto out;
803 } 803 }
804 rc = sysfs_create_file(&ecryptfs_subsys.kset.kobj, 804 rc = sysfs_create_file(&ecryptfs_subsys.kobj,
805 &sysfs_attr_version_str.attr); 805 &sysfs_attr_version_str.attr);
806 if (rc) { 806 if (rc) {
807 printk(KERN_ERR 807 printk(KERN_ERR
808 "Unable to create ecryptfs version_str attribute\n"); 808 "Unable to create ecryptfs version_str attribute\n");
809 sysfs_remove_file(&ecryptfs_subsys.kset.kobj, 809 sysfs_remove_file(&ecryptfs_subsys.kobj,
810 &sysfs_attr_version.attr); 810 &sysfs_attr_version.attr);
811 subsystem_unregister(&ecryptfs_subsys); 811 subsystem_unregister(&ecryptfs_subsys);
812 goto out; 812 goto out;
@@ -841,7 +841,7 @@ static int __init ecryptfs_init(void)
841 ecryptfs_free_kmem_caches(); 841 ecryptfs_free_kmem_caches();
842 goto out; 842 goto out;
843 } 843 }
844 kset_set_kset_s(&ecryptfs_subsys, fs_subsys); 844 kobj_set_kset_s(&ecryptfs_subsys, fs_subsys);
845 sysfs_attr_version.attr.owner = THIS_MODULE; 845 sysfs_attr_version.attr.owner = THIS_MODULE;
846 sysfs_attr_version_str.attr.owner = THIS_MODULE; 846 sysfs_attr_version_str.attr.owner = THIS_MODULE;
847 rc = do_sysfs_registration(); 847 rc = do_sysfs_registration();
@@ -862,9 +862,9 @@ out:
862 862
863static void __exit ecryptfs_exit(void) 863static void __exit ecryptfs_exit(void)
864{ 864{
865 sysfs_remove_file(&ecryptfs_subsys.kset.kobj, 865 sysfs_remove_file(&ecryptfs_subsys.kobj,
866 &sysfs_attr_version.attr); 866 &sysfs_attr_version.attr);
867 sysfs_remove_file(&ecryptfs_subsys.kset.kobj, 867 sysfs_remove_file(&ecryptfs_subsys.kobj,
868 &sysfs_attr_version_str.attr); 868 &sysfs_attr_version_str.attr);
869 subsystem_unregister(&ecryptfs_subsys); 869 subsystem_unregister(&ecryptfs_subsys);
870 ecryptfs_release_messaging(ecryptfs_transport); 870 ecryptfs_release_messaging(ecryptfs_transport);
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 608db81219a0..bdffe0cfe09a 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -731,12 +731,12 @@ static int fuse_sysfs_init(void)
731{ 731{
732 int err; 732 int err;
733 733
734 kset_set_kset_s(&fuse_subsys, fs_subsys); 734 kobj_set_kset_s(&fuse_subsys, fs_subsys);
735 err = subsystem_register(&fuse_subsys); 735 err = subsystem_register(&fuse_subsys);
736 if (err) 736 if (err)
737 goto out_err; 737 goto out_err;
738 738
739 kset_set_kset_s(&connections_subsys, fuse_subsys); 739 kobj_set_kset_s(&connections_subsys, fuse_subsys);
740 err = subsystem_register(&connections_subsys); 740 err = subsystem_register(&connections_subsys);
741 if (err) 741 if (err)
742 goto out_fuse_unregister; 742 goto out_fuse_unregister;
diff --git a/fs/gfs2/locking/dlm/sysfs.c b/fs/gfs2/locking/dlm/sysfs.c
index 4746b884662d..d9fe3ca40e18 100644
--- a/fs/gfs2/locking/dlm/sysfs.c
+++ b/fs/gfs2/locking/dlm/sysfs.c
@@ -190,7 +190,6 @@ static struct kobj_type gdlm_ktype = {
190}; 190};
191 191
192static struct kset gdlm_kset = { 192static struct kset gdlm_kset = {
193 .subsys = &kernel_subsys,
194 .kobj = {.name = "lock_dlm",}, 193 .kobj = {.name = "lock_dlm",},
195 .ktype = &gdlm_ktype, 194 .ktype = &gdlm_ktype,
196}; 195};
@@ -225,6 +224,7 @@ int gdlm_sysfs_init(void)
225{ 224{
226 int error; 225 int error;
227 226
227 kobj_set_kset_s(&gdlm_kset, kernel_subsys);
228 error = kset_register(&gdlm_kset); 228 error = kset_register(&gdlm_kset);
229 if (error) 229 if (error)
230 printk("lock_dlm: cannot register kset %d\n", error); 230 printk("lock_dlm: cannot register kset %d\n", error);
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index d01f9f0fda26..c26c21b53c19 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -222,7 +222,6 @@ static struct kobj_type gfs2_ktype = {
222}; 222};
223 223
224static struct kset gfs2_kset = { 224static struct kset gfs2_kset = {
225 .subsys = &fs_subsys,
226 .kobj = {.name = "gfs2"}, 225 .kobj = {.name = "gfs2"},
227 .ktype = &gfs2_ktype, 226 .ktype = &gfs2_ktype,
228}; 227};
@@ -554,6 +553,7 @@ int gfs2_sys_init(void)
554{ 553{
555 gfs2_sys_margs = NULL; 554 gfs2_sys_margs = NULL;
556 spin_lock_init(&gfs2_sys_margs_lock); 555 spin_lock_init(&gfs2_sys_margs_lock);
556 kobj_set_kset_s(&gfs2_kset, fs_subsys);
557 return kset_register(&gfs2_kset); 557 return kset_register(&gfs2_kset);
558} 558}
559 559
diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c
index 636593bf4d17..2e975c0a35e1 100644
--- a/fs/ocfs2/cluster/masklog.c
+++ b/fs/ocfs2/cluster/masklog.c
@@ -147,7 +147,7 @@ static struct kset mlog_kset = {
147 .kobj = {.name = "logmask", .ktype = &mlog_ktype}, 147 .kobj = {.name = "logmask", .ktype = &mlog_ktype},
148}; 148};
149 149
150int mlog_sys_init(struct subsystem *o2cb_subsys) 150int mlog_sys_init(struct kset *o2cb_subsys)
151{ 151{
152 int i = 0; 152 int i = 0;
153 153
@@ -157,7 +157,7 @@ int mlog_sys_init(struct subsystem *o2cb_subsys)
157 } 157 }
158 mlog_attr_ptrs[i] = NULL; 158 mlog_attr_ptrs[i] = NULL;
159 159
160 mlog_kset.subsys = o2cb_subsys; 160 kobj_set_kset_s(&mlog_kset, o2cb_subsys);
161 return kset_register(&mlog_kset); 161 return kset_register(&mlog_kset);
162} 162}
163 163
diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h
index a42628ba9ddf..75cd877f6d42 100644
--- a/fs/ocfs2/cluster/masklog.h
+++ b/fs/ocfs2/cluster/masklog.h
@@ -278,7 +278,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
278 278
279#include <linux/kobject.h> 279#include <linux/kobject.h>
280#include <linux/sysfs.h> 280#include <linux/sysfs.h>
281int mlog_sys_init(struct subsystem *o2cb_subsys); 281int mlog_sys_init(struct kset *o2cb_subsys);
282void mlog_sys_shutdown(void); 282void mlog_sys_shutdown(void);
283 283
284#endif /* O2CLUSTER_MASKLOG_H */ 284#endif /* O2CLUSTER_MASKLOG_H */
diff --git a/fs/ocfs2/cluster/sys.c b/fs/ocfs2/cluster/sys.c
index 1d9f6acafa2e..64f6f378fd09 100644
--- a/fs/ocfs2/cluster/sys.c
+++ b/fs/ocfs2/cluster/sys.c
@@ -42,7 +42,6 @@ struct o2cb_attribute {
42#define O2CB_ATTR(_name, _mode, _show, _store) \ 42#define O2CB_ATTR(_name, _mode, _show, _store) \
43struct o2cb_attribute o2cb_attr_##_name = __ATTR(_name, _mode, _show, _store) 43struct o2cb_attribute o2cb_attr_##_name = __ATTR(_name, _mode, _show, _store)
44 44
45#define to_o2cb_subsys(k) container_of(to_kset(k), struct subsystem, kset)
46#define to_o2cb_attr(_attr) container_of(_attr, struct o2cb_attribute, attr) 45#define to_o2cb_attr(_attr) container_of(_attr, struct o2cb_attribute, attr)
47 46
48static ssize_t o2cb_interface_revision_show(char *buf) 47static ssize_t o2cb_interface_revision_show(char *buf)
@@ -79,7 +78,7 @@ static ssize_t
79o2cb_show(struct kobject * kobj, struct attribute * attr, char * buffer) 78o2cb_show(struct kobject * kobj, struct attribute * attr, char * buffer)
80{ 79{
81 struct o2cb_attribute *o2cb_attr = to_o2cb_attr(attr); 80 struct o2cb_attribute *o2cb_attr = to_o2cb_attr(attr);
82 struct subsystem *sbs = to_o2cb_subsys(kobj); 81 struct kset *sbs = to_kset(kobj);
83 82
84 BUG_ON(sbs != &o2cb_subsys); 83 BUG_ON(sbs != &o2cb_subsys);
85 84
@@ -93,7 +92,7 @@ o2cb_store(struct kobject * kobj, struct attribute * attr,
93 const char * buffer, size_t count) 92 const char * buffer, size_t count)
94{ 93{
95 struct o2cb_attribute *o2cb_attr = to_o2cb_attr(attr); 94 struct o2cb_attribute *o2cb_attr = to_o2cb_attr(attr);
96 struct subsystem *sbs = to_o2cb_subsys(kobj); 95 struct kset *sbs = to_kset(kobj);
97 96
98 BUG_ON(sbs != &o2cb_subsys); 97 BUG_ON(sbs != &o2cb_subsys);
99 98
@@ -112,7 +111,7 @@ int o2cb_sys_init(void)
112{ 111{
113 int ret; 112 int ret;
114 113
115 o2cb_subsys.kset.kobj.ktype = &o2cb_subsys_type; 114 o2cb_subsys.kobj.ktype = &o2cb_subsys_type;
116 ret = subsystem_register(&o2cb_subsys); 115 ret = subsystem_register(&o2cb_subsys);
117 if (ret) 116 if (ret)
118 return ret; 117 return ret;
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 8a7d0035ad7a..f01572fca02f 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -312,7 +312,7 @@ static struct attribute * default_attrs[] = {
312 NULL, 312 NULL,
313}; 313};
314 314
315extern struct subsystem block_subsys; 315extern struct kset block_subsys;
316 316
317static void part_release(struct kobject *kobj) 317static void part_release(struct kobject *kobj)
318{ 318{
@@ -388,7 +388,7 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len,
388 kobject_add(&p->kobj); 388 kobject_add(&p->kobj);
389 if (!disk->part_uevent_suppress) 389 if (!disk->part_uevent_suppress)
390 kobject_uevent(&p->kobj, KOBJ_ADD); 390 kobject_uevent(&p->kobj, KOBJ_ADD);
391 sysfs_create_link(&p->kobj, &block_subsys.kset.kobj, "subsystem"); 391 sysfs_create_link(&p->kobj, &block_subsys.kobj, "subsystem");
392 if (flags & ADDPART_FLAG_WHOLEDISK) { 392 if (flags & ADDPART_FLAG_WHOLEDISK) {
393 static struct attribute addpartattr = { 393 static struct attribute addpartattr = {
394 .name = "whole_disk", 394 .name = "whole_disk",
@@ -444,7 +444,7 @@ static int disk_sysfs_symlinks(struct gendisk *disk)
444 goto err_out_dev_link; 444 goto err_out_dev_link;
445 } 445 }
446 446
447 err = sysfs_create_link(&disk->kobj, &block_subsys.kset.kobj, 447 err = sysfs_create_link(&disk->kobj, &block_subsys.kobj,
448 "subsystem"); 448 "subsystem");
449 if (err) 449 if (err)
450 goto err_out_disk_name_lnk; 450 goto err_out_disk_name_lnk;
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index db0413a411d6..0e637adc2b87 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -13,8 +13,7 @@
13 13
14#include "sysfs.h" 14#include "sysfs.h"
15 15
16#define to_subsys(k) container_of(k,struct subsystem,kset.kobj) 16#define to_sattr(a) container_of(a,struct subsys_attribute, attr)
17#define to_sattr(a) container_of(a,struct subsys_attribute,attr)
18 17
19/* 18/*
20 * Subsystem file operations. 19 * Subsystem file operations.
@@ -24,12 +23,12 @@
24static ssize_t 23static ssize_t
25subsys_attr_show(struct kobject * kobj, struct attribute * attr, char * page) 24subsys_attr_show(struct kobject * kobj, struct attribute * attr, char * page)
26{ 25{
27 struct subsystem * s = to_subsys(kobj); 26 struct kset *kset = to_kset(kobj);
28 struct subsys_attribute * sattr = to_sattr(attr); 27 struct subsys_attribute * sattr = to_sattr(attr);
29 ssize_t ret = -EIO; 28 ssize_t ret = -EIO;
30 29
31 if (sattr->show) 30 if (sattr->show)
32 ret = sattr->show(s,page); 31 ret = sattr->show(kset, page);
33 return ret; 32 return ret;
34} 33}
35 34
@@ -37,12 +36,12 @@ static ssize_t
37subsys_attr_store(struct kobject * kobj, struct attribute * attr, 36subsys_attr_store(struct kobject * kobj, struct attribute * attr,
38 const char * page, size_t count) 37 const char * page, size_t count)
39{ 38{
40 struct subsystem * s = to_subsys(kobj); 39 struct kset *kset = to_kset(kobj);
41 struct subsys_attribute * sattr = to_sattr(attr); 40 struct subsys_attribute * sattr = to_sattr(attr);
42 ssize_t ret = -EIO; 41 ssize_t ret = -EIO;
43 42
44 if (sattr->store) 43 if (sattr->store)
45 ret = sattr->store(s,page,count); 44 ret = sattr->store(kset, page, count);
46 return ret; 45 return ret;
47} 46}
48 47
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 0d9f984a60a1..16c3c441256e 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -316,7 +316,7 @@ struct acpi_bus_event {
316 u32 data; 316 u32 data;
317}; 317};
318 318
319extern struct subsystem acpi_subsys; 319extern struct kset acpi_subsys;
320 320
321/* 321/*
322 * External Functions 322 * External Functions
diff --git a/include/linux/device.h b/include/linux/device.h
index a0cd2ced31a9..ee292fe87cb2 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -53,7 +53,7 @@ struct bus_type {
53 const char * name; 53 const char * name;
54 struct module * owner; 54 struct module * owner;
55 55
56 struct subsystem subsys; 56 struct kset subsys;
57 struct kset drivers; 57 struct kset drivers;
58 struct kset devices; 58 struct kset devices;
59 struct klist klist_devices; 59 struct klist klist_devices;
@@ -179,7 +179,7 @@ struct class {
179 const char * name; 179 const char * name;
180 struct module * owner; 180 struct module * owner;
181 181
182 struct subsystem subsys; 182 struct kset subsys;
183 struct list_head children; 183 struct list_head children;
184 struct list_head devices; 184 struct list_head devices;
185 struct list_head interfaces; 185 struct list_head interfaces;
@@ -559,8 +559,8 @@ extern void device_shutdown(void);
559 559
560 560
561/* drivers/base/firmware.c */ 561/* drivers/base/firmware.c */
562extern int __must_check firmware_register(struct subsystem *); 562extern int __must_check firmware_register(struct kset *);
563extern void firmware_unregister(struct subsystem *); 563extern void firmware_unregister(struct kset *);
564 564
565/* debugging and troubleshooting/diagnostic helpers. */ 565/* debugging and troubleshooting/diagnostic helpers. */
566extern const char *dev_driver_string(struct device *dev); 566extern const char *dev_driver_string(struct device *dev);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 095a9c9a64fb..7c0077f06e24 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1416,7 +1416,7 @@ extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *,
1416extern int vfs_statfs(struct dentry *, struct kstatfs *); 1416extern int vfs_statfs(struct dentry *, struct kstatfs *);
1417 1417
1418/* /sys/fs */ 1418/* /sys/fs */
1419extern struct subsystem fs_subsys; 1419extern struct kset fs_subsys;
1420 1420
1421#define FLOCK_VERIFY_READ 1 1421#define FLOCK_VERIFY_READ 1
1422#define FLOCK_VERIFY_WRITE 2 1422#define FLOCK_VERIFY_WRITE 2
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index eb0e63ef297f..c288e41ba331 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -124,7 +124,6 @@ struct kset_uevent_ops {
124}; 124};
125 125
126struct kset { 126struct kset {
127 struct subsystem * subsys;
128 struct kobj_type * ktype; 127 struct kobj_type * ktype;
129 struct list_head list; 128 struct list_head list;
130 spinlock_t list_lock; 129 spinlock_t list_lock;
@@ -171,32 +170,23 @@ extern struct kobject * kset_find_obj(struct kset *, const char *);
171#define set_kset_name(str) .kset = { .kobj = { .name = str } } 170#define set_kset_name(str) .kset = { .kobj = { .name = str } }
172 171
173 172
174
175struct subsystem {
176 struct kset kset;
177};
178
179#define decl_subsys(_name,_type,_uevent_ops) \ 173#define decl_subsys(_name,_type,_uevent_ops) \
180struct subsystem _name##_subsys = { \ 174struct kset _name##_subsys = { \
181 .kset = { \ 175 .kobj = { .name = __stringify(_name) }, \
182 .kobj = { .name = __stringify(_name) }, \ 176 .ktype = _type, \
183 .ktype = _type, \ 177 .uevent_ops =_uevent_ops, \
184 .uevent_ops =_uevent_ops, \
185 } \
186} 178}
187#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \ 179#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \
188struct subsystem _varname##_subsys = { \ 180struct kset _varname##_subsys = { \
189 .kset = { \ 181 .kobj = { .name = __stringify(_name) }, \
190 .kobj = { .name = __stringify(_name) }, \ 182 .ktype = _type, \
191 .ktype = _type, \ 183 .uevent_ops =_uevent_ops, \
192 .uevent_ops =_uevent_ops, \
193 } \
194} 184}
195 185
196/* The global /sys/kernel/ subsystem for people to chain off of */ 186/* The global /sys/kernel/ subsystem for people to chain off of */
197extern struct subsystem kernel_subsys; 187extern struct kset kernel_subsys;
198/* The global /sys/hypervisor/ subsystem */ 188/* The global /sys/hypervisor/ subsystem */
199extern struct subsystem hypervisor_subsys; 189extern struct kset hypervisor_subsys;
200 190
201/** 191/**
202 * Helpers for setting the kset of registered objects. 192 * Helpers for setting the kset of registered objects.
@@ -214,7 +204,7 @@ extern struct subsystem hypervisor_subsys;
214 */ 204 */
215 205
216#define kobj_set_kset_s(obj,subsys) \ 206#define kobj_set_kset_s(obj,subsys) \
217 (obj)->kobj.kset = &(subsys).kset 207 (obj)->kobj.kset = &(subsys)
218 208
219/** 209/**
220 * kset_set_kset_s(obj,subsys) - set kset for embedded kset. 210 * kset_set_kset_s(obj,subsys) - set kset for embedded kset.
@@ -228,7 +218,7 @@ extern struct subsystem hypervisor_subsys;
228 */ 218 */
229 219
230#define kset_set_kset_s(obj,subsys) \ 220#define kset_set_kset_s(obj,subsys) \
231 (obj)->kset.kobj.kset = &(subsys).kset 221 (obj)->kset.kobj.kset = &(subsys)
232 222
233/** 223/**
234 * subsys_set_kset(obj,subsys) - set kset for subsystem 224 * subsys_set_kset(obj,subsys) - set kset for subsystem
@@ -241,29 +231,31 @@ extern struct subsystem hypervisor_subsys;
241 */ 231 */
242 232
243#define subsys_set_kset(obj,_subsys) \ 233#define subsys_set_kset(obj,_subsys) \
244 (obj)->subsys.kset.kobj.kset = &(_subsys).kset 234 (obj)->subsys.kobj.kset = &(_subsys)
245 235
246extern void subsystem_init(struct subsystem *); 236extern void subsystem_init(struct kset *);
247extern int __must_check subsystem_register(struct subsystem *); 237extern int __must_check subsystem_register(struct kset *);
248extern void subsystem_unregister(struct subsystem *); 238extern void subsystem_unregister(struct kset *);
249 239
250static inline struct subsystem * subsys_get(struct subsystem * s) 240static inline struct kset *subsys_get(struct kset *s)
251{ 241{
252 return s ? container_of(kset_get(&s->kset),struct subsystem,kset) : NULL; 242 if (s)
243 return kset_get(s);
244 return NULL;
253} 245}
254 246
255static inline void subsys_put(struct subsystem * s) 247static inline void subsys_put(struct kset *s)
256{ 248{
257 kset_put(&s->kset); 249 kset_put(s);
258} 250}
259 251
260struct subsys_attribute { 252struct subsys_attribute {
261 struct attribute attr; 253 struct attribute attr;
262 ssize_t (*show)(struct subsystem *, char *); 254 ssize_t (*show)(struct kset *, char *);
263 ssize_t (*store)(struct subsystem *, const char *, size_t); 255 ssize_t (*store)(struct kset *, const char *, size_t);
264}; 256};
265 257
266extern int __must_check subsys_create_file(struct subsystem * , 258extern int __must_check subsys_create_file(struct kset *,
267 struct subsys_attribute *); 259 struct subsys_attribute *);
268 260
269#if defined(CONFIG_HOTPLUG) 261#if defined(CONFIG_HOTPLUG)
diff --git a/include/linux/module.h b/include/linux/module.h
index 95679eb8571e..f0b0faf42d5d 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -568,7 +568,7 @@ struct device_driver;
568#ifdef CONFIG_SYSFS 568#ifdef CONFIG_SYSFS
569struct module; 569struct module;
570 570
571extern struct subsystem module_subsys; 571extern struct kset module_subsys;
572 572
573int mod_sysfs_init(struct module *mod); 573int mod_sysfs_init(struct module *mod);
574int mod_sysfs_setup(struct module *mod, 574int mod_sysfs_setup(struct module *mod,
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index a675a05c4091..ab4cb6ecd47c 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -174,7 +174,7 @@ extern int pci_hp_register (struct hotplug_slot *slot);
174extern int pci_hp_deregister (struct hotplug_slot *slot); 174extern int pci_hp_deregister (struct hotplug_slot *slot);
175extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, 175extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot,
176 struct hotplug_slot_info *info); 176 struct hotplug_slot_info *info);
177extern struct subsystem pci_hotplug_slots_subsys; 177extern struct kset pci_hotplug_slots_subsys;
178 178
179/* PCI Setting Record (Type 0) */ 179/* PCI Setting Record (Type 0) */
180struct hpp_type0 { 180struct hpp_type0 {
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;
diff --git a/lib/kobject.c b/lib/kobject.c
index cecf2fbede3e..fc5f3f6e7329 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -582,22 +582,10 @@ void kset_init(struct kset * k)
582/** 582/**
583 * kset_add - add a kset object to the hierarchy. 583 * kset_add - add a kset object to the hierarchy.
584 * @k: kset. 584 * @k: kset.
585 *
586 * Simply, this adds the kset's embedded kobject to the
587 * hierarchy.
588 * We also try to make sure that the kset's embedded kobject
589 * has a parent before it is added. We only care if the embedded
590 * kobject is not part of a kset itself, since kobject_add()
591 * assigns a parent in that case.
592 * If that is the case, and the kset has a controlling subsystem,
593 * then we set the kset's parent to be said subsystem.
594 */ 585 */
595 586
596int kset_add(struct kset * k) 587int kset_add(struct kset * k)
597{ 588{
598 if (!k->kobj.parent && !k->kobj.kset && k->subsys)
599 k->kobj.parent = &k->subsys->kset.kobj;
600
601 return kobject_add(&k->kobj); 589 return kobject_add(&k->kobj);
602} 590}
603 591
@@ -656,53 +644,28 @@ struct kobject * kset_find_obj(struct kset * kset, const char * name)
656 return ret; 644 return ret;
657} 645}
658 646
659 647void subsystem_init(struct kset *s)
660void subsystem_init(struct subsystem * s)
661{ 648{
662 kset_init(&s->kset); 649 kset_init(s);
663} 650}
664 651
665/** 652int subsystem_register(struct kset *s)
666 * subsystem_register - register a subsystem.
667 * @s: the subsystem we're registering.
668 *
669 * Once we register the subsystem, we want to make sure that
670 * the kset points back to this subsystem.
671 */
672
673int subsystem_register(struct subsystem * s)
674{ 653{
675 int error; 654 return kset_register(s);
676
677 if (!s)
678 return -EINVAL;
679
680 subsystem_init(s);
681 pr_debug("subsystem %s: registering\n",s->kset.kobj.name);
682
683 if (!(error = kset_add(&s->kset))) {
684 if (!s->kset.subsys)
685 s->kset.subsys = s;
686 }
687 return error;
688} 655}
689 656
690void subsystem_unregister(struct subsystem * s) 657void subsystem_unregister(struct kset *s)
691{ 658{
692 if (!s) 659 kset_unregister(s);
693 return;
694 pr_debug("subsystem %s: unregistering\n",s->kset.kobj.name);
695 kset_unregister(&s->kset);
696} 660}
697 661
698
699/** 662/**
700 * subsystem_create_file - export sysfs attribute file. 663 * subsystem_create_file - export sysfs attribute file.
701 * @s: subsystem. 664 * @s: subsystem.
702 * @a: subsystem attribute descriptor. 665 * @a: subsystem attribute descriptor.
703 */ 666 */
704 667
705int subsys_create_file(struct subsystem * s, struct subsys_attribute * a) 668int subsys_create_file(struct kset *s, struct subsys_attribute *a)
706{ 669{
707 int error = 0; 670 int error = 0;
708 671
@@ -710,28 +673,12 @@ int subsys_create_file(struct subsystem * s, struct subsys_attribute * a)
710 return -EINVAL; 673 return -EINVAL;
711 674
712 if (subsys_get(s)) { 675 if (subsys_get(s)) {
713 error = sysfs_create_file(&s->kset.kobj,&a->attr); 676 error = sysfs_create_file(&s->kobj, &a->attr);
714 subsys_put(s); 677 subsys_put(s);
715 } 678 }
716 return error; 679 return error;
717} 680}
718 681
719
720/**
721 * subsystem_remove_file - remove sysfs attribute file.
722 * @s: subsystem.
723 * @a: attribute desciptor.
724 */
725#if 0
726void subsys_remove_file(struct subsystem * s, struct subsys_attribute * a)
727{
728 if (subsys_get(s)) {
729 sysfs_remove_file(&s->kset.kobj,&a->attr);
730 subsys_put(s);
731 }
732}
733#endif /* 0 */
734
735EXPORT_SYMBOL(kobject_init); 682EXPORT_SYMBOL(kobject_init);
736EXPORT_SYMBOL(kobject_register); 683EXPORT_SYMBOL(kobject_register);
737EXPORT_SYMBOL(kobject_unregister); 684EXPORT_SYMBOL(kobject_unregister);
diff --git a/security/inode.c b/security/inode.c
index d7ecf89fbc74..307211ac7346 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -321,7 +321,7 @@ static int __init securityfs_init(void)
321{ 321{
322 int retval; 322 int retval;
323 323
324 kset_set_kset_s(&security_subsys, kernel_subsys); 324 kobj_set_kset_s(&security_subsys, kernel_subsys);
325 retval = subsystem_register(&security_subsys); 325 retval = subsystem_register(&security_subsys);
326 if (retval) 326 if (retval)
327 return retval; 327 return retval;