Skip to content

Commit a16644c

Browse files
committed
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>
1 parent 4851b1b commit a16644c

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎drivers/rpmsg/virtio_rpmsg_bus.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <linux/wait.h>
3434
#include <linux/rpmsg.h>
3535
#include <linux/mutex.h>
36+
#include <linux/of_device.h>
3637

3738
/**
3839
* struct virtproc_info - virtual remote processor state
@@ -175,11 +176,12 @@ static int rpmsg_dev_match(struct device *dev, struct device_driver *drv)
175176
const struct rpmsg_device_id *ids = rpdrv->id_table;
176177
unsigned int i;
177178

178-
for (i = 0; ids[i].name[0]; i++)
179-
if (rpmsg_id_match(rpdev, &ids[i]))
180-
return 1;
179+
if (ids)
180+
for (i = 0; ids[i].name[0]; i++)
181+
if (rpmsg_id_match(rpdev, &ids[i]))
182+
return 1;
181183

182-
return 0;
184+
return of_driver_match_device(dev, drv);
183185
}
184186

185187
static int rpmsg_uevent(struct device *dev, struct kobj_uevent_env *env)

0 commit comments

Comments
 (0)