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()
475 static ssize_t get_component_fault(struct device *cdev, in get_component_fault() argument
478 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_fault()
479 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_fault()
486 static ssize_t set_component_fault(struct device *cdev, in set_component_fault() argument
490 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_fault()
491 struct enclosure_component *ecomp = to_enclosure_component(cdev); in set_component_fault()
499 static ssize_t get_component_status(struct device *cdev, in get_component_status() argument
502 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_status()
503 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_status()
510 static ssize_t set_component_status(struct device *cdev, in set_component_status() argument
514 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_status()
515 struct enclosure_component *ecomp = to_enclosure_component(cdev); in set_component_status()
533 static ssize_t get_component_active(struct device *cdev, in get_component_active() argument
536 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_active()
537 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_active()
544 static ssize_t set_component_active(struct device *cdev, in set_component_active() argument
548 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_active()
549 struct enclosure_component *ecomp = to_enclosure_component(cdev); in set_component_active()
557 static ssize_t get_component_locate(struct device *cdev, in get_component_locate() argument
560 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_locate()
561 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_locate()
568 static ssize_t set_component_locate(struct device *cdev, in set_component_locate() argument
572 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_locate()
573 struct enclosure_component *ecomp = to_enclosure_component(cdev); in set_component_locate()
581 static ssize_t get_component_power_status(struct device *cdev, in get_component_power_status() argument
585 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_power_status()
586 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_power_status()
598 static ssize_t set_component_power_status(struct device *cdev, in set_component_power_status() argument
602 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_power_status()
603 struct enclosure_component *ecomp = to_enclosure_component(cdev); in set_component_power_status()
620 static ssize_t get_component_type(struct device *cdev, in get_component_type() argument
623 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_type()
628 static ssize_t get_component_slot(struct device *cdev, in get_component_slot() argument
631 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_slot()