Lines Matching defs:cls

129 int class_create_file_ns(const struct class *cls, const struct class_attribute *attr,
132 struct subsys_private *sp = class_to_subsys(cls);
145 void class_remove_file_ns(const struct class *cls, const struct class_attribute *attr,
148 struct subsys_private *sp = class_to_subsys(cls);
178 int class_register(const struct class *cls)
184 pr_debug("device class '%s': registering\n", cls->name);
195 error = kobject_set_name(&cp->subsys.kobj, "%s", cls->name);
201 cp->class = cls;
207 error = sysfs_create_groups(&cp->subsys.kobj, cls->class_groups);
222 void class_unregister(const struct class *cls)
224 struct subsys_private *sp = class_to_subsys(cls);
229 pr_debug("device class '%s': unregistering\n", cls->name);
231 sysfs_remove_groups(&sp->subsys.kobj, cls->class_groups);
237 static void class_create_release(const struct class *cls)
239 pr_debug("%s called for %s\n", __func__, cls->name);
240 kfree(cls);
257 struct class *cls;
260 cls = kzalloc(sizeof(*cls), GFP_KERNEL);
261 if (!cls) {
266 cls->name = name;
267 cls->class_release = class_create_release;
269 retval = class_register(cls);
273 return cls;
276 kfree(cls);
283 * @cls: pointer to the struct class that is to be destroyed
288 void class_destroy(const struct class *cls)
290 if (IS_ERR_OR_NULL(cls))
293 class_unregister(cls);
557 struct class_compat *cls;
559 cls = kmalloc(sizeof(struct class_compat), GFP_KERNEL);
560 if (!cls)
562 cls->kobj = kobject_create_and_add(name, &class_kset->kobj);
563 if (!cls->kobj) {
564 kfree(cls);
567 return cls;
573 * @cls: the class to unregister
575 void class_compat_unregister(struct class_compat *cls)
577 kobject_put(cls->kobj);
578 kfree(cls);
585 * @cls: the compatibility class
589 int class_compat_create_link(struct class_compat *cls, struct device *dev,
594 error = sysfs_create_link(cls->kobj, &dev->kobj, dev_name(dev));
607 sysfs_remove_link(cls->kobj, dev_name(dev));
617 * @cls: the compatibility class
622 void class_compat_remove_link(struct class_compat *cls, struct device *dev,
627 sysfs_remove_link(cls->kobj, dev_name(dev));