Lines Matching full:component

5  * This is work in progress.  We gather up the component devices into a list,
10 #include <linux/component.h>
21 * The component helper allows drivers to collect a pile of sub-devices,
24 * of_clk_get_by_name(). The component helper can be used when such a
25 * subsystem-specific way to find a device is not available: The component
32 * The component helper also doesn't solve runtime dependencies, e.g. for system
38 * Aggregate drivers first assemble a component match list of what they need
44 struct component;
51 struct component *component; member
70 struct component { struct
103 struct component *component = match->compare[i].component; in component_devices_show() local
106 component ? dev_name(component->dev) : "(unknown)", in component_devices_show()
107 component ? (component->bound ? "bound" : "not bound") : "not registered"); in component_devices_show()
158 static struct component *find_component(struct master *master, in find_component()
161 struct component *c; in find_component()
190 struct component *c; in find_components()
192 dev_dbg(master->parent, "Looking for component %zu\n", i); in find_components()
194 if (match->compare[i].component) in find_components()
203 dev_dbg(master->parent, "found component %s, duplicate %u\n", dev_name(c->dev), !!c->master); in find_components()
205 /* Attach this component to the master */ in find_components()
207 match->compare[i].component = c; in find_components()
213 /* Detach component from associated master */
214 static void remove_component(struct master *master, struct component *c) in remove_component()
218 /* Detach the component from this master. */ in remove_component()
220 if (master->match->compare[i].component == c) in remove_component()
221 master->match->compare[i].component = NULL; in remove_component()
225 * Try to bring up a master. If component is NULL, we're interested in
226 * this master, otherwise it's a component which must be present to try
232 struct component *component) in try_to_bring_up_master() argument
243 if (component && component->master != master) { in try_to_bring_up_master()
244 dev_dbg(master->parent, "master is not for this component (%s)\n", in try_to_bring_up_master()
245 dev_name(component->dev)); in try_to_bring_up_master()
265 static int try_to_bring_up_masters(struct component *component) in try_to_bring_up_masters() argument
272 ret = try_to_bring_up_master(m, component); in try_to_bring_up_masters()
367 match->compare[match->num].component = NULL; in __component_match_add()
372 * component_match_add_release - add a component match entry with release callback
374 * @matchptr: pointer to the list of component matches
379 * Adds a new component match to the list stored in @matchptr, which the @master
380 * aggregate driver needs to function. The list of component matches pointed to
402 * component_match_add_typed - add a component match entry for a typed component
404 * @matchptr: pointer to the list of component matches
408 * Adds a new component match to the list stored in @matchptr, which the @master
409 * aggregate driver needs to function. The list of component matches pointed to
437 struct component *c = match->compare[i].component; in free_master()
450 * @match: component match list for the aggregate driver
518 static void component_unbind(struct component *component, in component_unbind() argument
521 WARN_ON(!component->bound); in component_unbind()
523 if (component->ops && component->ops->unbind) in component_unbind()
524 component->ops->unbind(component->dev, master->parent, data); in component_unbind()
525 component->bound = false; in component_unbind()
527 /* Release all resources claimed in the binding of this component */ in component_unbind()
528 devres_release_group(component->dev, component); in component_unbind()
543 struct component *c; in component_unbind_all()
555 c = master->match->compare[i].component; in component_unbind_all()
561 static int component_bind(struct component *component, struct master *master, in component_bind() argument
567 * Each component initialises inside its own devres group. in component_bind()
568 * This allows us to roll-back a failed component without in component_bind()
579 if (!devres_open_group(component->dev, component, GFP_KERNEL)) { in component_bind()
585 dev_name(component->dev), component->ops); in component_bind()
587 ret = component->ops->bind(component->dev, master->parent, data); in component_bind()
589 component->bound = true; in component_bind()
592 * Close the component device's group so that resources in component_bind()
597 devres_close_group(component->dev, NULL); in component_bind()
601 dev_name(component->dev), component->ops); in component_bind()
603 devres_release_group(component->dev, NULL); in component_bind()
608 dev_name(component->dev), component->ops, ret); in component_bind()
626 struct component *c; in component_bind_all()
639 c = master->match->compare[i].component; in component_bind_all()
648 c = master->match->compare[i - 1].component; in component_bind_all()
660 struct component *component; in __component_add() local
663 component = kzalloc(sizeof(*component), GFP_KERNEL); in __component_add()
664 if (!component) in __component_add()
667 component->ops = ops; in __component_add()
668 component->dev = dev; in __component_add()
669 component->subcomponent = subcomponent; in __component_add()
671 dev_dbg(dev, "adding component (ops %ps)\n", ops); in __component_add()
674 list_add_tail(&component->node, &component_list); in __component_add()
676 ret = try_to_bring_up_masters(component); in __component_add()
678 if (component->master) in __component_add()
679 remove_component(component->master, component); in __component_add()
680 list_del(&component->node); in __component_add()
682 kfree(component); in __component_add()
690 * component_add_typed - register a component
691 * @dev: component device
692 * @ops: component callbacks
695 * Register a new component for @dev. Functions in @ops will be call when the
703 * The component needs to be unregistered at driver unload/disconnect by
719 * component_add - register a component
720 * @dev: component device
721 * @ops: component callbacks
723 * Register a new component for @dev. Functions in @ops will be called when the
727 * The component needs to be unregistered at driver unload/disconnect by
740 * component_del - unregister a component
741 * @dev: component device
742 * @ops: component callbacks
744 * Unregister a component added with component_add(). If the component is bound
750 struct component *c, *component = NULL; in component_del() local
756 component = c; in component_del()
760 if (component && component->master) { in component_del()
761 take_down_master(component->master); in component_del()
762 remove_component(component->master, component); in component_del()
767 WARN_ON(!component); in component_del()
768 kfree(component); in component_del()