of: use kbasename instead of open coding
Several places in DT code open code the equivalent of kbasename. Replace them. The behavior for root nodes in node_name_cmp will be slightly different. Instead of comparing "/", "" will be compared. The comparison will be the same. Reviewed-by: Andy Shevchenko <andy.shevhchenko@gmail.com> Signed-off-by: Rob Herring <robh@kernel.org>
This commit is contained in:
@@ -165,8 +165,8 @@ err_fail:
|
||||
static int node_name_cmp(const struct device_node *dn1,
|
||||
const struct device_node *dn2)
|
||||
{
|
||||
const char *n1 = strrchr(dn1->full_name, '/') ? : "/";
|
||||
const char *n2 = strrchr(dn2->full_name, '/') ? : "/";
|
||||
const char *n1 = kbasename(dn1->full_name);
|
||||
const char *n2 = kbasename(dn2->full_name);
|
||||
|
||||
return of_node_cmp(n1, n2);
|
||||
}
|
||||
|
Reference in New Issue
Block a user