static struct device_attribute devt_attr =
__ATTR(dev, S_IRUGO, show_dev, NULL);
-/*
- * devices_subsys - structure to be registered with kobject core.
- */
-
-decl_subsys(devices, &device_uevent_ops);
+/* kset to create /sys/devices/ */
+struct kset *devices_kset;
/**
void device_initialize(struct device *dev)
{
- dev->kobj.kset = &devices_subsys;
+ dev->kobj.kset = devices_kset;
dev->kobj.ktype = &device_ktype;
kobject_init(&dev->kobj);
klist_init(&dev->klist_children, klist_children_get,
if (!virtual_dir)
virtual_dir = kobject_create_and_add("virtual",
- &devices_subsys.kobj);
+ &devices_kset->kobj);
return virtual_dir;
}
int __init devices_init(void)
{
- return subsystem_register(&devices_subsys);
+ devices_kset = kset_create_and_add("devices", &device_uevent_ops, NULL);
+ if (!devices_kset)
+ return -ENOMEM;
+ return 0;
}
EXPORT_SYMBOL_GPL(device_for_each_child);
{
struct device * dev, *devn;
- list_for_each_entry_safe_reverse(dev, devn, &devices_subsys.list,
+ list_for_each_entry_safe_reverse(dev, devn, &devices_kset->list,
kobj.entry) {
if (dev->bus && dev->bus->shutdown) {
dev_dbg(dev, "shutdown\n");
#include "base.h"
-extern struct kset devices_subsys;
-
#define to_sysdev(k) container_of(k, struct sys_device, kobj)
#define to_sysdev_attr(a) container_of(a, struct sysdev_attribute, attr)
int __init system_bus_init(void)
{
- system_subsys.kobj.parent = &devices_subsys.kobj;
+ system_subsys.kobj.parent = &devices_kset->kobj;
return subsystem_register(&system_subsys);
}