diff options
| author | Suzuki K Poulose <[email protected]> | 2019-07-23 22:18:38 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2019-07-30 11:07:42 +0000 |
| commit | 36f3313d6bff91ab2a9e47698c27d15363640a4e (patch) | |
| tree | 08890611e1b8b812b8d7d532f574d23162df60a3 /drivers/base/platform.c | |
| parent | drivers: Add generic helper to match any device (diff) | |
| download | kernel-36f3313d6bff91ab2a9e47698c27d15363640a4e.tar.gz kernel-36f3313d6bff91ab2a9e47698c27d15363640a4e.zip | |
platform: Add platform_find_device_by_driver() helper
Provide a helper to lookup platform devices by matching device
driver in order to avoid drivers trying to use platform bus
internals.
Cc: Eric Anholt <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: "Heiko Stübner" <[email protected]>
Cc: Inki Dae <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Sandy Huang <[email protected]>
Cc: Seung-Woo Kim <[email protected]>
Tested-by: Heiko Stuebner <[email protected]>
Signed-off-by: Suzuki K Poulose <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/base/platform.c')
| -rw-r--r-- | drivers/base/platform.c | 14 |
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; |
