Skip to content

Commit 6d0a70a

Browse files
committed
vsprintf: print OF node name using full_name
In preparation to remove the node name pointer from struct device_node, convert the node name print to get the node name from the full name. Reviewed-by: Frank Rowand <frank.rowand@sony.com> Signed-off-by: Rob Herring <robh@kernel.org>
1 parent a613b26 commit 6d0a70a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/vsprintf.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1596,6 +1596,7 @@ char *device_node_string(char *buf, char *end, struct device_node *dn,
15961596
fmt = "f";
15971597

15981598
for (pass = false; strspn(fmt,"fnpPFcC"); fmt++, pass = true) {
1599+
int precision;
15991600
if (pass) {
16001601
if (buf < end)
16011602
*buf = ':';
@@ -1607,7 +1608,11 @@ char *device_node_string(char *buf, char *end, struct device_node *dn,
16071608
buf = device_node_gen_full_name(dn, buf, end);
16081609
break;
16091610
case 'n': /* name */
1610-
buf = string(buf, end, dn->name, str_spec);
1611+
p = kbasename(of_node_full_name(dn));
1612+
precision = str_spec.precision;
1613+
str_spec.precision = strchrnul(p, '@') - p;
1614+
buf = string(buf, end, p, str_spec);
1615+
str_spec.precision = precision;
16111616
break;
16121617
case 'p': /* phandle */
16131618
buf = number(buf, end, (unsigned int)dn->phandle, num_spec);

0 commit comments

Comments
 (0)