Lines Matching refs:edev
46 struct enclosure_device *edev; in enclosure_find() local
49 edev = list_prepare_entry(start, &container_list, node); in enclosure_find()
51 put_device(&start->edev); in enclosure_find()
53 list_for_each_entry_continue(edev, &container_list, node) { in enclosure_find()
54 struct device *parent = edev->edev.parent; in enclosure_find()
59 get_device(&edev->edev); in enclosure_find()
61 return edev; in enclosure_find()
88 struct enclosure_device *edev; in enclosure_for_each_device() local
91 list_for_each_entry(edev, &container_list, node) { in enclosure_for_each_device()
92 error = fn(edev, data); in enclosure_for_each_device()
118 struct enclosure_device *edev = in enclosure_register() local
119 kzalloc(struct_size(edev, component, components), GFP_KERNEL); in enclosure_register()
124 if (!edev) in enclosure_register()
127 edev->components = components; in enclosure_register()
129 edev->edev.class = &enclosure_class; in enclosure_register()
130 edev->edev.parent = get_device(dev); in enclosure_register()
131 edev->cb = cb; in enclosure_register()
132 dev_set_name(&edev->edev, "%s", name); in enclosure_register()
133 err = device_register(&edev->edev); in enclosure_register()
138 edev->component[i].number = -1; in enclosure_register()
139 edev->component[i].slot = -1; in enclosure_register()
140 edev->component[i].power_status = -1; in enclosure_register()
144 list_add_tail(&edev->node, &container_list); in enclosure_register()
147 return edev; in enclosure_register()
150 put_device(edev->edev.parent); in enclosure_register()
151 kfree(edev); in enclosure_register()
163 void enclosure_unregister(struct enclosure_device *edev) in enclosure_unregister() argument
168 list_del(&edev->node); in enclosure_unregister()
171 for (i = 0; i < edev->components; i++) in enclosure_unregister()
172 if (edev->component[i].number != -1) in enclosure_unregister()
173 device_unregister(&edev->component[i].cdev); in enclosure_unregister()
176 edev->cb = &enclosure_null_callbacks; in enclosure_unregister()
177 device_unregister(&edev->edev); in enclosure_unregister()
226 struct enclosure_device *edev = to_enclosure_device(cdev); in enclosure_release() local
229 kfree(edev); in enclosure_release()
244 enclosure_component_find_by_name(struct enclosure_device *edev, in enclosure_component_find_by_name() argument
251 if (!edev || !name || !name[0]) in enclosure_component_find_by_name()
254 for (i = 0; i < edev->components; i++) { in enclosure_component_find_by_name()
255 ecomp = &edev->component[i]; in enclosure_component_find_by_name()
281 enclosure_component_alloc(struct enclosure_device *edev, in enclosure_component_alloc() argument
291 if (number >= edev->components) in enclosure_component_alloc()
294 ecomp = &edev->component[number]; in enclosure_component_alloc()
302 cdev->parent = get_device(&edev->edev); in enclosure_component_alloc()
312 while (enclosure_component_find_by_name(edev, newname)) in enclosure_component_alloc()
363 int enclosure_add_device(struct enclosure_device *edev, int component, in enclosure_add_device() argument
369 if (!edev || component >= edev->components) in enclosure_add_device()
372 cdev = &edev->component[component]; in enclosure_add_device()
399 int enclosure_remove_device(struct enclosure_device *edev, struct device *dev) in enclosure_remove_device() argument
404 if (!edev || !dev) in enclosure_remove_device()
407 for (i = 0; i < edev->components; i++) { in enclosure_remove_device()
408 cdev = &edev->component[i]; in enclosure_remove_device()
427 struct enclosure_device *edev = to_enclosure_device(cdev); in components_show() local
429 return snprintf(buf, 40, "%d\n", edev->components); in components_show()
437 struct enclosure_device *edev = to_enclosure_device(cdev); in id_show() local
439 if (edev->cb->show_id) in id_show()
440 return edev->cb->show_id(edev, buf); in id_show()
479 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_fault() local
482 if (edev->cb->get_fault) in get_component_fault()
483 edev->cb->get_fault(edev, ecomp); in get_component_fault()
491 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_fault() local
495 if (edev->cb->set_fault) in set_component_fault()
496 edev->cb->set_fault(edev, ecomp, val); in set_component_fault()
503 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_status() local
506 if (edev->cb->get_status) in get_component_status()
507 edev->cb->get_status(edev, ecomp); in get_component_status()
515 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_status() local
527 if (enclosure_status[i] && edev->cb->set_status) { in set_component_status()
528 edev->cb->set_status(edev, ecomp, i); in set_component_status()
537 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_active() local
540 if (edev->cb->get_active) in get_component_active()
541 edev->cb->get_active(edev, ecomp); in get_component_active()
549 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_active() local
553 if (edev->cb->set_active) in set_component_active()
554 edev->cb->set_active(edev, ecomp, val); in set_component_active()
561 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_locate() local
564 if (edev->cb->get_locate) in get_component_locate()
565 edev->cb->get_locate(edev, ecomp); in get_component_locate()
573 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_locate() local
577 if (edev->cb->set_locate) in set_component_locate()
578 edev->cb->set_locate(edev, ecomp, val); in set_component_locate()
586 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in get_component_power_status() local
589 if (edev->cb->get_power_status) in get_component_power_status()
590 edev->cb->get_power_status(edev, ecomp); in get_component_power_status()
594 return (edev->cb->get_power_status) ? -EIO : -ENOTTY; in get_component_power_status()
603 struct enclosure_device *edev = to_enclosure_device(cdev->parent); in set_component_power_status() local
616 if (edev->cb->set_power_status) in set_component_power_status()
617 edev->cb->set_power_status(edev, ecomp, val); in set_component_power_status()