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);
476 static ssize_t get_component_fault(struct device *cdev,
479 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
480 struct enclosure_component *ecomp = to_enclosure_component(cdev);
487 static ssize_t set_component_fault(struct device *cdev,
491 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
492 struct enclosure_component *ecomp = to_enclosure_component(cdev);
500 static ssize_t get_component_status(struct device *cdev,
503 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
504 struct enclosure_component *ecomp = to_enclosure_component(cdev);
511 static ssize_t set_component_status(struct device *cdev,
515 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
516 struct enclosure_component *ecomp = to_enclosure_component(cdev);
534 static ssize_t get_component_active(struct device *cdev,
537 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
538 struct enclosure_component *ecomp = to_enclosure_component(cdev);
545 static ssize_t set_component_active(struct device *cdev,
549 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
550 struct enclosure_component *ecomp = to_enclosure_component(cdev);
558 static ssize_t get_component_locate(struct device *cdev,
561 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
562 struct enclosure_component *ecomp = to_enclosure_component(cdev);
569 static ssize_t set_component_locate(struct device *cdev,
573 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
574 struct enclosure_component *ecomp = to_enclosure_component(cdev);
582 static ssize_t get_component_power_status(struct device *cdev,
586 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
587 struct enclosure_component *ecomp = to_enclosure_component(cdev);
599 static ssize_t set_component_power_status(struct device *cdev,
603 struct enclosure_device *edev = to_enclosure_device(cdev->parent);
604 struct enclosure_component *ecomp = to_enclosure_component(cdev);
621 static ssize_t get_component_type(struct device *cdev,
624 struct enclosure_component *ecomp = to_enclosure_component(cdev);
629 static ssize_t get_component_slot(struct device *cdev,
632 struct enclosure_component *ecomp = to_enclosure_component(cdev);