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

software node: Constify node_group in registration functions

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>

authored by

Dmitry Torokhov and committed by
Greg Kroah-Hartman
292cb391 1e180614

+4 -5
+2 -3
drivers/base/swnode.c
··· 844 844 * of this function or by ordering the array such that parent comes before 845 845 * child. 846 846 */ 847 - int software_node_register_node_group(const struct software_node **node_group) 847 + int software_node_register_node_group(const struct software_node * const *node_group) 848 848 { 849 849 unsigned int i; 850 850 int ret; ··· 877 877 * remove the nodes individually, in the correct order (child before 878 878 * parent). 879 879 */ 880 - void software_node_unregister_node_group( 881 - const struct software_node **node_group) 880 + void software_node_unregister_node_group(const struct software_node * const *node_group) 882 881 { 883 882 unsigned int i = 0; 884 883
+2 -2
include/linux/property.h
··· 574 574 software_node_find_by_name(const struct software_node *parent, 575 575 const char *name); 576 576 577 - int software_node_register_node_group(const struct software_node **node_group); 578 - void software_node_unregister_node_group(const struct software_node **node_group); 577 + int software_node_register_node_group(const struct software_node * const *node_group); 578 + void software_node_unregister_node_group(const struct software_node * const *node_group); 579 579 580 580 int software_node_register(const struct software_node *node); 581 581 void software_node_unregister(const struct software_node *node);