Lines Matching refs:component

5 #include <linux/component.h>
16 * The component helper allows drivers to collect a pile of sub-devices,
19 * of_clk_get_by_name(). The component helper can be used when such a
20 * subsystem-specific way to find a device is not available: The component
27 * The component helper also doesn't solve runtime dependencies, e.g. for system
33 * Aggregate drivers first assemble a component match list of what they need
39 struct component;
46 struct component *component;
65 struct component {
98 struct component *component = match->compare[i].component;
101 component ? dev_name(component->dev) : "(unknown)",
102 component ? (component->bound ? "bound" : "not bound") : "not registered");
153 static struct component *find_component(struct aggregate_device *adev,
156 struct component *c;
185 struct component *c;
187 dev_dbg(adev->parent, "Looking for component %zu\n", i);
189 if (match->compare[i].component)
198 dev_dbg(adev->parent, "found component %s, duplicate %u\n",
201 /* Attach this component to the adev */
203 match->compare[i].component = c;
209 /* Detach component from associated aggregate_device */
210 static void remove_component(struct aggregate_device *adev, struct component *c)
214 /* Detach the component from this adev. */
216 if (adev->match->compare[i].component == c)
217 adev->match->compare[i].component = NULL;
221 * Try to bring up an aggregate device. If component is NULL, we're interested
222 * in this aggregate device, otherwise it's a component which must be present
228 struct component *component)
239 if (component && component->adev != adev) {
240 dev_dbg(adev->parent, "master is not for this component (%s)\n",
241 dev_name(component->dev));
262 static int try_to_bring_up_masters(struct component *component)
269 ret = try_to_bring_up_aggregate_device(adev, component);
288 * component_compare_of - A common component compare function for of_node
289 * @dev: component device
303 * component_release_of - A common component release function for of_node
304 * @dev: component device
316 * component_compare_dev - A common component compare function for dev
317 * @dev: component device
330 * component_compare_dev_name - A common component compare function for device name
331 * @dev: component device
421 match->compare[match->num].component = NULL;
426 * component_match_add_release - add a component match entry with release callback
428 * @matchptr: pointer to the list of component matches
433 * Adds a new component match to the list stored in @matchptr, which the
434 * aggregate driver needs to function. The list of component matches pointed to
456 * component_match_add_typed - add a component match entry for a typed component
458 * @matchptr: pointer to the list of component matches
462 * Adds a new component match to the list stored in @matchptr, which the
463 * aggregate driver needs to function. The list of component matches pointed to
491 struct component *c = match->compare[i].component;
504 * @match: component match list for the aggregate driver
572 static void component_unbind(struct component *component,
575 WARN_ON(!component->bound);
577 if (component->ops && component->ops->unbind)
578 component->ops->unbind(component->dev, adev->parent, data);
579 component->bound = false;
581 /* Release all resources claimed in the binding of this component */
582 devres_release_group(component->dev, component);
597 struct component *c;
609 c = adev->match->compare[i].component;
615 static int component_bind(struct component *component, struct aggregate_device *adev,
621 * Each component initialises inside its own devres group.
622 * This allows us to roll-back a failed component without
633 if (!devres_open_group(component->dev, component, GFP_KERNEL)) {
639 dev_name(component->dev), component->ops);
641 ret = component->ops->bind(component->dev, adev->parent, data);
643 component->bound = true;
646 * Close the component device's group so that resources
651 devres_close_group(component->dev, NULL);
655 dev_name(component->dev), component->ops);
657 devres_release_group(component->dev, NULL);
662 dev_name(component->dev), component->ops, ret);
680 struct component *c;
693 c = adev->match->compare[i].component;
702 c = adev->match->compare[i - 1].component;
714 struct component *component;
717 component = kzalloc(sizeof(*component), GFP_KERNEL);
718 if (!component)
721 component->ops = ops;
722 component->dev = dev;
723 component->subcomponent = subcomponent;
725 dev_dbg(dev, "adding component (ops %ps)\n", ops);
728 list_add_tail(&component->node, &component_list);
730 ret = try_to_bring_up_masters(component);
732 if (component->adev)
733 remove_component(component->adev, component);
734 list_del(&component->node);
736 kfree(component);
744 * component_add_typed - register a component
745 * @dev: component device
746 * @ops: component callbacks
749 * Register a new component for @dev. Functions in @ops will be call when the
757 * The component needs to be unregistered at driver unload/disconnect by
773 * component_add - register a component
774 * @dev: component device
775 * @ops: component callbacks
777 * Register a new component for @dev. Functions in @ops will be called when the
781 * The component needs to be unregistered at driver unload/disconnect by
794 * component_del - unregister a component
795 * @dev: component device
796 * @ops: component callbacks
798 * Unregister a component added with component_add(). If the component is bound
804 struct component *c, *component = NULL;
810 component = c;
814 if (component && component->adev) {
815 take_down_aggregate_device(component->adev);
816 remove_component(component->adev, component);
821 WARN_ON(!component);
822 kfree(component);