Lines Matching full: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; member
65 struct component { struct
98 struct component *component = match->compare[i].component; in component_devices_show() local
101 component ? dev_name(component->dev) : "(unknown)", in component_devices_show()
102 component ? (component->bound ? "bound" : "not bound") : "not registered"); in component_devices_show()
153 static struct component *find_component(struct aggregate_device *adev, in find_component()
156 struct component *c; in find_component()
185 struct component *c; in find_components()
187 dev_dbg(adev->parent, "Looking for component %zu\n", i); in find_components()
189 if (match->compare[i].component) in find_components()
198 dev_dbg(adev->parent, "found component %s, duplicate %u\n", in find_components()
201 /* Attach this component to the adev */ in find_components()
203 match->compare[i].component = c; in find_components()
209 /* Detach component from associated aggregate_device */
210 static void remove_component(struct aggregate_device *adev, struct component *c) in remove_component()
214 /* Detach the component from this adev. */ in remove_component()
216 if (adev->match->compare[i].component == c) in remove_component()
217 adev->match->compare[i].component = NULL; in remove_component()
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) in try_to_bring_up_aggregate_device() argument
239 if (component && component->adev != adev) { in try_to_bring_up_aggregate_device()
240 dev_dbg(adev->parent, "master is not for this component (%s)\n", in try_to_bring_up_aggregate_device()
241 dev_name(component->dev)); in try_to_bring_up_aggregate_device()
262 static int try_to_bring_up_masters(struct component *component) in try_to_bring_up_masters() argument
269 ret = try_to_bring_up_aggregate_device(adev, component); in try_to_bring_up_masters()
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; in __component_match_add()
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; in free_aggregate_device()
504 * @match: component match list for the aggregate driver
572 static void component_unbind(struct component *component, in component_unbind() argument
575 WARN_ON(!component->bound); in component_unbind()
577 if (component->ops && component->ops->unbind) in component_unbind()
578 component->ops->unbind(component->dev, adev->parent, data); in component_unbind()
579 component->bound = false; in component_unbind()
581 /* Release all resources claimed in the binding of this component */ in component_unbind()
582 devres_release_group(component->dev, component); in component_unbind()
597 struct component *c; in component_unbind_all()
609 c = adev->match->compare[i].component; in component_unbind_all()
615 static int component_bind(struct component *component, struct aggregate_device *adev, in component_bind() argument
621 * Each component initialises inside its own devres group. in component_bind()
622 * This allows us to roll-back a failed component without in component_bind()
633 if (!devres_open_group(component->dev, component, GFP_KERNEL)) { in component_bind()
639 dev_name(component->dev), component->ops); in component_bind()
641 ret = component->ops->bind(component->dev, adev->parent, data); in component_bind()
643 component->bound = true; in component_bind()
646 * Close the component device's group so that resources in component_bind()
651 devres_close_group(component->dev, NULL); in component_bind()
655 dev_name(component->dev), component->ops); in component_bind()
657 devres_release_group(component->dev, NULL); in component_bind()
662 dev_name(component->dev), component->ops, ret); in component_bind()
680 struct component *c; in component_bind_all()
693 c = adev->match->compare[i].component; in component_bind_all()
702 c = adev->match->compare[i - 1].component; in component_bind_all()
714 struct component *component; in __component_add() local
717 component = kzalloc(sizeof(*component), GFP_KERNEL); in __component_add()
718 if (!component) in __component_add()
721 component->ops = ops; in __component_add()
722 component->dev = dev; in __component_add()
723 component->subcomponent = subcomponent; in __component_add()
725 dev_dbg(dev, "adding component (ops %ps)\n", ops); in __component_add()
728 list_add_tail(&component->node, &component_list); in __component_add()
730 ret = try_to_bring_up_masters(component); in __component_add()
732 if (component->adev) in __component_add()
733 remove_component(component->adev, component); in __component_add()
734 list_del(&component->node); in __component_add()
736 kfree(component); in __component_add()
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; in component_del() local
810 component = c; in component_del()
814 if (component && component->adev) { in component_del()
815 take_down_aggregate_device(component->adev); in component_del()
816 remove_component(component->adev, component); in component_del()
821 WARN_ON(!component); in component_del()
822 kfree(component); in component_del()