summaryrefslogtreecommitdiff
path: root/drivers/base/component.c
diff options
context:
space:
mode:
authorHeiko Stuebner <heiko@sntech.de>2025-02-21 00:41:40 +0100
committerHeiko Stuebner <heiko@sntech.de>2025-02-27 14:52:37 +0100
commita6ba2dad0aa4f623ab0def8b6e6888ac00639055 (patch)
tree0ff3e070d89cbae98c59c744702648131b9aff34 /drivers/base/component.c
parentb06d1ef3355571383cdb463cf0195b7a02efdfbf (diff)
drivers: base: component: add function to query the bound status
The component helpers already expose the bound status in debugfs, but at times it might be necessary to also check that state in the kernel and act differently depending on the result. For example the shutdown handler of a drm-driver might need to stop a whole output pipeline if the drm device is up and running, but may run into problems if that drm-device has never been set up before, for example because the binding deferred. So add a little helper that returns the bound status for a componet device. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patchwork.freedesktop.org/patch/msgid/20250220234141.2788785-2-heiko@sntech.de
Diffstat (limited to 'drivers/base/component.c')
-rw-r--r--drivers/base/component.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/base/component.c b/drivers/base/component.c
index 741497324d78..d63e01f4851d 100644
--- a/drivers/base/component.c
+++ b/drivers/base/component.c
@@ -569,6 +569,20 @@ void component_master_del(struct device *parent,
}
EXPORT_SYMBOL_GPL(component_master_del);
+bool component_master_is_bound(struct device *parent,
+ const struct component_master_ops *ops)
+{
+ struct aggregate_device *adev;
+
+ guard(mutex)(&component_mutex);
+ adev = __aggregate_find(parent, ops);
+ if (!adev)
+ return 0;
+
+ return adev->bound;
+}
+EXPORT_SYMBOL_GPL(component_master_is_bound);
+
static void component_unbind(struct component *component,
struct aggregate_device *adev, void *data)
{