summaryrefslogtreecommitdiffstats
path: root/drivers/base/bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r--drivers/base/bus.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 1038d20a12..aac5b69f34 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -75,7 +75,7 @@ int device_match_of_modalias(struct device_d *dev, struct driver_d *drv)
{
const struct platform_device_id *id = drv->id_table;
const char *of_modalias = NULL, *p;
- int cplen;
+ const struct property *prop;
const char *compat;
if (!device_match(dev, drv))
@@ -84,25 +84,16 @@ int device_match_of_modalias(struct device_d *dev, struct driver_d *drv)
if (!id || !IS_ENABLED(CONFIG_OFDEVICE) || !dev->device_node)
return -1;
- compat = of_get_property(dev->device_node, "compatible", &cplen);
- if (!compat)
- return -1;
-
- p = strchr(compat, ',');
- of_modalias = p ? p + 1 : compat;
-
- while (id->name) {
- if (!strcmp(id->name, dev->name)) {
- dev->id_entry = id;
- return 0;
- }
+ of_property_for_each_string(dev->device_node, "compatible", prop, compat) {
+ p = strchr(compat, ',');
+ of_modalias = p ? p + 1 : compat;
- if (of_modalias && !strcmp(id->name, of_modalias)) {
- dev->id_entry = id;
- return 0;
+ for (id = drv->id_table; id->name; id++) {
+ if (!strcmp(id->name, dev->name) || !strcmp(id->name, of_modalias)) {
+ dev->id_entry = id;
+ return 0;
+ }
}
-
- id++;
}
return -1;