summaryrefslogtreecommitdiff
path: root/drivers/slimbus/core.c
diff options
context:
space:
mode:
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>2018-09-17 02:45:42 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-25 21:21:02 +0300
commit14a649d33e8145ec14e0429e56bbb12660baa4df (patch)
treef124af8ca960bd01f63e9c8fa0064998ac5316ae /drivers/slimbus/core.c
parent0e321f19be94448ca0375e2e0cc28a5f3950e9bb (diff)
downloadlinux-14a649d33e8145ec14e0429e56bbb12660baa4df.tar.xz
slimbus: core: match device tree based devices correctly
device_id for device tree based devices come from dt compatible string, such drivers need not provide non dt style device id table. Match those device using compatible strings. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/slimbus/core.c')
-rw-r--r--drivers/slimbus/core.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c
index 95b00d28ad6e..7cd635eb44ed 100644
--- a/drivers/slimbus/core.c
+++ b/drivers/slimbus/core.c
@@ -32,6 +32,10 @@ static int slim_device_match(struct device *dev, struct device_driver *drv)
struct slim_device *sbdev = to_slim_device(dev);
struct slim_driver *sbdrv = to_slim_driver(drv);
+ /* Attempt an OF style match first */
+ if (of_driver_match_device(dev, drv))
+ return 1;
+
return !!slim_match(sbdrv->id_table, sbdev);
}
@@ -77,7 +81,7 @@ EXPORT_SYMBOL_GPL(slimbus_bus);
int __slim_driver_register(struct slim_driver *drv, struct module *owner)
{
/* ID table and probe are mandatory */
- if (!drv->id_table || !drv->probe)
+ if (!(drv->driver.of_match_table || drv->id_table) || !drv->probe)
return -EINVAL;
drv->driver.bus = &slimbus_bus;