drivercore/of: Add OF style matching to platform bus
As part of the merge between platform bus and of_platform bus, add the
ability to do of-style matching to the platform bus.
Signed-off-by: Grant Likely <[email protected]>
Acked-by: Greg Kroah-Hartman <[email protected]>
CC: Michal Simek <[email protected]>
CC: Grant Likely <[email protected]>
CC: Benjamin Herrenschmidt <[email protected]>
CC: Stephen Rothwell <[email protected]>
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 4d99c8b..fac3633 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -12,6 +12,7 @@
#include <linux/string.h>
#include <linux/platform_device.h>
+#include <linux/of_device.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/dma-mapping.h>
@@ -673,7 +674,11 @@
struct platform_device *pdev = to_platform_device(dev);
struct platform_driver *pdrv = to_platform_driver(drv);
- /* match against the id table first */
+ /* Attempt an OF style match first */
+ if (of_driver_match_device(dev, drv))
+ return 1;
+
+ /* Then try to match against the id table */
if (pdrv->id_table)
return platform_match_id(pdrv->id_table, pdev) != NULL;