]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
software node: Constify node_group in registration functions
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 14 Aug 2025 06:03:52 +0000 (23:03 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Aug 2025 11:18:07 +0000 (13:18 +0200)
The software_node_register_node_group() and
software_node_unregister_node_group() functions take in essence an
array of pointers to software_node structs. Since the functions do not
modify the array declare the argument as constant, so that static
arrays can be declared as const and annotated as __initconst.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://lore.kernel.org/r/2zny5grbgtwbplynxffxg6dkgjgqf45aigwmgxio5stesdr3wi@gf2zamk5amic
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/swnode.c
include/linux/property.h

index deda7f35a05987ee89655c9aa9e750245e0eed67..be1e9e61a7bf4d1301a3e109628517cfd9214704 100644 (file)
@@ -844,7 +844,7 @@ swnode_register(const struct software_node *node, struct swnode *parent,
  * of this function or by ordering the array such that parent comes before
  * child.
  */
-int software_node_register_node_group(const struct software_node **node_group)
+int software_node_register_node_group(const struct software_node * const *node_group)
 {
        unsigned int i;
        int ret;
@@ -877,8 +877,7 @@ EXPORT_SYMBOL_GPL(software_node_register_node_group);
  * remove the nodes individually, in the correct order (child before
  * parent).
  */
-void software_node_unregister_node_group(
-               const struct software_node **node_group)
+void software_node_unregister_node_group(const struct software_node * const *node_group)
 {
        unsigned int i = 0;
 
index 82f0cb3abd1e229f7fc009f3ee2f211e6d003e51..d1e80b3c9918b35b70ad977ff277b686ba1478a7 100644 (file)
@@ -574,8 +574,8 @@ const struct software_node *
 software_node_find_by_name(const struct software_node *parent,
                           const char *name);
 
-int software_node_register_node_group(const struct software_node **node_group);
-void software_node_unregister_node_group(const struct software_node **node_group);
+int software_node_register_node_group(const struct software_node * const *node_group);
+void software_node_unregister_node_group(const struct software_node * const *node_group);
 
 int software_node_register(const struct software_node *node);
 void software_node_unregister(const struct software_node *node);