Lines Matching full:class
3 * class.c - basic device class management
11 #include <linux/device/class.h>
33 ret = class_attr->show(cp->class, class_attr, buf); in class_attr_show()
45 ret = class_attr->store(cp->class, class_attr, buf, count); in class_attr_store()
52 struct class *class = cp->class; in class_release() local
54 pr_debug("class '%s': release.\n", class->name); in class_release()
56 if (class->class_release) in class_release()
57 class->class_release(class); in class_release()
59 pr_debug("class '%s' does not have a release() function, " in class_release()
60 "be careful\n", class->name); in class_release()
68 struct class *class = cp->class; in class_child_ns_type() local
70 return class->ns_type; in class_child_ns_type()
84 /* Hotplug events for classes go to the class subsys */
88 int class_create_file_ns(struct class *cls, const struct class_attribute *attr, in class_create_file_ns()
101 void class_remove_file_ns(struct class *cls, const struct class_attribute *attr, in class_remove_file_ns()
108 static struct class *class_get(struct class *cls) in class_get()
115 static void class_put(struct class *cls) in class_put()
141 static int class_add_groups(struct class *cls, in class_add_groups()
147 static void class_remove_groups(struct class *cls, in class_remove_groups()
153 int __class_register(struct class *cls, struct lock_class_key *key) in __class_register()
158 pr_debug("device class '%s': registering\n", cls->name); in __class_register()
173 /* set the default /sys/dev directory for devices of this class */ in __class_register()
178 /* let the block class directory show up in the root of sysfs */ in __class_register()
185 cp->class = cls; in __class_register()
199 void class_unregister(struct class *cls) in class_unregister()
201 pr_debug("device class '%s': unregistering\n", cls->name); in class_unregister()
206 static void class_create_release(struct class *cls) in class_create_release()
213 * __class_create - create a struct class structure
214 * @owner: pointer to the module that is to "own" this struct class
215 * @name: pointer to a string for the name of this class.
216 * @key: the lock_class_key for this class; used by mutex lock debugging
218 * This is used to create a struct class pointer that can then be used
221 * Returns &struct class pointer on success, or ERR_PTR() on error.
226 struct class *__class_create(struct module *owner, const char *name, in __class_create()
229 struct class *cls; in __class_create()
255 * class_destroy - destroys a struct class structure
256 * @cls: pointer to the struct class that is to be destroyed
261 void class_destroy(struct class *cls) in class_destroy()
270 * class_dev_iter_init - initialize class device iterator
271 * @iter: class iterator to initialize
272 * @class: the class we wanna iterate over
276 * Initialize class iterator @iter such that it iterates over devices
277 * of @class. If @start is set, the list iteration will start there,
281 void class_dev_iter_init(struct class_dev_iter *iter, struct class *class, in class_dev_iter_init() argument
288 klist_iter_init_node(&class->p->klist_devices, &iter->ki, start_knode); in class_dev_iter_init()
295 * @iter: class iterator to proceed
303 * calling back into class code.
323 * @iter: class iterator to finish
336 * @class: the class we're iterating
341 * Iterate over @class's list of devices, and call @fn for each,
349 * @fn is allowed to do anything including calling back into class
352 int class_for_each_device(struct class *class, struct device *start, in class_for_each_device() argument
359 if (!class) in class_for_each_device()
361 if (!class->p) { in class_for_each_device()
362 WARN(1, "%s called for class '%s' before it was initialized", in class_for_each_device()
363 __func__, class->name); in class_for_each_device()
367 class_dev_iter_init(&iter, class, start, NULL); in class_for_each_device()
381 * @class: the class we're iterating
396 * @match is allowed to do anything including calling back into class
399 struct device *class_find_device(struct class *class, struct device *start, in class_find_device() argument
406 if (!class) in class_find_device()
408 if (!class->p) { in class_find_device()
409 WARN(1, "%s called for class '%s' before it was initialized", in class_find_device()
410 __func__, class->name); in class_find_device()
414 class_dev_iter_init(&iter, class, start, NULL); in class_find_device()
429 struct class *parent; in class_interface_register()
433 if (!class_intf || !class_intf->class) in class_interface_register()
436 parent = class_get(class_intf->class); in class_interface_register()
455 struct class *parent = class_intf->class; in class_interface_unregister()
475 ssize_t show_class_attr_string(struct class *class, in show_class_attr_string() argument
491 * class_compat_register - register a compatibility class
492 * @name: the name of the class
494 * Compatibility class are meant as a temporary user-space compatibility
495 * workaround when converting a family of class devices to a bus devices.
514 * class_compat_unregister - unregister a compatibility class
515 * @cls: the class to unregister
525 * class_compat_create_link - create a compatibility class device link to
527 * @cls: the compatibility class
542 * class device would have one and we want to provide as much in class_compat_create_link()
557 * class_compat_remove_link - remove a compatibility class device link to
559 * @cls: the compatibility class
575 class_kset = kset_create_and_add("class", NULL, NULL); in classes_init()