summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-09-30 14:53:01 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-10-02 06:09:59 +0200
commit09cbc3fbdab5f3118062ceeefb0c1b043a75b3fb (patch)
tree8a1191179d41869146e25b03ec00ee0e4d2d36d2 /include
parentf91786df4b06af94a2bc59a8290e84668aa49358 (diff)
downloadbarebox-09cbc3fbdab5f3118062ceeefb0c1b043a75b3fb.tar.gz
barebox-09cbc3fbdab5f3118062ceeefb0c1b043a75b3fb.tar.xz
of: implement of_property_write_strings for multiple strings
The current way to set a property with multiple values (e.g. compatible strings) is to have char properties[] = "st,stm32mp157c-dk2\0st,stm32mp157"; of_set_property(np, "compatible", properties, sizeof(properties), 1); Add a new helper to make this easier at the cost of one runtime reallocation: of_property_write_strings(np, "compatible, "st,stm32mp157c-dk2", "st,stm32mp157", NULL); Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/of.h2
-rw-r--r--include/string.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/include/of.h b/include/of.h
index d548e51789..e60cb5307d 100644
--- a/include/of.h
+++ b/include/of.h
@@ -231,6 +231,8 @@ extern int of_property_write_u64_array(struct device_node *np,
size_t sz);
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__));
extern struct device_node *of_parse_phandle(const struct device_node *np,
const char *phandle_name,
diff --git a/include/string.h b/include/string.h
index 063e85f62c..b51566fd00 100644
--- a/include/string.h
+++ b/include/string.h
@@ -6,6 +6,7 @@
int strtobool(const char *str, int *val);
char *strsep_unescaped(char **, const char *);
+char *stpcpy(char *dest, const char *src);
void *__default_memset(void *, int, __kernel_size_t);
void *__nokasan_default_memset(void *, int, __kernel_size_t);