]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/base/class.c
class: rename "sem" to "class_sem" in internal class structure
[linux-2.6-omap-h63xx.git] / drivers / base / class.c
index 06f09c929a9189cbe3ea6c48e6c40f3d1855c788..d24d21114ccbb175ee0c6d029897bb700f8018a8 100644 (file)
@@ -70,7 +70,7 @@ static struct kobj_type class_ktype = {
        .release        = class_release,
 };
 
-/* Hotplug events for classes go to the class_obj subsys */
+/* Hotplug events for classes go to the class class_subsys */
 static struct kset *class_kset;
 
 
@@ -78,7 +78,8 @@ int class_create_file(struct class *cls, const struct class_attribute *attr)
 {
        int error;
        if (cls)
-               error = sysfs_create_file(&cls->p->subsys.kobj, &attr->attr);
+               error = sysfs_create_file(&cls->p->class_subsys.kobj,
+                                         &attr->attr);
        else
                error = -EINVAL;
        return error;
@@ -87,20 +88,20 @@ int class_create_file(struct class *cls, const struct class_attribute *attr)
 void class_remove_file(struct class *cls, const struct class_attribute *attr)
 {
        if (cls)
-               sysfs_remove_file(&cls->p->subsys.kobj, &attr->attr);
+               sysfs_remove_file(&cls->p->class_subsys.kobj, &attr->attr);
 }
 
 static struct class *class_get(struct class *cls)
 {
        if (cls)
-               kset_get(&cls->p->subsys);
+               kset_get(&cls->p->class_subsys);
        return cls;
 }
 
 static void class_put(struct class *cls)
 {
        if (cls)
-               kset_put(&cls->p->subsys);
+               kset_put(&cls->p->class_subsys);
 }
 
 static int add_class_attrs(struct class *cls)
@@ -143,11 +144,11 @@ int class_register(struct class *cls)
        cp = kzalloc(sizeof(*cp), GFP_KERNEL);
        if (!cp)
                return -ENOMEM;
-       INIT_LIST_HEAD(&cp->devices);
-       INIT_LIST_HEAD(&cp->interfaces);
+       INIT_LIST_HEAD(&cp->class_devices);
+       INIT_LIST_HEAD(&cp->class_interfaces);
        kset_init(&cp->class_dirs);
-       init_MUTEX(&cp->sem);
-       error = kobject_set_name(&cp->subsys.kobj, "%s", cls->name);
+       init_MUTEX(&cp->class_sem);
+       error = kobject_set_name(&cp->class_subsys.kobj, "%s", cls->name);
        if (error) {
                kfree(cp);
                return error;
@@ -160,15 +161,15 @@ int class_register(struct class *cls)
 #if defined(CONFIG_SYSFS_DEPRECATED) && defined(CONFIG_BLOCK)
        /* let the block class directory show up in the root of sysfs */
        if (cls != &block_class)
-               cp->subsys.kobj.kset = class_kset;
+               cp->class_subsys.kobj.kset = class_kset;
 #else
-       cp->subsys.kobj.kset = class_kset;
+       cp->class_subsys.kobj.kset = class_kset;
 #endif
-       cp->subsys.kobj.ktype = &class_ktype;
+       cp->class_subsys.kobj.ktype = &class_ktype;
        cp->class = cls;
        cls->p = cp;
 
-       error = kset_register(&cp->subsys);
+       error = kset_register(&cp->class_subsys);
        if (error) {
                kfree(cp);
                return error;
@@ -182,7 +183,7 @@ void class_unregister(struct class *cls)
 {
        pr_debug("device class '%s': unregistering\n", cls->name);
        remove_class_attrs(cls);
-       kset_unregister(&cls->p->subsys);
+       kset_unregister(&cls->p->class_subsys);
 }
 
 static void class_create_release(struct class *cls)
@@ -277,7 +278,7 @@ char *make_class_name(const char *name, struct kobject *kobj)
  * We check the return of @fn each time. If it returns anything
  * other than 0, we break out and return that value.
  *
- * Note, we hold class->sem in this function, so it can not be
+ * Note, we hold class->class_sem in this function, so it can not be
  * re-acquired in @fn, otherwise it will self-deadlocking. For
  * example, calls to add or remove class members would be verboten.
  */
@@ -289,8 +290,8 @@ int class_for_each_device(struct class *class, struct device *start,
 
        if (!class)
                return -EINVAL;
-       down(&class->p->sem);
-       list_for_each_entry(dev, &class->p->devices, node) {
+       down(&class->p->class_sem);
+       list_for_each_entry(dev, &class->p->class_devices, node) {
                if (start) {
                        if (start == dev)
                                start = NULL;
@@ -302,7 +303,7 @@ int class_for_each_device(struct class *class, struct device *start,
                if (error)
                        break;
        }
-       up(&class->p->sem);
+       up(&class->p->class_sem);
 
        return error;
 }
@@ -325,7 +326,7 @@ EXPORT_SYMBOL_GPL(class_for_each_device);
  *
  * Note, you will need to drop the reference with put_device() after use.
  *
- * We hold class->sem in this function, so it can not be
+ * We hold class->class_sem in this function, so it can not be
  * re-acquired in @match, otherwise it will self-deadlocking. For
  * example, calls to add or remove class members would be verboten.
  */
@@ -339,8 +340,8 @@ struct device *class_find_device(struct class *class, struct device *start,
        if (!class)
                return NULL;
 
-       down(&class->p->sem);
-       list_for_each_entry(dev, &class->p->devices, node) {
+       down(&class->p->class_sem);
+       list_for_each_entry(dev, &class->p->class_devices, node) {
                if (start) {
                        if (start == dev)
                                start = NULL;
@@ -353,7 +354,7 @@ struct device *class_find_device(struct class *class, struct device *start,
                } else
                        put_device(dev);
        }
-       up(&class->p->sem);
+       up(&class->p->class_sem);
 
        return found ? dev : NULL;
 }
@@ -371,13 +372,13 @@ int class_interface_register(struct class_interface *class_intf)
        if (!parent)
                return -EINVAL;
 
-       down(&parent->p->sem);
-       list_add_tail(&class_intf->node, &parent->p->interfaces);
+       down(&parent->p->class_sem);
+       list_add_tail(&class_intf->node, &parent->p->class_interfaces);
        if (class_intf->add_dev) {
-               list_for_each_entry(dev, &parent->p->devices, node)
+               list_for_each_entry(dev, &parent->p->class_devices, node)
                        class_intf->add_dev(dev, class_intf);
        }
-       up(&parent->p->sem);
+       up(&parent->p->class_sem);
 
        return 0;
 }
@@ -390,13 +391,13 @@ void class_interface_unregister(struct class_interface *class_intf)
        if (!parent)
                return;
 
-       down(&parent->p->sem);
+       down(&parent->p->class_sem);
        list_del_init(&class_intf->node);
        if (class_intf->remove_dev) {
-               list_for_each_entry(dev, &parent->p->devices, node)
+               list_for_each_entry(dev, &parent->p->class_devices, node)
                        class_intf->remove_dev(dev, class_intf);
        }
-       up(&parent->p->sem);
+       up(&parent->p->class_sem);
 
        class_put(parent);
 }