Lines Matching full:class
3 * class.c - basic device class management
32 ret = class_attr->show(cp->class, class_attr, buf); in class_attr_show()
44 ret = class_attr->store(cp->class, class_attr, buf, count); in class_attr_store()
51 struct class *class = cp->class; in class_release() local
53 pr_debug("class '%s': release.\n", class->name); in class_release()
55 if (class->class_release) in class_release()
56 class->class_release(class); in class_release()
58 pr_debug("class '%s' does not have a release() function, " in class_release()
59 "be careful\n", class->name); in class_release()
67 struct class *class = cp->class; in class_child_ns_type() local
69 return class->ns_type; in class_child_ns_type()
83 /* Hotplug events for classes go to the class subsys */
87 int class_create_file_ns(struct class *cls, const struct class_attribute *attr, in class_create_file_ns()
100 void class_remove_file_ns(struct class *cls, const struct class_attribute *attr, in class_remove_file_ns()
107 static struct class *class_get(struct class *cls) in class_get()
114 static void class_put(struct class *cls) in class_put()
134 static int class_add_groups(struct class *cls, in class_add_groups()
140 static void class_remove_groups(struct class *cls, in class_remove_groups()
146 int __class_register(struct class *cls, struct lock_class_key *key) in __class_register()
151 pr_debug("device class '%s': registering\n", cls->name); in __class_register()
166 /* set the default /sys/dev directory for devices of this class */ in __class_register()
171 /* let the block class directory show up in the root of sysfs */ in __class_register()
178 cp->class = cls; in __class_register()
192 void class_unregister(struct class *cls) in class_unregister()
194 pr_debug("device class '%s': unregistering\n", cls->name); in class_unregister()
199 static void class_create_release(struct class *cls) in class_create_release()
206 * class_create - create a struct class structure
207 * @owner: pointer to the module that is to "own" this struct class
208 * @name: pointer to a string for the name of this class.
209 * @key: the lock_class_key for this class; used by mutex lock debugging
211 * This is used to create a struct class pointer that can then be used
214 * Returns &struct class pointer on success, or ERR_PTR() on error.
219 struct class *__class_create(struct module *owner, const char *name, in __class_create()
222 struct class *cls; in __class_create()
248 * class_destroy - destroys a struct class structure
249 * @cls: pointer to the struct class that is to be destroyed
254 void class_destroy(struct class *cls) in class_destroy()
263 * class_dev_iter_init - initialize class device iterator
264 * @iter: class iterator to initialize
265 * @class: the class we wanna iterate over
269 * Initialize class iterator @iter such that it iterates over devices
270 * of @class. If @start is set, the list iteration will start there,
274 void class_dev_iter_init(struct class_dev_iter *iter, struct class *class, in class_dev_iter_init() argument
281 klist_iter_init_node(&class->p->klist_devices, &iter->ki, start_knode); in class_dev_iter_init()
288 * @iter: class iterator to proceed
296 * calling back into class code.
316 * @iter: class iterator to finish
329 * @class: the class we're iterating
334 * Iterate over @class's list of devices, and call @fn for each,
342 * @fn is allowed to do anything including calling back into class
345 int class_for_each_device(struct class *class, struct device *start, in class_for_each_device() argument
352 if (!class) in class_for_each_device()
354 if (!class->p) { in class_for_each_device()
355 WARN(1, "%s called for class '%s' before it was initialized", in class_for_each_device()
356 __func__, class->name); in class_for_each_device()
360 class_dev_iter_init(&iter, class, start, NULL); in class_for_each_device()
374 * @class: the class we're iterating
389 * @match is allowed to do anything including calling back into class
392 struct device *class_find_device(struct class *class, struct device *start, in class_find_device() argument
399 if (!class) in class_find_device()
401 if (!class->p) { in class_find_device()
402 WARN(1, "%s called for class '%s' before it was initialized", in class_find_device()
403 __func__, class->name); in class_find_device()
407 class_dev_iter_init(&iter, class, start, NULL); in class_find_device()
422 struct class *parent; in class_interface_register()
426 if (!class_intf || !class_intf->class) in class_interface_register()
429 parent = class_get(class_intf->class); in class_interface_register()
448 struct class *parent = class_intf->class; in class_interface_unregister()
468 ssize_t show_class_attr_string(struct class *class, in show_class_attr_string() argument
484 * class_compat_register - register a compatibility class
485 * @name: the name of the class
487 * Compatibility class are meant as a temporary user-space compatibility
488 * workaround when converting a family of class devices to a bus devices.
507 * class_compat_unregister - unregister a compatibility class
508 * @cls: the class to unregister
518 * class_compat_create_link - create a compatibility class device link to
520 * @cls: the compatibility class
535 * class device would have one and we want to provide as much in class_compat_create_link()
550 * class_compat_remove_link - remove a compatibility class device link to
552 * @cls: the compatibility class
568 class_kset = kset_create_and_add("class", NULL, NULL); in classes_init()