From: Uwe Kleine-König Date: Fri, 13 Nov 2015 08:14:20 +0000 (+0100) Subject: driver-core: platform: probe of-devices only using list of compatibles X-Git-Tag: v4.6-rc1~120^2~4 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=67d02a1bbb334558e9380409a3cd426b36d4578b;p=linux-2.6-block.git driver-core: platform: probe of-devices only using list of compatibles There are several indications that make a platform device match a platform driver. For devices that are instantiated by a device tree matching by name, id table or acpi mechanisms doesn't make sense and might result in surprising effects. So limit matching to use the driver's of_match_table for these. Acked-by: Thierry Reding Signed-off-by: Uwe Kleine-König Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/base/platform.c b/drivers/base/platform.c index f437afa17f2b..1b5b7b5b50c0 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -949,8 +949,8 @@ static int platform_match(struct device *dev, struct device_driver *drv) return !strcmp(pdev->driver_override, drv->name); /* Attempt an OF style match first */ - if (of_driver_match_device(dev, drv)) - return 1; + if (pdev->dev.of_node) + return of_driver_match_device(dev, drv); /* Then try ACPI style match */ if (acpi_driver_match_device(dev, drv))