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 <eric@anholt.net> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: "Heiko Stübner" <heiko@sntech.de> Cc: Inki Dae <inki.dae@samsung.com> Cc: "Rafael J. Wysocki" <rafael@kernel.org> Cc: Sandy Huang <hjc@rock-chips.com> Cc: Seung-Woo Kim <sw0312.kim@samsung.com> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Link: https://lore.kernel.org/r/20190723221838.12024-8-suzuki.poulose@arm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
6bf85ba9e5
commit
36f3313d6b
@@ -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;
|
||||
|
Reference in New Issue
Block a user