aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-11-01 11:29:06 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:15 -0500
commit881c6cfd7c5edfe6129006e2404654bfe5911050 (patch)
treecb8fa388d2b7c833d77e6ac4957310844a4e96af /drivers/base
parentb0d78e5549b44b3d64bf8b3ffe95280025ed102e (diff)
kset: convert /sys/devices to use kset_create
Dynamically create the kset instead of declaring it statically. We also rename devices_subsys to devices_kset to catch all users of the variable. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/base.h2
-rw-r--r--drivers/base/core.c16
-rw-r--r--drivers/base/power/shutdown.c2
-rw-r--r--drivers/base/sys.c4
4 files changed, 11 insertions, 13 deletions
diff --git a/drivers/base/base.h b/drivers/base/base.h
index 10b2fb6c9ce6..7e309a49a711 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -44,4 +44,4 @@ extern char *make_class_name(const char *name, struct kobject *kobj);
44 44
45extern int devres_release_all(struct device *dev); 45extern int devres_release_all(struct device *dev);
46 46
47extern struct kset devices_subsys; 47extern struct kset *devices_kset;
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 7762ee86697d..d2de2d59af42 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -401,11 +401,8 @@ static ssize_t show_dev(struct device *dev, struct device_attribute *attr,
401static struct device_attribute devt_attr = 401static struct device_attribute devt_attr =
402 __ATTR(dev, S_IRUGO, show_dev, NULL); 402 __ATTR(dev, S_IRUGO, show_dev, NULL);
403 403
404/* 404/* kset to create /sys/devices/ */
405 * devices_subsys - structure to be registered with kobject core. 405struct kset *devices_kset;
406 */
407
408decl_subsys(devices, &device_uevent_ops);
409 406
410 407
411/** 408/**
@@ -525,7 +522,7 @@ static void klist_children_put(struct klist_node *n)
525 522
526void device_initialize(struct device *dev) 523void device_initialize(struct device *dev)
527{ 524{
528 dev->kobj.kset = &devices_subsys; 525 dev->kobj.kset = devices_kset;
529 dev->kobj.ktype = &device_ktype; 526 dev->kobj.ktype = &device_ktype;
530 kobject_init(&dev->kobj); 527 kobject_init(&dev->kobj);
531 klist_init(&dev->klist_children, klist_children_get, 528 klist_init(&dev->klist_children, klist_children_get,
@@ -563,7 +560,7 @@ static struct kobject *virtual_device_parent(struct device *dev)
563 560
564 if (!virtual_dir) 561 if (!virtual_dir)
565 virtual_dir = kobject_create_and_add("virtual", 562 virtual_dir = kobject_create_and_add("virtual",
566 &devices_subsys.kobj); 563 &devices_kset->kobj);
567 564
568 return virtual_dir; 565 return virtual_dir;
569} 566}
@@ -1097,7 +1094,10 @@ struct device * device_find_child(struct device *parent, void *data,
1097 1094
1098int __init devices_init(void) 1095int __init devices_init(void)
1099{ 1096{
1100 return subsystem_register(&devices_subsys); 1097 devices_kset = kset_create_and_add("devices", &device_uevent_ops, NULL);
1098 if (!devices_kset)
1099 return -ENOMEM;
1100 return 0;
1101} 1101}
1102 1102
1103EXPORT_SYMBOL_GPL(device_for_each_child); 1103EXPORT_SYMBOL_GPL(device_for_each_child);
diff --git a/drivers/base/power/shutdown.c b/drivers/base/power/shutdown.c
index 56e8eaaac012..f51cbc1d402c 100644
--- a/drivers/base/power/shutdown.c
+++ b/drivers/base/power/shutdown.c
@@ -34,7 +34,7 @@ void device_shutdown(void)
34{ 34{
35 struct device * dev, *devn; 35 struct device * dev, *devn;
36 36
37 list_for_each_entry_safe_reverse(dev, devn, &devices_subsys.list, 37 list_for_each_entry_safe_reverse(dev, devn, &devices_kset->list,
38 kobj.entry) { 38 kobj.entry) {
39 if (dev->bus && dev->bus->shutdown) { 39 if (dev->bus && dev->bus->shutdown) {
40 dev_dbg(dev, "shutdown\n"); 40 dev_dbg(dev, "shutdown\n");
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 7cf19fc318da..7693c95848e6 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -25,8 +25,6 @@
25 25
26#include "base.h" 26#include "base.h"
27 27
28extern struct kset devices_subsys;
29
30#define to_sysdev(k) container_of(k, struct sys_device, kobj) 28#define to_sysdev(k) container_of(k, struct sys_device, kobj)
31#define to_sysdev_attr(a) container_of(a, struct sysdev_attribute, attr) 29#define to_sysdev_attr(a) container_of(a, struct sysdev_attribute, attr)
32 30
@@ -459,7 +457,7 @@ int sysdev_resume(void)
459 457
460int __init system_bus_init(void) 458int __init system_bus_init(void)
461{ 459{
462 system_subsys.kobj.parent = &devices_subsys.kobj; 460 system_subsys.kobj.parent = &devices_kset->kobj;
463 return subsystem_register(&system_subsys); 461 return subsystem_register(&system_subsys);
464} 462}
465 463