[PATCH v2 18/20] of: constify string pointed to by struct of_device_id::compatible
Ahmad Fatoum
a.fatoum at pengutronix.de
Wed Nov 22 09:29:49 PST 2023
In Linux struct of_device_id::compatible is a character array, but in
barebox, so far it has been a pointer to char *. As most compatible
strings are smaller than 24 bytes, we are likely saving some space by
using a pointer, so we will keep that is, but let's make the member
const to reflect the fact that it points at immutable strings and to
allow easier use without casting.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
v1 -> v2:
- new patch (Sascha)
---
include/of.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/of.h b/include/of.h
index 5686709fcf0a..e99b41ef6f14 100644
--- a/include/of.h
+++ b/include/of.h
@@ -40,7 +40,7 @@ struct device_node {
};
struct of_device_id {
- char *compatible;
+ const char *compatible;
const void *data;
};
--
2.39.2
More information about the barebox
mailing list