diff options
Diffstat (limited to 'drivers/base/class.c')
-rw-r--r-- | drivers/base/class.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/base/class.c b/drivers/base/class.c index 9c63a5687d69..4f1df2e8fd74 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
@@ -27,7 +27,7 @@ static ssize_t class_attr_show(struct kobject *kobj, struct attribute *attr, | |||
27 | char *buf) | 27 | char *buf) |
28 | { | 28 | { |
29 | struct class_attribute *class_attr = to_class_attr(attr); | 29 | struct class_attribute *class_attr = to_class_attr(attr); |
30 | struct class_private *cp = to_class(kobj); | 30 | struct subsys_private *cp = to_subsys_private(kobj); |
31 | ssize_t ret = -EIO; | 31 | ssize_t ret = -EIO; |
32 | 32 | ||
33 | if (class_attr->show) | 33 | if (class_attr->show) |
@@ -39,7 +39,7 @@ static ssize_t class_attr_store(struct kobject *kobj, struct attribute *attr, | |||
39 | const char *buf, size_t count) | 39 | const char *buf, size_t count) |
40 | { | 40 | { |
41 | struct class_attribute *class_attr = to_class_attr(attr); | 41 | struct class_attribute *class_attr = to_class_attr(attr); |
42 | struct class_private *cp = to_class(kobj); | 42 | struct subsys_private *cp = to_subsys_private(kobj); |
43 | ssize_t ret = -EIO; | 43 | ssize_t ret = -EIO; |
44 | 44 | ||
45 | if (class_attr->store) | 45 | if (class_attr->store) |
@@ -49,7 +49,7 @@ static ssize_t class_attr_store(struct kobject *kobj, struct attribute *attr, | |||
49 | 49 | ||
50 | static void class_release(struct kobject *kobj) | 50 | static void class_release(struct kobject *kobj) |
51 | { | 51 | { |
52 | struct class_private *cp = to_class(kobj); | 52 | struct subsys_private *cp = to_subsys_private(kobj); |
53 | struct class *class = cp->class; | 53 | struct class *class = cp->class; |
54 | 54 | ||
55 | pr_debug("class '%s': release.\n", class->name); | 55 | pr_debug("class '%s': release.\n", class->name); |
@@ -65,7 +65,7 @@ static void class_release(struct kobject *kobj) | |||
65 | 65 | ||
66 | static const struct kobj_ns_type_operations *class_child_ns_type(struct kobject *kobj) | 66 | static const struct kobj_ns_type_operations *class_child_ns_type(struct kobject *kobj) |
67 | { | 67 | { |
68 | struct class_private *cp = to_class(kobj); | 68 | struct subsys_private *cp = to_subsys_private(kobj); |
69 | struct class *class = cp->class; | 69 | struct class *class = cp->class; |
70 | 70 | ||
71 | return class->ns_type; | 71 | return class->ns_type; |
@@ -82,7 +82,7 @@ static struct kobj_type class_ktype = { | |||
82 | .child_ns_type = class_child_ns_type, | 82 | .child_ns_type = class_child_ns_type, |
83 | }; | 83 | }; |
84 | 84 | ||
85 | /* Hotplug events for classes go to the class class_subsys */ | 85 | /* Hotplug events for classes go to the class subsys */ |
86 | static struct kset *class_kset; | 86 | static struct kset *class_kset; |
87 | 87 | ||
88 | 88 | ||
@@ -90,7 +90,7 @@ int class_create_file(struct class *cls, const struct class_attribute *attr) | |||
90 | { | 90 | { |
91 | int error; | 91 | int error; |
92 | if (cls) | 92 | if (cls) |
93 | error = sysfs_create_file(&cls->p->class_subsys.kobj, | 93 | error = sysfs_create_file(&cls->p->subsys.kobj, |
94 | &attr->attr); | 94 | &attr->attr); |
95 | else | 95 | else |
96 | error = -EINVAL; | 96 | error = -EINVAL; |
@@ -100,20 +100,20 @@ int class_create_file(struct class *cls, const struct class_attribute *attr) | |||
100 | void class_remove_file(struct class *cls, const struct class_attribute *attr) | 100 | void class_remove_file(struct class *cls, const struct class_attribute *attr) |
101 | { | 101 | { |
102 | if (cls) | 102 | if (cls) |
103 | sysfs_remove_file(&cls->p->class_subsys.kobj, &attr->attr); | 103 | sysfs_remove_file(&cls->p->subsys.kobj, &attr->attr); |
104 | } | 104 | } |
105 | 105 | ||
106 | static struct class *class_get(struct class *cls) | 106 | static struct class *class_get(struct class *cls) |
107 | { | 107 | { |
108 | if (cls) | 108 | if (cls) |
109 | kset_get(&cls->p->class_subsys); | 109 | kset_get(&cls->p->subsys); |
110 | return cls; | 110 | return cls; |
111 | } | 111 | } |
112 | 112 | ||
113 | static void class_put(struct class *cls) | 113 | static void class_put(struct class *cls) |
114 | { | 114 | { |
115 | if (cls) | 115 | if (cls) |
116 | kset_put(&cls->p->class_subsys); | 116 | kset_put(&cls->p->subsys); |
117 | } | 117 | } |
118 | 118 | ||
119 | static int add_class_attrs(struct class *cls) | 119 | static int add_class_attrs(struct class *cls) |
@@ -162,7 +162,7 @@ static void klist_class_dev_put(struct klist_node *n) | |||
162 | 162 | ||
163 | int __class_register(struct class *cls, struct lock_class_key *key) | 163 | int __class_register(struct class *cls, struct lock_class_key *key) |
164 | { | 164 | { |
165 | struct class_private *cp; | 165 | struct subsys_private *cp; |
166 | int error; | 166 | int error; |
167 | 167 | ||
168 | pr_debug("device class '%s': registering\n", cls->name); | 168 | pr_debug("device class '%s': registering\n", cls->name); |
@@ -170,11 +170,11 @@ int __class_register(struct class *cls, struct lock_class_key *key) | |||
170 | cp = kzalloc(sizeof(*cp), GFP_KERNEL); | 170 | cp = kzalloc(sizeof(*cp), GFP_KERNEL); |
171 | if (!cp) | 171 | if (!cp) |
172 | return -ENOMEM; | 172 | return -ENOMEM; |
173 | klist_init(&cp->class_devices, klist_class_dev_get, klist_class_dev_put); | 173 | klist_init(&cp->klist_devices, klist_class_dev_get, klist_class_dev_put); |
174 | INIT_LIST_HEAD(&cp->class_interfaces); | 174 | INIT_LIST_HEAD(&cp->class_interfaces); |
175 | kset_init(&cp->class_dirs); | 175 | kset_init(&cp->glue_dirs); |
176 | __mutex_init(&cp->class_mutex, "struct class mutex", key); | 176 | __mutex_init(&cp->class_mutex, "struct class mutex", key); |
177 | error = kobject_set_name(&cp->class_subsys.kobj, "%s", cls->name); | 177 | error = kobject_set_name(&cp->subsys.kobj, "%s", cls->name); |
178 | if (error) { | 178 | if (error) { |
179 | kfree(cp); | 179 | kfree(cp); |
180 | return error; | 180 | return error; |
@@ -187,15 +187,15 @@ int __class_register(struct class *cls, struct lock_class_key *key) | |||
187 | #if defined(CONFIG_BLOCK) | 187 | #if defined(CONFIG_BLOCK) |
188 | /* let the block class directory show up in the root of sysfs */ | 188 | /* let the block class directory show up in the root of sysfs */ |
189 | if (!sysfs_deprecated || cls != &block_class) | 189 | if (!sysfs_deprecated || cls != &block_class) |
190 | cp->class_subsys.kobj.kset = class_kset; | 190 | cp->subsys.kobj.kset = class_kset; |
191 | #else | 191 | #else |
192 | cp->class_subsys.kobj.kset = class_kset; | 192 | cp->subsys.kobj.kset = class_kset; |
193 | #endif | 193 | #endif |
194 | cp->class_subsys.kobj.ktype = &class_ktype; | 194 | cp->subsys.kobj.ktype = &class_ktype; |
195 | cp->class = cls; | 195 | cp->class = cls; |
196 | cls->p = cp; | 196 | cls->p = cp; |
197 | 197 | ||
198 | error = kset_register(&cp->class_subsys); | 198 | error = kset_register(&cp->subsys); |
199 | if (error) { | 199 | if (error) { |
200 | kfree(cp); | 200 | kfree(cp); |
201 | return error; | 201 | return error; |
@@ -210,7 +210,7 @@ void class_unregister(struct class *cls) | |||
210 | { | 210 | { |
211 | pr_debug("device class '%s': unregistering\n", cls->name); | 211 | pr_debug("device class '%s': unregistering\n", cls->name); |
212 | remove_class_attrs(cls); | 212 | remove_class_attrs(cls); |
213 | kset_unregister(&cls->p->class_subsys); | 213 | kset_unregister(&cls->p->subsys); |
214 | } | 214 | } |
215 | 215 | ||
216 | static void class_create_release(struct class *cls) | 216 | static void class_create_release(struct class *cls) |
@@ -295,7 +295,7 @@ void class_dev_iter_init(struct class_dev_iter *iter, struct class *class, | |||
295 | 295 | ||
296 | if (start) | 296 | if (start) |
297 | start_knode = &start->knode_class; | 297 | start_knode = &start->knode_class; |
298 | klist_iter_init_node(&class->p->class_devices, &iter->ki, start_knode); | 298 | klist_iter_init_node(&class->p->klist_devices, &iter->ki, start_knode); |
299 | iter->type = type; | 299 | iter->type = type; |
300 | } | 300 | } |
301 | EXPORT_SYMBOL_GPL(class_dev_iter_init); | 301 | EXPORT_SYMBOL_GPL(class_dev_iter_init); |
@@ -482,8 +482,8 @@ void class_interface_unregister(struct class_interface *class_intf) | |||
482 | class_put(parent); | 482 | class_put(parent); |
483 | } | 483 | } |
484 | 484 | ||
485 | ssize_t show_class_attr_string(struct class *class, struct class_attribute *attr, | 485 | ssize_t show_class_attr_string(struct class *class, |
486 | char *buf) | 486 | struct class_attribute *attr, char *buf) |
487 | { | 487 | { |
488 | struct class_attribute_string *cs; | 488 | struct class_attribute_string *cs; |
489 | cs = container_of(attr, struct class_attribute_string, attr); | 489 | cs = container_of(attr, struct class_attribute_string, attr); |