diff options
author | Rob Herring <robh@kernel.org> | 2018-08-27 08:13:56 -0500 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2018-09-07 11:04:41 -0500 |
commit | 6d0a70a284be782e8b0120de75398a1a1155a50c (patch) | |
tree | 4879fc68905528a02a0ed3cec062342e5acc9a34 /lib/vsprintf.c | |
parent | a613b26a50136ae90ab13943afe90bcbd34adb44 (diff) | |
download | lwn-6d0a70a284be782e8b0120de75398a1a1155a50c.tar.gz lwn-6d0a70a284be782e8b0120de75398a1a1155a50c.zip |
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>
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r-- | lib/vsprintf.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index d5b3a3f95c01..b1909ca75593 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -1596,6 +1596,7 @@ char *device_node_string(char *buf, char *end, struct device_node *dn, fmt = "f"; for (pass = false; strspn(fmt,"fnpPFcC"); fmt++, pass = true) { + int precision; if (pass) { if (buf < end) *buf = ':'; @@ -1607,7 +1608,11 @@ char *device_node_string(char *buf, char *end, struct device_node *dn, buf = device_node_gen_full_name(dn, buf, end); break; case 'n': /* name */ - buf = string(buf, end, dn->name, str_spec); + p = kbasename(of_node_full_name(dn)); + precision = str_spec.precision; + str_spec.precision = strchrnul(p, '@') - p; + buf = string(buf, end, p, str_spec); + str_spec.precision = precision; break; case 'p': /* phandle */ buf = number(buf, end, (unsigned int)dn->phandle, num_spec); |