diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-12-09 11:57:08 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-12-14 08:26:54 +0100 |
commit | 20192eb8b7914ee25d7f0dc9e19ff1d6d1e5fa44 (patch) | |
tree | 20a3f099a0bb006ad8795fcd9f884f5679b99a10 /include | |
parent | 3df8dadc8efe1c65da9487f81a084447da2ebdf8 (diff) | |
download | barebox-20192eb8b7914ee25d7f0dc9e19ff1d6d1e5fa44.tar.gz barebox-20192eb8b7914ee25d7f0dc9e19ff1d6d1e5fa44.tar.xz |
of: implement new of_property_sprintf
Board code may compute values for device tree properties and write them
as strings. Make this easier by adding a of_property_write_string
variant that does formatted output. This also saves an allocation,
because asprintf buffer is reused.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211209105708.3517684-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/of.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/of.h b/include/of.h index 1b7392cdb3..e5df4cab4a 100644 --- a/include/of.h +++ b/include/of.h @@ -241,6 +241,8 @@ extern int of_property_write_string(struct device_node *np, const char *propname const char *value); extern int of_property_write_strings(struct device_node *np, const char *propname, ...) __attribute__((__sentinel__)); +int of_property_sprintf(struct device_node *np, const char *propname, const char *fmt, ...) + __attribute__ ((format(__printf__, 3, 4))); extern struct device_node *of_parse_phandle(const struct device_node *np, const char *phandle_name, |