summaryrefslogtreecommitdiffstats
path: root/lib/vsprintf.c
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2019-10-03 14:32:17 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-10-11 11:26:55 +0200
commit83abc5a77f3b028b8c845c39ce4053119e1de35b (patch)
tree6d75d7de578e75dcc781364d073414e258a677c9 /lib/vsprintf.c
parentlib/vsprintf: Make use of fwnode API to obtain node names and separators (diff)
downloadlinux-83abc5a77f3b028b8c845c39ce4053119e1de35b.tar.xz
linux-83abc5a77f3b028b8c845c39ce4053119e1de35b.zip
lib/vsprintf: OF nodes are first and foremost, struct device_nodes
Factor out static kobject_string() function that simply calls device_node_string(), and thus remove references to kobjects (as these are struct device_node). Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r--lib/vsprintf.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 6917d36f7ec9..4b766ee00dea 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1915,6 +1915,9 @@ char *device_node_string(char *buf, char *end, struct device_node *dn,
struct printf_spec str_spec = spec;
str_spec.field_width = -1;
+ if (fmt[0] != 'F')
+ return error_string(buf, end, "(%pO?)", spec);
+
if (!IS_ENABLED(CONFIG_OF))
return error_string(buf, end, "(%pOF?)", spec);
@@ -1988,17 +1991,6 @@ char *device_node_string(char *buf, char *end, struct device_node *dn,
return widen_string(buf, buf - buf_start, end, spec);
}
-static char *kobject_string(char *buf, char *end, void *ptr,
- struct printf_spec spec, const char *fmt)
-{
- switch (fmt[1]) {
- case 'F':
- return device_node_string(buf, end, ptr, spec, fmt + 1);
- }
-
- return error_string(buf, end, "(%pO?)", spec);
-}
-
/*
* Show a '%p' thing. A kernel extension is that the '%p' is followed
* by an extra set of alphanumeric characters that are extended format
@@ -2177,7 +2169,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
case 'G':
return flags_string(buf, end, ptr, spec, fmt);
case 'O':
- return kobject_string(buf, end, ptr, spec, fmt);
+ return device_node_string(buf, end, ptr, spec, fmt + 1);
case 'x':
return pointer_string(buf, end, ptr, spec);
}