Lines Matching refs:classdev

23 /* This is a private structure used to tie the classdev and the
28 struct device classdev;
35 get_device(&ic->classdev);
42 put_device(&ic->classdev);
47 * attribute_container_classdev_to_container - given a classdev, return the container
49 * @classdev: the class device created by attribute_container_add_device.
51 * Returns the container associated with this classdev.
54 attribute_container_classdev_to_container(struct device *classdev)
57 container_of(classdev, struct internal_container, classdev);
112 static void attribute_container_release(struct device *classdev)
115 = container_of(classdev, struct internal_container, classdev);
116 struct device *dev = classdev->parent;
133 * might be necessary is to allocate and initialise the classdev and
138 * which is not relinquished until the release of the classdev.
165 device_initialize(&ic->classdev);
166 ic->classdev.parent = get_device(dev);
167 ic->classdev.class = cont->class;
169 dev_set_name(&ic->classdev, "%s", dev_name(dev));
171 fn(cont, dev, &ic->classdev);
173 attribute_container_add_class_device(&ic->classdev);
198 * still has a reference to the classdev, then the memory occupied
199 * will not be freed until the classdev is released). If you want a
203 * to do the final put on the classdev.
225 if (dev != ic->classdev.parent)
229 fn(cont, dev, &ic->classdev);
231 attribute_container_remove_attrs(&ic->classdev);
232 device_unregister(&ic->classdev);
255 if (dev == ic->classdev.parent) {
256 ret = fn(cont, dev, &ic->classdev);
276 if (dev == ic->classdev.parent)
277 undo(cont, dev, &ic->classdev);
284 * matching classdev or fail all of them.
287 * @fn: the function to execute for each classdev.
292 * undo the partial work that has been done, on previous classdev. It
343 * attribute_container_device_trigger - execute a trigger for each matching classdev
346 * @fn: the function to execute for each classdev.
349 * the container and the classdev. If you only care about the
374 if (dev == ic->classdev.parent)
375 fn(cont, dev, &ic->classdev);
388 * matching containers (not the classdev) associated with a device.
391 * actually needs to know the classdev.
411 * @classdev: The class device
417 attribute_container_add_attrs(struct device *classdev)
420 attribute_container_classdev_to_container(classdev);
430 return sysfs_create_group(&classdev->kobj, cont->grp);
434 error = device_create_file(classdev, attrs[i]);
445 * @classdev: the class device to add
448 * attribute containers, namely add the classdev to the system and then
452 attribute_container_add_class_device(struct device *classdev)
454 int error = device_add(classdev);
458 return attribute_container_add_attrs(classdev);
466 * @classdev: the class device to add
474 struct device *classdev)
476 return attribute_container_add_class_device(classdev);
482 * @classdev: The class device to remove the files from
486 attribute_container_remove_attrs(struct device *classdev)
489 attribute_container_classdev_to_container(classdev);
497 sysfs_remove_group(&classdev->kobj, cont->grp);
502 device_remove_file(classdev, attrs[i]);
508 * @classdev: the class device
514 attribute_container_class_device_del(struct device *classdev)
516 attribute_container_remove_attrs(classdev);
517 device_del(classdev);
538 if (ic->classdev.parent == dev) {
539 cdev = &ic->classdev;