devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] driver-core: platform: probe of-devices only using list of compatibles
@ 2015-11-13  8:14 Uwe Kleine-König
  0 siblings, 0 replies; only message in thread
From: Uwe Kleine-König @ 2015-11-13  8:14 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Greg Kroah-Hartman
  Cc: Corentin LABBE, kernel-bIcnvbaLZ9MEGnE8C9+IrQ, Frans Klaver,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Thierry Reding

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 <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
Hello,

this issue popped up when it was discussed if of_match_device could
return NULL for several different drivers:

	http://mid.gmane.org/20151112082617.GE24008-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org
	http://mid.gmane.org/20151112074447.GA24008-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org
	http://mid.gmane.org/20151112134519.GJ24008-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org

(and probably more that I'm not aware of). IMHO this doesn't make these
fixes obsolete, but YMMV.

Thierry: You gave your ack before I wrote a commit log. I added it
nevertheless and hope that's ok for you. If not please say so.

Best regards
Uwe

 drivers/base/platform.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 1dd6d3bf1098..09b2972e60d7 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -900,8 +900,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))
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-13  8:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-13  8:14 [PATCH] driver-core: platform: probe of-devices only using list of compatibles Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).