Skip to content

Commit 6badc62

Browse files
hcodinarobherring
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring (Arm) <[email protected]>
1 parent 38da7fa commit 6badc62

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/of/dynamic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ EXPORT_SYMBOL_GPL(of_changeset_add_prop_string);
984984
int of_changeset_add_prop_string_array(struct of_changeset *ocs,
985985
struct device_node *np,
986986
const char *prop_name,
987-
const char **str_array, size_t sz)
987+
const char * const *str_array, size_t sz)
988988
{
989989
struct property prop;
990990
int i, ret;

include/linux/of.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1639,7 +1639,7 @@ int of_changeset_add_prop_string(struct of_changeset *ocs,
16391639
int of_changeset_add_prop_string_array(struct of_changeset *ocs,
16401640
struct device_node *np,
16411641
const char *prop_name,
1642-
const char **str_array, size_t sz);
1642+
const char * const *str_array, size_t sz);
16431643
int of_changeset_add_prop_u32_array(struct of_changeset *ocs,
16441644
struct device_node *np,
16451645
const char *prop_name,

0 commit comments

Comments
 (0)