diff options
Diffstat (limited to 'drivers/of/base.c')
-rw-r--r-- | drivers/of/base.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index a4b608776c73..7792266db259 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -502,6 +502,28 @@ int of_device_is_compatible(const struct device_node *device, | |||
502 | } | 502 | } |
503 | EXPORT_SYMBOL(of_device_is_compatible); | 503 | EXPORT_SYMBOL(of_device_is_compatible); |
504 | 504 | ||
505 | /** Checks if the device is compatible with any of the entries in | ||
506 | * a NULL terminated array of strings. Returns the best match | ||
507 | * score or 0. | ||
508 | */ | ||
509 | int of_device_compatible_match(struct device_node *device, | ||
510 | const char *const *compat) | ||
511 | { | ||
512 | unsigned int tmp, score = 0; | ||
513 | |||
514 | if (!compat) | ||
515 | return 0; | ||
516 | |||
517 | while (*compat) { | ||
518 | tmp = of_device_is_compatible(device, *compat); | ||
519 | if (tmp > score) | ||
520 | score = tmp; | ||
521 | compat++; | ||
522 | } | ||
523 | |||
524 | return score; | ||
525 | } | ||
526 | |||
505 | /** | 527 | /** |
506 | * of_machine_is_compatible - Test root of device tree for a given compatible value | 528 | * of_machine_is_compatible - Test root of device tree for a given compatible value |
507 | * @compat: compatible string to look for in root node's compatible property. | 529 | * @compat: compatible string to look for in root node's compatible property. |