diff options
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r-- | drivers/base/bus.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 5251be6b2e..4357020241 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -46,3 +46,27 @@ int bus_register(struct bus_type *bus) return 0; } + +int device_match(struct device_d *dev, struct driver_d *drv) +{ + if (IS_ENABLED(CONFIG_OFDEVICE) && dev->device_node && + drv->of_compatible) + return of_match(dev, drv); + + if (!strcmp(dev->name, drv->name)) + return 0; + + if (drv->id_table) { + struct platform_device_id *id = drv->id_table; + + while (id->name) { + if (!strcmp(id->name, dev->name)) { + dev->id_entry = id; + return 0; + } + id++; + } + } + + return -1; +} |