Lines Matching refs:cdev

171 			device_unregister(&edev->component[i].cdev);  in enclosure_unregister()
182 static void enclosure_link_name(struct enclosure_component *cdev, char *name) in enclosure_link_name() argument
185 strcat(name, dev_name(&cdev->cdev)); in enclosure_link_name()
188 static void enclosure_remove_links(struct enclosure_component *cdev) in enclosure_remove_links() argument
192 enclosure_link_name(cdev, name); in enclosure_remove_links()
198 if (cdev->dev->kobj.sd) in enclosure_remove_links()
199 sysfs_remove_link(&cdev->dev->kobj, name); in enclosure_remove_links()
201 if (cdev->cdev.kobj.sd) in enclosure_remove_links()
202 sysfs_remove_link(&cdev->cdev.kobj, "device"); in enclosure_remove_links()
205 static int enclosure_add_links(struct enclosure_component *cdev) in enclosure_add_links() argument
210 error = sysfs_create_link(&cdev->cdev.kobj, &cdev->dev->kobj, "device"); in enclosure_add_links()
214 enclosure_link_name(cdev, name); in enclosure_add_links()
215 error = sysfs_create_link(&cdev->dev->kobj, &cdev->cdev.kobj, name); in enclosure_add_links()
217 sysfs_remove_link(&cdev->cdev.kobj, "device"); in enclosure_add_links()
222 static void enclosure_release(struct device *cdev) in enclosure_release() argument
224 struct enclosure_device *edev = to_enclosure_device(cdev); in enclosure_release()
226 put_device(cdev->parent); in enclosure_release()
232 struct enclosure_component *cdev = to_enclosure_component(dev); in enclosure_component_release() local
234 if (cdev->dev) { in enclosure_component_release()
235 enclosure_remove_links(cdev); in enclosure_component_release()
236 put_device(cdev->dev); in enclosure_component_release()
254 cname = dev_name(&ecomp->cdev); in enclosure_component_find_by_name()
285 struct device *cdev; in enclosure_component_alloc() local
299 cdev = &ecomp->cdev; in enclosure_component_alloc()
300 cdev->parent = get_device(&edev->edev); in enclosure_component_alloc()
313 dev_set_name(cdev, "%s", newname); in enclosure_component_alloc()
315 dev_set_name(cdev, "%u", number); in enclosure_component_alloc()
317 cdev->release = enclosure_component_release; in enclosure_component_alloc()
318 cdev->groups = enclosure_component_groups; in enclosure_component_alloc()
332 struct device *cdev; in enclosure_component_register() local
335 cdev = &ecomp->cdev; in enclosure_component_register()
336 err = device_register(cdev); in enclosure_component_register()
339 put_device(cdev); in enclosure_component_register()
364 struct enclosure_component *cdev; in enclosure_add_device() local
370 cdev = &edev->component[component]; in enclosure_add_device()
372 if (cdev->dev == dev) in enclosure_add_device()
375 if (cdev->dev) { in enclosure_add_device()
376 enclosure_remove_links(cdev); in enclosure_add_device()
377 put_device(cdev->dev); in enclosure_add_device()
379 cdev->dev = get_device(dev); in enclosure_add_device()
380 err = enclosure_add_links(cdev); in enclosure_add_device()
382 put_device(cdev->dev); in enclosure_add_device()
383 cdev->dev = NULL; in enclosure_add_device()
399 struct enclosure_component *cdev; in enclosure_remove_device() local
406 cdev = &edev->component[i]; in enclosure_remove_device()
407 if (cdev->dev == dev) { in enclosure_remove_device()
408 enclosure_remove_links(cdev); in enclosure_remove_device()
409 device_del(&cdev->cdev); in enclosure_remove_device()
411 cdev->dev = NULL; in enclosure_remove_device()
412 return device_add(&cdev->cdev); in enclosure_remove_device()
423 static ssize_t components_show(struct device *cdev, in components_show() argument
426 struct enclosure_device *edev = to_enclosure_device(cdev); in components_show()
432 static ssize_t id_show(struct device *cdev, in id_show() argument
436 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()