Skip to content

Commit 0521215

Browse files
committed
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 <grant.likely@secretlab.ca> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> CC: Michal Simek <monstr@monstr.eu> CC: Grant Likely <grant.likely@secretlab.ca> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org> CC: Stephen Rothwell <sfr@canb.auug.org.au> CC: linux-kernel@vger.kernel.org CC: microblaze-uclinux@itee.uq.edu.au CC: linuxppc-dev@ozlabs.org CC: devicetree-discuss@lists.ozlabs.org
1 parent 4e4f62b commit 0521215

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎drivers/base/platform.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <linux/string.h>
1414
#include <linux/platform_device.h>
15+
#include <linux/of_device.h>
1516
#include <linux/module.h>
1617
#include <linux/init.h>
1718
#include <linux/dma-mapping.h>
@@ -673,7 +674,11 @@ static int platform_match(struct device *dev, struct device_driver *drv)
673674
struct platform_device *pdev = to_platform_device(dev);
674675
struct platform_driver *pdrv = to_platform_driver(drv);
675676

676-
/* match against the id table first */
677+
/* Attempt an OF style match first */
678+
if (of_driver_match_device(dev, drv))
679+
return 1;
680+
681+
/* Then try to match against the id table */
677682
if (pdrv->id_table)
678683
return platform_match_id(pdrv->id_table, pdev) != NULL;
679684

0 commit comments

Comments
 (0)