]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
of: dynamic: Constify parameter in of_changeset_add_prop_string_array()
authorHerve Codina <herve.codina@bootlin.com>
Mon, 27 May 2024 16:14:40 +0000 (18:14 +0200)
committerRob Herring (Arm) <robh@kernel.org>
Mon, 8 Jul 2024 23:40:30 +0000 (17:40 -0600)
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>
drivers/of/dynamic.c
include/linux/of.h

index dda6092e6d3a8693a91c3692fd50091bb096fc22..70011a98c500fb580d33bc71ebc52c50f7e05048 100644 (file)
@@ -984,7 +984,7 @@ EXPORT_SYMBOL_GPL(of_changeset_add_prop_string);
 int of_changeset_add_prop_string_array(struct of_changeset *ocs,
                                       struct device_node *np,
                                       const char *prop_name,
-                                      const char **str_array, size_t sz)
+                                      const char * const *str_array, size_t sz)
 {
        struct property prop;
        int i, ret;
index a0bedd038a059b1d8a32644b09b6a73f04eea2d2..ee9a385a13db634f8902605b60a78e7bce9f73bf 100644 (file)
@@ -1639,7 +1639,7 @@ int of_changeset_add_prop_string(struct of_changeset *ocs,
 int of_changeset_add_prop_string_array(struct of_changeset *ocs,
                                       struct device_node *np,
                                       const char *prop_name,
-                                      const char **str_array, size_t sz);
+                                      const char * const *str_array, size_t sz);
 int of_changeset_add_prop_u32_array(struct of_changeset *ocs,
                                    struct device_node *np,
                                    const char *prop_name,