Lines Matching defs: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;
71 struct component {
104 struct component *component = match->compare[i].component;
107 component ? dev_name(component->dev) : "(unknown)",
108 component ? (component->bound ? "bound" : "not bound") : "not registered");
161 static struct component *find_component(struct master *master,
164 struct component *c;
193 struct component *c;
195 dev_dbg(master->dev, "Looking for component %zu\n", i);
197 if (match->compare[i].component)
206 dev_dbg(master->dev, "found component %s, duplicate %u\n", dev_name(c->dev), !!c->master);
208 /* Attach this component to the master */
210 match->compare[i].component = c;
216 /* Detach component from associated master */
217 static void remove_component(struct master *master, struct component *c)
221 /* Detach the component from this master. */
223 if (master->match->compare[i].component == c)
224 master->match->compare[i].component = NULL;
228 * Try to bring up a master. If component is NULL, we're interested in
229 * this master, otherwise it's a component which must be present to try
235 struct component *component)
246 if (component && component->master != master) {
247 dev_dbg(master->dev, "master is not for this component (%s)\n",
248 dev_name(component->dev));
268 static int try_to_bring_up_masters(struct component *component)
275 ret = try_to_bring_up_master(m, component);
376 match->compare[match->num].component = NULL;
381 * component_match_add_release - add a component match entry with release callback
383 * @matchptr: pointer to the list of component matches
388 * Adds a new component match to the list stored in @matchptr, which the @master
389 * aggregate driver needs to function. The list of component matches pointed to
411 * component_match_add_typed - add a component match entry for a typed component
413 * @matchptr: pointer to the list of component matches
417 * Adds a new component match to the list stored in @matchptr, which the @master
418 * aggregate driver needs to function. The list of component matches pointed to
446 struct component *c = match->compare[i].component;
459 * @match: component match list for the aggregate driver
527 static void component_unbind(struct component *component,
530 WARN_ON(!component->bound);
532 if (component->ops && component->ops->unbind)
533 component->ops->unbind(component->dev, master->dev, data);
534 component->bound = false;
536 /* Release all resources claimed in the binding of this component */
537 devres_release_group(component->dev, component);
552 struct component *c;
564 c = master->match->compare[i].component;
570 static int component_bind(struct component *component, struct master *master,
576 * Each component initialises inside its own devres group.
577 * This allows us to roll-back a failed component without
588 if (!devres_open_group(component->dev, component, GFP_KERNEL)) {
594 dev_name(component->dev), component->ops);
596 ret = component->ops->bind(component->dev, master->dev, data);
598 component->bound = true;
601 * Close the component device's group so that resources
606 devres_close_group(component->dev, NULL);
610 dev_name(component->dev), component->ops);
612 devres_release_group(component->dev, NULL);
617 dev_name(component->dev), component->ops, ret);
635 struct component *c;
648 c = master->match->compare[i].component;
657 c = master->match->compare[i - 1].component;
669 struct component *component;
672 component = kzalloc(sizeof(*component), GFP_KERNEL);
673 if (!component)
676 component->ops = ops;
677 component->dev = dev;
678 component->subcomponent = subcomponent;
680 dev_dbg(dev, "adding component (ops %ps)\n", ops);
683 list_add_tail(&component->node, &component_list);
685 ret = try_to_bring_up_masters(component);
687 if (component->master)
688 remove_component(component->master, component);
689 list_del(&component->node);
691 kfree(component);
699 * component_add_typed - register a component
700 * @dev: component device
701 * @ops: component callbacks
704 * Register a new component for @dev. Functions in @ops will be call when the
712 * The component needs to be unregistered at driver unload/disconnect by
728 * component_add - register a component
729 * @dev: component device
730 * @ops: component callbacks
732 * Register a new component for @dev. Functions in @ops will be called when the
736 * The component needs to be unregistered at driver unload/disconnect by
749 * component_del - unregister a component
750 * @dev: component device
751 * @ops: component callbacks
753 * Unregister a component added with component_add(). If the component is bound
759 struct component *c, *component = NULL;
765 component = c;
769 if (component && component->master) {
770 take_down_master(component->master);
771 remove_component(component->master, component);
776 WARN_ON(!component);
777 kfree(component);