|
@@ -493,6 +493,28 @@ int of_device_is_compatible(const struct device_node *device,
|
|
|
}
|
|
|
EXPORT_SYMBOL(of_device_is_compatible);
|
|
|
|
|
|
+/** Checks if the device is compatible with any of the entries in
|
|
|
+ * a NULL terminated array of strings. Returns the best match
|
|
|
+ * score or 0.
|
|
|
+ */
|
|
|
+int of_device_compatible_match(struct device_node *device,
|
|
|
+ const char *const *compat)
|
|
|
+{
|
|
|
+ unsigned int tmp, score = 0;
|
|
|
+
|
|
|
+ if (!compat)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ while (*compat) {
|
|
|
+ tmp = of_device_is_compatible(device, *compat);
|
|
|
+ if (tmp > score)
|
|
|
+ score = tmp;
|
|
|
+ compat++;
|
|
|
+ }
|
|
|
+
|
|
|
+ return score;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* of_machine_is_compatible - Test root of device tree for a given compatible value
|
|
|
* @compat: compatible string to look for in root node's compatible property.
|