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
586 static void component_unbind(struct component *component, in component_unbind() argument
589 WARN_ON(!component->bound); in component_unbind()
591 dev_dbg(adev->parent, "unbinding %s component %p (ops %ps)\n", in component_unbind()
592 dev_name(component->dev), component, component->ops); in component_unbind()
594 if (component->ops && component->ops->unbind) in component_unbind()
595 component->ops->unbind(component->dev, adev->parent, data); in component_unbind()
596 component->bound = false; in component_unbind()
598 /* Release all resources claimed in the binding of this component */ in component_unbind()
599 devres_release_group(component->dev, component); in component_unbind()
614 struct component *c; in component_unbind_all()
626 c = adev->match->compare[i].component; in component_unbind_all()
632 static int component_bind(struct component *component, struct aggregate_device *adev, in component_bind() argument
638 * Each component initialises inside its own devres group. in component_bind()
639 * This allows us to roll-back a failed component without in component_bind()
650 if (!devres_open_group(component->dev, component, GFP_KERNEL)) { in component_bind()
656 dev_name(component->dev), component->ops); in component_bind()
658 ret = component->ops->bind(component->dev, adev->parent, data); in component_bind()
660 component->bound = true; in component_bind()
663 * Close the component device's group so that resources in component_bind()
668 devres_close_group(component->dev, NULL); in component_bind()
672 dev_name(component->dev), component->ops); in component_bind()
674 devres_release_group(component->dev, NULL); in component_bind()
679 dev_name(component->dev), component->ops, ret); in component_bind()
697 struct component *c; in component_bind_all()
710 c = adev->match->compare[i].component; in component_bind_all()
719 c = adev->match->compare[i - 1].component; in component_bind_all()
731 struct component *component; in __component_add() local
734 component = kzalloc(sizeof(*component), GFP_KERNEL); in __component_add()
735 if (!component) in __component_add()
738 component->ops = ops; in __component_add()
739 component->dev = dev; in __component_add()
740 component->subcomponent = subcomponent; in __component_add()
742 dev_dbg(dev, "adding component (ops %ps)\n", ops); in __component_add()
745 list_add_tail(&component->node, &component_list); in __component_add()
747 ret = try_to_bring_up_masters(component); in __component_add()
749 if (component->adev) in __component_add()
750 remove_component(component->adev, component); in __component_add()
751 list_del(&component->node); in __component_add()
753 kfree(component); in __component_add()
761 * component_add_typed - register a component
762 * @dev: component device
763 * @ops: component callbacks
766 * Register a new component for @dev. Functions in @ops will be call when the
774 * The component needs to be unregistered at driver unload/disconnect by
790 * component_add - register a component
791 * @dev: component device
792 * @ops: component callbacks
794 * Register a new component for @dev. Functions in @ops will be called when the
798 * The component needs to be unregistered at driver unload/disconnect by
811 * component_del - unregister a component
812 * @dev: component device
813 * @ops: component callbacks
815 * Unregister a component added with component_add(). If the component is bound
821 struct component *c, *component = NULL; in component_del() local
827 component = c; in component_del()
831 if (component && component->adev) { in component_del()
832 take_down_aggregate_device(component->adev); in component_del()
833 remove_component(component->adev, component); in component_del()
838 WARN_ON(!component); in component_del()
839 kfree(component); in component_del()