Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

of: dynamic: Constify parameter in of_changeset_add_prop_string_array()

The str_array parameter has no reason to be an un-const array.
Indeed, elements of the 'str_array' array are not changed by the code.

Constify the 'str_array' array parameter.
With this const qualifier added, the following construction is allowed:
static const char * const tab_str[] = { "string1", "string2" };
of_changeset_add_prop_string_array(..., tab_str, ARRAY_SIZE(tab_str));

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Link: https://lore.kernel.org/r/20240527161450.326615-14-herve.codina@bootlin.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

authored by

Herve Codina and committed by
Rob Herring (Arm)
6badc62f 38da7fa4

+2 -2
+1 -1
drivers/of/dynamic.c
··· 984 984 int of_changeset_add_prop_string_array(struct of_changeset *ocs, 985 985 struct device_node *np, 986 986 const char *prop_name, 987 - const char **str_array, size_t sz) 987 + const char * const *str_array, size_t sz) 988 988 { 989 989 struct property prop; 990 990 int i, ret;
+1 -1
include/linux/of.h
··· 1639 1639 int of_changeset_add_prop_string_array(struct of_changeset *ocs, 1640 1640 struct device_node *np, 1641 1641 const char *prop_name, 1642 - const char **str_array, size_t sz); 1642 + const char * const *str_array, size_t sz); 1643 1643 int of_changeset_add_prop_u32_array(struct of_changeset *ocs, 1644 1644 struct device_node *np, 1645 1645 const char *prop_name,