Merge tag 'x86_cleanups_for_v6.4_rc1' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-block.git] / drivers / of / base.c
index 7f1720af813cb8c6b3507e2a66603f41cea2518a..166fb7d7533784584cd9a630d3886be1f17ce7d1 100644 (file)
@@ -1021,19 +1021,23 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from,
 EXPORT_SYMBOL(of_find_matching_node_and_match);
 
 /**
- * of_modalias_node - Lookup appropriate modalias for a device node
+ * of_alias_from_compatible - Lookup appropriate alias for a device node
+ *                           depending on compatible
  * @node:      pointer to a device tree node
- * @modalias:  Pointer to buffer that modalias value will be copied into
- * @len:       Length of modalias value
+ * @alias:     Pointer to buffer that alias value will be copied into
+ * @len:       Length of alias value
  *
  * Based on the value of the compatible property, this routine will attempt
- * to choose an appropriate modalias value for a particular device tree node.
+ * to choose an appropriate alias value for a particular device tree node.
  * It does this by stripping the manufacturer prefix (as delimited by a ',')
  * from the first entry in the compatible list property.
  *
+ * Note: The matching on just the "product" side of the compatible is a relic
+ * from I2C and SPI. Please do not add any new user.
+ *
  * Return: This routine returns 0 on success, <0 on failure.
  */
-int of_modalias_node(struct device_node *node, char *modalias, int len)
+int of_alias_from_compatible(const struct device_node *node, char *alias, int len)
 {
        const char *compatible, *p;
        int cplen;
@@ -1042,10 +1046,10 @@ int of_modalias_node(struct device_node *node, char *modalias, int len)
        if (!compatible || strlen(compatible) > cplen)
                return -ENODEV;
        p = strchr(compatible, ',');
-       strscpy(modalias, p ? p + 1 : compatible, len);
+       strscpy(alias, p ? p + 1 : compatible, len);
        return 0;
 }
-EXPORT_SYMBOL_GPL(of_modalias_node);
+EXPORT_SYMBOL_GPL(of_alias_from_compatible);
 
 /**
  * of_find_node_by_phandle - Find a node given a phandle