Lines Matching refs:cdev

184 			device_unregister(&edev->component[i].cdev);  in enclosure_unregister()
195 static void enclosure_link_name(struct enclosure_component *cdev, char *name) in enclosure_link_name() argument
198 strcat(name, dev_name(&cdev->cdev)); in enclosure_link_name()
201 static void enclosure_remove_links(struct enclosure_component *cdev) in enclosure_remove_links() argument
205 enclosure_link_name(cdev, name); in enclosure_remove_links()
211 if (cdev->dev->kobj.sd) in enclosure_remove_links()
212 sysfs_remove_link(&cdev->dev->kobj, name); in enclosure_remove_links()
214 if (cdev->cdev.kobj.sd) in enclosure_remove_links()
215 sysfs_remove_link(&cdev->cdev.kobj, "device"); in enclosure_remove_links()
218 static int enclosure_add_links(struct enclosure_component *cdev) in enclosure_add_links() argument
223 error = sysfs_create_link(&cdev->cdev.kobj, &cdev->dev->kobj, "device"); in enclosure_add_links()
227 enclosure_link_name(cdev, name); in enclosure_add_links()
228 error = sysfs_create_link(&cdev->dev->kobj, &cdev->cdev.kobj, name); in enclosure_add_links()
230 sysfs_remove_link(&cdev->cdev.kobj, "device"); in enclosure_add_links()
235 static void enclosure_release(struct device *cdev) in enclosure_release() argument
237 struct enclosure_device *edev = to_enclosure_device(cdev); in enclosure_release()
239 put_device(cdev->parent); in enclosure_release()
245 struct enclosure_component *cdev = to_enclosure_component(dev); in enclosure_component_release() local
247 if (cdev->dev) { in enclosure_component_release()
248 enclosure_remove_links(cdev); in enclosure_component_release()
249 put_device(cdev->dev); in enclosure_component_release()
267 cname = dev_name(&ecomp->cdev); in enclosure_component_find_by_name()
298 struct device *cdev; in enclosure_component_alloc() local
312 cdev = &ecomp->cdev; in enclosure_component_alloc()
313 cdev->parent = get_device(&edev->edev); in enclosure_component_alloc()
326 dev_set_name(cdev, "%s", newname); in enclosure_component_alloc()
328 dev_set_name(cdev, "%u", number); in enclosure_component_alloc()
330 cdev->release = enclosure_component_release; in enclosure_component_alloc()
331 cdev->groups = enclosure_component_groups; in enclosure_component_alloc()
345 struct device *cdev; in enclosure_component_register() local
348 cdev = &ecomp->cdev; in enclosure_component_register()
349 err = device_register(cdev); in enclosure_component_register()
352 put_device(cdev); in enclosure_component_register()
377 struct enclosure_component *cdev; in enclosure_add_device() local
382 cdev = &edev->component[component]; in enclosure_add_device()
384 if (cdev->dev == dev) in enclosure_add_device()
387 if (cdev->dev) in enclosure_add_device()
388 enclosure_remove_links(cdev); in enclosure_add_device()
390 put_device(cdev->dev); in enclosure_add_device()
391 cdev->dev = get_device(dev); in enclosure_add_device()
392 return enclosure_add_links(cdev); in enclosure_add_device()
406 struct enclosure_component *cdev; in enclosure_remove_device() local
413 cdev = &edev->component[i]; in enclosure_remove_device()
414 if (cdev->dev == dev) { in enclosure_remove_device()
415 enclosure_remove_links(cdev); in enclosure_remove_device()
416 device_del(&cdev->cdev); in enclosure_remove_device()
418 cdev->dev = NULL; in enclosure_remove_device()
419 return device_add(&cdev->cdev); in enclosure_remove_device()
430 static ssize_t components_show(struct device *cdev, in components_show() argument
433 struct enclosure_device *edev = to_enclosure_device(cdev); in components_show()
439 static ssize_t id_show(struct device *cdev, in id_show() argument
443 struct enclosure_device *edev = to_enclosure_device(cdev); in id_show()
482 static ssize_t get_component_fault(struct device *cdev, in get_component_fault() argument
485 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_fault()
486 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_fault()
493 static ssize_t set_component_fault(struct device *cdev, in set_component_fault() argument
497 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_fault()
498 struct enclosure_component *ecomp = to_enclosure_component(cdev); in set_component_fault()
506 static ssize_t get_component_status(struct device *cdev, in get_component_status() argument
509 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_status()
510 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_status()
517 static ssize_t set_component_status(struct device *cdev, in set_component_status() argument
521 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_status()
522 struct enclosure_component *ecomp = to_enclosure_component(cdev); in set_component_status()
540 static ssize_t get_component_active(struct device *cdev, in get_component_active() argument
543 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_active()
544 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_active()
551 static ssize_t set_component_active(struct device *cdev, in set_component_active() argument
555 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_active()
556 struct enclosure_component *ecomp = to_enclosure_component(cdev); in set_component_active()
564 static ssize_t get_component_locate(struct device *cdev, in get_component_locate() argument
567 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_locate()
568 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_locate()
575 static ssize_t set_component_locate(struct device *cdev, in set_component_locate() argument
579 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_locate()
580 struct enclosure_component *ecomp = to_enclosure_component(cdev); in set_component_locate()
588 static ssize_t get_component_power_status(struct device *cdev, in get_component_power_status() argument
592 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_power_status()
593 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_power_status()
600 static ssize_t set_component_power_status(struct device *cdev, in set_component_power_status() argument
604 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_power_status()
605 struct enclosure_component *ecomp = to_enclosure_component(cdev); in set_component_power_status()
622 static ssize_t get_component_type(struct device *cdev, in get_component_type() argument
625 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_type()
630 static ssize_t get_component_slot(struct device *cdev, in get_component_slot() argument
633 struct enclosure_component *ecomp = to_enclosure_component(cdev); in get_component_slot()