Lines Matching defs:class

3  * class.c - basic device class management
11 #include <linux/device/class.h>
23 /* /sys/class */
29 * class_to_subsys - Turn a struct class into a struct subsys_private
31 * @class: pointer to the struct bus_type to look up
34 * the external struct class pointer. This function walks the list of
36 * internal struct subsys_private that relates to that class.
42 struct subsys_private *class_to_subsys(const struct class *class)
47 if (!class || !class_kset)
59 if (sp->class == class)
77 ret = class_attr->show(cp->class, class_attr, buf);
89 ret = class_attr->store(cp->class, class_attr, buf, count);
96 const struct class *class = cp->class;
98 pr_debug("class '%s': release.\n", class->name);
100 if (class->class_release)
101 class->class_release(class);
103 pr_debug("class '%s' does not have a release() function, "
104 "be careful\n", class->name);
113 const struct class *class = cp->class;
115 return class->ns_type;
129 int class_create_file_ns(const struct class *cls, const struct class_attribute *attr,
145 void class_remove_file_ns(const struct class *cls, const struct class_attribute *attr,
178 int class_register(const struct class *cls)
184 pr_debug("device class '%s': registering\n", cls->name);
203 cp->class = cls;
224 void class_unregister(const struct class *cls)
231 pr_debug("device class '%s': unregistering\n", cls->name);
239 static void class_create_release(const struct class *cls)
246 * class_create - create a struct class structure
247 * @name: pointer to a string for the name of this class.
249 * This is used to create a struct class pointer that can then be used
252 * Returns &struct class pointer on success, or ERR_PTR() on error.
257 struct class *class_create(const char *name)
259 struct class *cls;
284 * class_destroy - destroys a struct class structure
285 * @cls: pointer to the struct class that is to be destroyed
290 void class_destroy(const struct class *cls)
300 * class_dev_iter_init - initialize class device iterator
301 * @iter: class iterator to initialize
302 * @class: the class we wanna iterate over
306 * Initialize class iterator @iter such that it iterates over devices
307 * of @class. If @start is set, the list iteration will start there,
311 void class_dev_iter_init(struct class_dev_iter *iter, const struct class *class,
314 struct subsys_private *sp = class_to_subsys(class);
330 * @iter: class iterator to proceed
338 * calling back into class code.
358 * @iter: class iterator to finish
372 * @class: the class we're iterating
377 * Iterate over @class's list of devices, and call @fn for each,
385 * @fn is allowed to do anything including calling back into class
388 int class_for_each_device(const struct class *class, const struct device *start,
391 struct subsys_private *sp = class_to_subsys(class);
396 if (!class)
399 WARN(1, "%s called for class '%s' before it was initialized",
400 __func__, class->name);
404 class_dev_iter_init(&iter, class, start, NULL);
419 * @class: the class we're iterating
434 * @match is allowed to do anything including calling back into class
437 struct device *class_find_device(const struct class *class, const struct device *start,
441 struct subsys_private *sp = class_to_subsys(class);
445 if (!class)
448 WARN(1, "%s called for class '%s' before it was initialized",
449 __func__, class->name);
453 class_dev_iter_init(&iter, class, start, NULL);
470 const struct class *parent;
474 if (!class_intf || !class_intf->class)
477 parent = class_intf->class;
504 const struct class *parent = class_intf->class;
535 ssize_t show_class_attr_string(const struct class *class,
551 * class_compat_register - register a compatibility class
552 * @name: the name of the class
554 * Compatibility class are meant as a temporary user-space compatibility
555 * workaround when converting a family of class devices to a bus devices.
574 * class_compat_unregister - unregister a compatibility class
575 * @cls: the class to unregister
585 * class_compat_create_link - create a compatibility class device link to
587 * @cls: the compatibility class
602 * class device would have one and we want to provide as much
617 * class_compat_remove_link - remove a compatibility class device link to
619 * @cls: the compatibility class
634 * class_is_registered - determine if at this moment in time, a class is
636 * @class: the class to check
638 * Returns a boolean to state if the class is registered in the driver core
641 * to determine if the specific class has been registered yet or not).
645 bool class_is_registered(const struct class *class)
647 struct subsys_private *sp = class_to_subsys(class);
660 class_kset = kset_create_and_add("class", NULL, NULL);