Lines Matching refs:cdev
173 device_unregister(&edev->component[i].cdev); in enclosure_unregister()
184 static void enclosure_link_name(struct enclosure_component *cdev, char *name) in enclosure_link_name() argument
187 strcat(name, dev_name(&cdev->cdev)); in enclosure_link_name()
190 static void enclosure_remove_links(struct enclosure_component *cdev) in enclosure_remove_links() argument
194 enclosure_link_name(cdev, name); in enclosure_remove_links()
200 if (cdev->dev->kobj.sd) in enclosure_remove_links()
201 sysfs_remove_link(&cdev->dev->kobj, name); in enclosure_remove_links()
203 if (cdev->cdev.kobj.sd) in enclosure_remove_links()
204 sysfs_remove_link(&cdev->cdev.kobj, "device"); in enclosure_remove_links()
207 static int enclosure_add_links(struct enclosure_component *cdev) in enclosure_add_links() argument
212 error = sysfs_create_link(&cdev->cdev.kobj, &cdev->dev->kobj, "device"); in enclosure_add_links()
216 enclosure_link_name(cdev, name); in enclosure_add_links()
217 error = sysfs_create_link(&cdev->dev->kobj, &cdev->cdev.kobj, name); in enclosure_add_links()
219 sysfs_remove_link(&cdev->cdev.kobj, "device"); in enclosure_add_links()
224 static void enclosure_release(struct device *cdev) in enclosure_release() argument
226 struct enclosure_device *edev = to_enclosure_device(cdev); in enclosure_release()
228 put_device(cdev->parent); in enclosure_release()
234 struct enclosure_component *cdev = to_enclosure_component(dev); in enclosure_component_release() local
236 if (cdev->dev) { in enclosure_component_release()
237 enclosure_remove_links(cdev); in enclosure_component_release()
238 put_device(cdev->dev); in enclosure_component_release()
256 cname = dev_name(&ecomp->cdev); in enclosure_component_find_by_name()
287 struct device *cdev; in enclosure_component_alloc() local
301 cdev = &ecomp->cdev; in enclosure_component_alloc()
302 cdev->parent = get_device(&edev->edev); in enclosure_component_alloc()
315 dev_set_name(cdev, "%s", newname); in enclosure_component_alloc()
317 dev_set_name(cdev, "%u", number); in enclosure_component_alloc()
319 cdev->release = enclosure_component_release; in enclosure_component_alloc()
320 cdev->groups = enclosure_component_groups; in enclosure_component_alloc()
334 struct device *cdev; in enclosure_component_register() local
337 cdev = &ecomp->cdev; in enclosure_component_register()
338 err = device_register(cdev); in enclosure_component_register()
341 put_device(cdev); in enclosure_component_register()
366 struct enclosure_component *cdev; in enclosure_add_device() local
372 cdev = &edev->component[component]; in enclosure_add_device()
374 if (cdev->dev == dev) in enclosure_add_device()
377 if (cdev->dev) { in enclosure_add_device()
378 enclosure_remove_links(cdev); in enclosure_add_device()
379 put_device(cdev->dev); in enclosure_add_device()
381 cdev->dev = get_device(dev); in enclosure_add_device()
382 err = enclosure_add_links(cdev); in enclosure_add_device()
384 put_device(cdev->dev); in enclosure_add_device()
385 cdev->dev = NULL; in enclosure_add_device()
401 struct enclosure_component *cdev; in enclosure_remove_device() local
408 cdev = &edev->component[i]; in enclosure_remove_device()
409 if (cdev->dev == dev) { in enclosure_remove_device()
410 enclosure_remove_links(cdev); in enclosure_remove_device()
412 cdev->dev = NULL; in enclosure_remove_device()
424 static ssize_t components_show(struct device *cdev, in components_show() argument
427 struct enclosure_device *edev = to_enclosure_device(cdev); in components_show()
433 static ssize_t id_show(struct device *cdev, in id_show() argument
437 struct enclosure_device *edev = to_enclosure_device(cdev); in id_show()
476 static ssize_t get_component_fault(struct device *cdev, in get_component_fault() argument
479 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_fault()
480 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_fault()
487 static ssize_t set_component_fault(struct device *cdev, in set_component_fault() argument
491 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_fault()
492 struct enclosure_component *ecomp = to_enclosure_component(cdev); in set_component_fault()
500 static ssize_t get_component_status(struct device *cdev, in get_component_status() argument
503 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_status()
504 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_status()
511 static ssize_t set_component_status(struct device *cdev, in set_component_status() argument
515 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_status()
516 struct enclosure_component *ecomp = to_enclosure_component(cdev); in set_component_status()
534 static ssize_t get_component_active(struct device *cdev, in get_component_active() argument
537 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_active()
538 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_active()
545 static ssize_t set_component_active(struct device *cdev, in set_component_active() argument
549 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_active()
550 struct enclosure_component *ecomp = to_enclosure_component(cdev); in set_component_active()
558 static ssize_t get_component_locate(struct device *cdev, in get_component_locate() argument
561 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_locate()
562 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_locate()
569 static ssize_t set_component_locate(struct device *cdev, in set_component_locate() argument
573 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_locate()
574 struct enclosure_component *ecomp = to_enclosure_component(cdev); in set_component_locate()
582 static ssize_t get_component_power_status(struct device *cdev, in get_component_power_status() argument
586 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_power_status()
587 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_power_status()
599 static ssize_t set_component_power_status(struct device *cdev, in set_component_power_status() argument
603 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_power_status()
604 struct enclosure_component *ecomp = to_enclosure_component(cdev); in set_component_power_status()
621 static ssize_t get_component_type(struct device *cdev, in get_component_type() argument
624 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_type()
629 static ssize_t get_component_slot(struct device *cdev, in get_component_slot() argument
632 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_slot()