]> err.no Git - linux-2.6/blobdiff - drivers/base/class.c
firmware: change firmware_kset to firmware_kobj
[linux-2.6] / drivers / base / class.c
index 50e34132576c9f99b8f13006777b1abe01867fca..d8a92c650b43a7127018b180c98c773d618ef5fe 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)
@@ -93,7 +93,7 @@ void class_remove_file(struct class * cls, const struct class_attribute * attr)
 static struct class *class_get(struct class *cls)
 {
        if (cls)
-               return container_of(subsys_get(&cls->subsys), struct class, subsys);
+               return container_of(kset_get(&cls->subsys), struct class, subsys);
        return NULL;
 }
 
@@ -149,7 +149,8 @@ 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);
        if (!error) {
@@ -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,7 +453,7 @@ static struct kset_uevent_ops class_uevent_ops = {
        .uevent =       class_uevent,
 };
 
-static decl_subsys(class_obj, &ktype_class_device, &class_uevent_ops);
+static decl_subsys(class_obj, &class_uevent_ops);
 
 
 static int class_device_add_attrs(struct class_device * cd)
@@ -537,7 +538,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,15 +855,13 @@ 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... */
-       subsystem_init(&class_obj_subsys);
+       kset_init(&class_obj_subsys);
        if (!class_obj_subsys.kobj.parent)
                class_obj_subsys.kobj.parent = &class_obj_subsys.kobj;
        return 0;