aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/platform.c
diff options
context:
space:
mode:
authorJacek Anaszewski <jacek.anaszewski@gmail.com>2019-07-30 22:36:31 +0200
committerJacek Anaszewski <jacek.anaszewski@gmail.com>2019-07-30 22:36:31 +0200
commitbe7fc2cc86170bea31e1db8d596f35df52254971 (patch)
tree31ca140aec74decbf18dfce1a7869aeeb8dcbf84 /drivers/base/platform.c
parentleds: netxbig: Add of_node_put() in netxbig_leds_get_of_pdata() (diff)
parentplatform: Add platform_find_device_by_driver() helper (diff)
downloadlinux-dev-be7fc2cc86170bea31e1db8d596f35df52254971.tar.xz
linux-dev-be7fc2cc86170bea31e1db8d596f35df52254971.zip
Merge tag 'generic_lookup_helpers' into for-next
Generic Device Lookup Helpers Persistent tag for others to pull this branch from Based on patch series from Suzuki K Poulose <suzuki.poulose@arm.com> with Subject: [PATCH v3 0/7] drivers: Add generic device lookup helpers Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> * tag 'generic_lookup_helpers': platform: Add platform_find_device_by_driver() helper drivers: Add generic helper to match any device drivers: Introduce device lookup variants by ACPI_COMPANION device drivers: Introduce device lookup variants by device type drivers: Introduce device lookup variants by fwnode drivers: Introduce device lookup variants by of_node drivers: Introduce device lookup variants by name
Diffstat (limited to 'drivers/base/platform.c')
-rw-r--r--drivers/base/platform.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 506a0175a5a7..a174ce5ea17c 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -1197,6 +1197,20 @@ struct bus_type platform_bus_type = {
};
EXPORT_SYMBOL_GPL(platform_bus_type);
+/**
+ * platform_find_device_by_driver - Find a platform device with a given
+ * driver.
+ * @start: The device to start the search from.
+ * @drv: The device driver to look for.
+ */
+struct device *platform_find_device_by_driver(struct device *start,
+ const struct device_driver *drv)
+{
+ return bus_find_device(&platform_bus_type, start, drv,
+ (void *)platform_match);
+}
+EXPORT_SYMBOL_GPL(platform_find_device_by_driver);
+
int __init platform_bus_init(void)
{
int error;