kobject: remove subsystem_(un)register functions
[safe/jmp/linux-2.6] / drivers / base / class.c
index 5b9cf06..3ffcda7 100644 (file)
@@ -65,13 +65,13 @@ static struct sysfs_ops class_sysfs_ops = {
        .store  = class_attr_store,
 };
 
-static struct kobj_type ktype_class = {
+static struct kobj_type class_ktype = {
        .sysfs_ops      = &class_sysfs_ops,
        .release        = class_release,
 };
 
 /* Hotplug events for classes go to the class_obj subsys */
-static decl_subsys(class, &ktype_class, NULL);
+static struct kset *class_kset;
 
 
 int class_create_file(struct class * cls, const struct class_attribute * attr)
@@ -149,9 +149,10 @@ int class_register(struct class * cls)
        if (error)
                return error;
 
-       cls->subsys.kobj.kset = &class_subsys;
+       cls->subsys.kobj.kset = class_kset;
+       cls->subsys.kobj.ktype = &class_ktype;
 
-       error = subsystem_register(&cls->subsys);
+       error = kset_register(&cls->subsys);
        if (!error) {
                error = add_class_attrs(class_get(cls));
                class_put(cls);
@@ -163,7 +164,7 @@ void class_unregister(struct class * cls)
 {
        pr_debug("device class '%s': unregistering\n", cls->name);
        remove_class_attrs(cls);
-       subsystem_unregister(&cls->subsys);
+       kset_unregister(&cls->subsys);
 }
 
 static void class_create_release(struct class *cls)
@@ -323,7 +324,7 @@ static void class_dev_release(struct kobject * kobj)
        }
 }
 
-static struct kobj_type ktype_class_device = {
+static struct kobj_type class_device_ktype = {
        .sysfs_ops      = &class_dev_sysfs_ops,
        .release        = class_dev_release,
 };
@@ -332,7 +333,7 @@ static int class_uevent_filter(struct kset *kset, struct kobject *kobj)
 {
        struct kobj_type *ktype = get_ktype(kobj);
 
-       if (ktype == &ktype_class_device) {
+       if (ktype == &class_device_ktype) {
                struct class_device *class_dev = to_class_dev(kobj);
                if (class_dev->class)
                        return 1;
@@ -452,8 +453,15 @@ static struct kset_uevent_ops class_uevent_ops = {
        .uevent =       class_uevent,
 };
 
-static decl_subsys(class_obj, &ktype_class_device, &class_uevent_ops);
-
+/*
+ * DO NOT copy how this is created, kset_create_and_add() should be
+ * called, but this is a hold-over from the old-way and will be deleted
+ * entirely soon.
+ */
+static struct kset class_obj_subsys = {
+       .kobj = { .k_name = "class_obj", },
+       .uevent_ops = &class_uevent_ops,
+};
 
 static int class_device_add_attrs(struct class_device * cd)
 {
@@ -537,7 +545,8 @@ static struct class_device_attribute class_uevent_attr =
 
 void class_device_initialize(struct class_device *class_dev)
 {
-       kobj_set_kset_s(class_dev, class_obj_subsys);
+       class_dev->kobj.kset = &class_obj_subsys;
+       class_dev->kobj.ktype = &class_device_ktype;
        kobject_init(&class_dev->kobj);
        INIT_LIST_HEAD(&class_dev->node);
 }
@@ -853,11 +862,9 @@ void class_interface_unregister(struct class_interface *class_intf)
 
 int __init classes_init(void)
 {
-       int retval;
-
-       retval = subsystem_register(&class_subsys);
-       if (retval)
-               return retval;
+       class_kset = kset_create_and_add("class", NULL, NULL);
+       if (!class_kset)
+               return -ENOMEM;
 
        /* ick, this is ugly, the things we go through to keep from showing up
         * in sysfs... */