Lines Matching defs:cdev

173 			device_unregister(&edev->component[i].cdev);
184 static void enclosure_link_name(struct enclosure_component *cdev, char *name)
187 strcat(name, dev_name(&cdev->cdev));
190 static void enclosure_remove_links(struct enclosure_component *cdev)
194 enclosure_link_name(cdev, name);
200 if (cdev->dev->kobj.sd)
201 sysfs_remove_link(&cdev->dev->kobj, name);
203 if (cdev->cdev.kobj.sd)
204 sysfs_remove_link(&cdev->cdev.kobj, "device");
207 static int enclosure_add_links(struct enclosure_component *cdev)
212 error = sysfs_create_link(&cdev->cdev.kobj, &cdev->dev->kobj, "device");
216 enclosure_link_name(cdev, name);
217 error = sysfs_create_link(&cdev->dev->kobj, &cdev->cdev.kobj, name);
219 sysfs_remove_link(&cdev->cdev.kobj, "device");
224 static void enclosure_release(struct device *cdev)
226 struct enclosure_device *edev = to_enclosure_device(cdev);
228 put_device(cdev->parent);
234 struct enclosure_component *cdev = to_enclosure_component(dev);
236 if (cdev->dev) {
237 enclosure_remove_links(cdev);
238 put_device(cdev->dev);
256 cname = dev_name(&ecomp->cdev);
287 struct device *cdev;
301 cdev = &ecomp->cdev;
302 cdev->parent = get_device(&edev->edev);
315 dev_set_name(cdev, "%s", newname);
317 dev_set_name(cdev, "%u", number);
319 cdev->release = enclosure_component_release;
320 cdev->groups = enclosure_component_groups;
334 struct device *cdev;
337 cdev = &ecomp->cdev;
338 err = device_register(cdev);
341 put_device(cdev);
366 struct enclosure_component *cdev;
372 cdev = &edev->component[component];
374 if (cdev->dev == dev)
377 if (cdev->dev) {
378 enclosure_remove_links(cdev);
379 put_device(cdev->dev);
381 cdev->dev = get_device(dev);
382 err = enclosure_add_links(cdev);
384 put_device(cdev->dev);
385 cdev->dev = NULL;
401 struct enclosure_component *cdev;
408 cdev = &edev->component[i];
409 if (cdev->dev == dev) {
410 enclosure_remove_links(cdev);
412 cdev->dev = NULL;
424 static ssize_t components_show(struct device *cdev,
427 struct enclosure_device *edev = to_enclosure_device(cdev);
433 static ssize_t id_show(struct device *cdev,
437 struct enclosure_device *edev = to_enclosure_device(cdev);
475 static ssize_t get_component_fault(struct device *cdev,
478 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
479 struct enclosure_component *ecomp = to_enclosure_component(cdev);
486 static ssize_t set_component_fault(struct device *cdev,
490 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
491 struct enclosure_component *ecomp = to_enclosure_component(cdev);
499 static ssize_t get_component_status(struct device *cdev,
502 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
503 struct enclosure_component *ecomp = to_enclosure_component(cdev);
510 static ssize_t set_component_status(struct device *cdev,
514 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
515 struct enclosure_component *ecomp = to_enclosure_component(cdev);
533 static ssize_t get_component_active(struct device *cdev,
536 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
537 struct enclosure_component *ecomp = to_enclosure_component(cdev);
544 static ssize_t set_component_active(struct device *cdev,
548 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
549 struct enclosure_component *ecomp = to_enclosure_component(cdev);
557 static ssize_t get_component_locate(struct device *cdev,
560 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
561 struct enclosure_component *ecomp = to_enclosure_component(cdev);
568 static ssize_t set_component_locate(struct device *cdev,
572 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
573 struct enclosure_component *ecomp = to_enclosure_component(cdev);
581 static ssize_t get_component_power_status(struct device *cdev,
585 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
586 struct enclosure_component *ecomp = to_enclosure_component(cdev);
598 static ssize_t set_component_power_status(struct device *cdev,
602 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
603 struct enclosure_component *ecomp = to_enclosure_component(cdev);
620 static ssize_t get_component_type(struct device *cdev,
623 struct enclosure_component *ecomp = to_enclosure_component(cdev);
628 static ssize_t get_component_slot(struct device *cdev,
631 struct enclosure_component *ecomp = to_enclosure_component(cdev);