aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/platform.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 4d99c8bdfed..f699fabf403 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/string.h> 13#include <linux/string.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/of_device.h>
15#include <linux/module.h> 16#include <linux/module.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/dma-mapping.h> 18#include <linux/dma-mapping.h>
@@ -635,6 +636,12 @@ static struct device_attribute platform_dev_attrs[] = {
635static int platform_uevent(struct device *dev, struct kobj_uevent_env *env) 636static int platform_uevent(struct device *dev, struct kobj_uevent_env *env)
636{ 637{
637 struct platform_device *pdev = to_platform_device(dev); 638 struct platform_device *pdev = to_platform_device(dev);
639 int rc;
640
641 /* Some devices have extra OF data and an OF-style MODALIAS */
642 rc = of_device_uevent(dev,env);
643 if (rc != -ENODEV)
644 return rc;
638 645
639 add_uevent_var(env, "MODALIAS=%s%s", PLATFORM_MODULE_PREFIX, 646 add_uevent_var(env, "MODALIAS=%s%s", PLATFORM_MODULE_PREFIX,
640 (pdev->id_entry) ? pdev->id_entry->name : pdev->name); 647 (pdev->id_entry) ? pdev->id_entry->name : pdev->name);
@@ -673,7 +680,11 @@ static int platform_match(struct device *dev, struct device_driver *drv)
673 struct platform_device *pdev = to_platform_device(dev); 680 struct platform_device *pdev = to_platform_device(dev);
674 struct platform_driver *pdrv = to_platform_driver(drv); 681 struct platform_driver *pdrv = to_platform_driver(drv);
675 682
676 /* match against the id table first */ 683 /* Attempt an OF style match first */
684 if (of_driver_match_device(dev, drv))
685 return 1;
686
687 /* Then try to match against the id table */
677 if (pdrv->id_table) 688 if (pdrv->id_table)
678 return platform_match_id(pdrv->id_table, pdev) != NULL; 689 return platform_match_id(pdrv->id_table, pdev) != NULL;
679 690