Lines Matching defs:class

3  * class.c - basic device class management
11 #include <linux/device/class.h>
33 ret = class_attr->show(cp->class, class_attr, buf);
45 ret = class_attr->store(cp->class, class_attr, buf, count);
52 struct class *class = cp->class;
54 pr_debug("class '%s': release.\n", class->name);
56 if (class->class_release)
57 class->class_release(class);
59 pr_debug("class '%s' does not have a release() function, "
60 "be careful\n", class->name);
68 struct class *class = cp->class;
70 return class->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,
101 void class_remove_file_ns(struct class *cls, const struct class_attribute *attr,
108 static struct class *class_get(struct class *cls)
115 static void class_put(struct class *cls)
141 static int class_add_groups(struct class *cls,
147 static void class_remove_groups(struct class *cls,
153 int __class_register(struct class *cls, struct lock_class_key *key)
158 pr_debug("device class '%s': registering\n", cls->name);
173 /* set the default /sys/dev directory for devices of this class */
178 /* let the block class directory show up in the root of sysfs */
185 cp->class = cls;
204 void class_unregister(struct class *cls)
206 pr_debug("device class '%s': unregistering\n", cls->name);
211 static void class_create_release(struct class *cls)
218 * class_create - create a struct class structure
219 * @owner: pointer to the module that is to "own" this struct class
220 * @name: pointer to a string for the name of this class.
221 * @key: the lock_class_key for this class; used by mutex lock debugging
223 * This is used to create a struct class pointer that can then be used
226 * Returns &struct class pointer on success, or ERR_PTR() on error.
231 struct class *__class_create(struct module *owner, const char *name,
234 struct class *cls;
260 * class_destroy - destroys a struct class structure
261 * @cls: pointer to the struct class that is to be destroyed
266 void class_destroy(struct class *cls)
275 * class_dev_iter_init - initialize class device iterator
276 * @iter: class iterator to initialize
277 * @class: the class we wanna iterate over
281 * Initialize class iterator @iter such that it iterates over devices
282 * of @class. If @start is set, the list iteration will start there,
286 void class_dev_iter_init(struct class_dev_iter *iter, struct class *class,
293 klist_iter_init_node(&class->p->klist_devices, &iter->ki, start_knode);
300 * @iter: class iterator to proceed
308 * calling back into class code.
328 * @iter: class iterator to finish
341 * @class: the class we're iterating
346 * Iterate over @class's list of devices, and call @fn for each,
354 * @fn is allowed to do anything including calling back into class
357 int class_for_each_device(struct class *class, struct device *start,
364 if (!class)
366 if (!class->p) {
367 WARN(1, "%s called for class '%s' before it was initialized",
368 __func__, class->name);
372 class_dev_iter_init(&iter, class, start, NULL);
386 * @class: the class we're iterating
401 * @match is allowed to do anything including calling back into class
404 struct device *class_find_device(struct class *class, struct device *start,
411 if (!class)
413 if (!class->p) {
414 WARN(1, "%s called for class '%s' before it was initialized",
415 __func__, class->name);
419 class_dev_iter_init(&iter, class, start, NULL);
434 struct class *parent;
438 if (!class_intf || !class_intf->class)
441 parent = class_get(class_intf->class);
460 struct class *parent = class_intf->class;
480 ssize_t show_class_attr_string(struct class *class,
496 * class_compat_register - register a compatibility class
497 * @name: the name of the class
499 * Compatibility class are meant as a temporary user-space compatibility
500 * workaround when converting a family of class devices to a bus devices.
519 * class_compat_unregister - unregister a compatibility class
520 * @cls: the class to unregister
530 * class_compat_create_link - create a compatibility class device link to
532 * @cls: the compatibility class
547 * class device would have one and we want to provide as much
562 * class_compat_remove_link - remove a compatibility class device link to
564 * @cls: the compatibility class
580 class_kset = kset_create_and_add("class", NULL, NULL);