aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rpmsg/virtio_rpmsg_bus.c
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2016-09-01 15:27:53 -0700
committerBjorn Andersson <bjorn.andersson@linaro.org>2016-09-08 22:02:40 -0700
commita16644cb3a96323074d3e71b5d600066d6397c5a (patch)
tree20c70dfbcdd6d527ec37c6d2f37f0840b38fc620 /drivers/rpmsg/virtio_rpmsg_bus.c
parentrpmsg: Drop prototypes for non-existing functions (diff)
downloadlinux-dev-a16644cb3a96323074d3e71b5d600066d6397c5a.tar.xz
linux-dev-a16644cb3a96323074d3e71b5d600066d6397c5a.zip
rpmsg: Enable matching devices with drivers based on DT
Make it possible to match rpmsg devices based on device tree node, in addition to the id table. In some of these cases the rpmsg driver would not have a id_table, so make this optional. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/rpmsg/virtio_rpmsg_bus.c')
-rw-r--r--drivers/rpmsg/virtio_rpmsg_bus.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
index 4a4374cc6a59..495fa0a282d3 100644
--- a/drivers/rpmsg/virtio_rpmsg_bus.c
+++ b/drivers/rpmsg/virtio_rpmsg_bus.c
@@ -33,6 +33,7 @@
#include <linux/wait.h>
#include <linux/rpmsg.h>
#include <linux/mutex.h>
+#include <linux/of_device.h>
/**
* struct virtproc_info - virtual remote processor state
@@ -175,11 +176,12 @@ static int rpmsg_dev_match(struct device *dev, struct device_driver *drv)
const struct rpmsg_device_id *ids = rpdrv->id_table;
unsigned int i;
- for (i = 0; ids[i].name[0]; i++)
- if (rpmsg_id_match(rpdev, &ids[i]))
- return 1;
+ if (ids)
+ for (i = 0; ids[i].name[0]; i++)
+ if (rpmsg_id_match(rpdev, &ids[i]))
+ return 1;
- return 0;
+ return of_driver_match_device(dev, drv);
}
static int rpmsg_uevent(struct device *dev, struct kobj_uevent_env *env)