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
@@ -242,9 +242,7 @@ static struct component_match *exynos_drm_match_add(struct device *dev)
|
||||
if (!info->driver || !(info->flags & DRM_COMPONENT_DRIVER))
|
||||
continue;
|
||||
|
||||
while ((d = bus_find_device(&platform_bus_type, p,
|
||||
&info->driver->driver,
|
||||
(void *)platform_bus_type.match))) {
|
||||
while ((d = platform_find_device_by_driver(p, &info->driver->driver))) {
|
||||
put_device(p);
|
||||
|
||||
if (!(info->flags & DRM_FIMC_DEVICE) ||
|
||||
@@ -412,9 +410,8 @@ static void exynos_drm_unregister_devices(void)
|
||||
if (!info->driver || !(info->flags & DRM_VIRTUAL_DEVICE))
|
||||
continue;
|
||||
|
||||
while ((dev = bus_find_device(&platform_bus_type, NULL,
|
||||
&info->driver->driver,
|
||||
(void *)platform_bus_type.match))) {
|
||||
while ((dev = platform_find_device_by_driver(NULL,
|
||||
&info->driver->driver))) {
|
||||
put_device(dev);
|
||||
platform_device_unregister(to_platform_device(dev));
|
||||
}
|
||||
|
Reference in New Issue
Block a user