linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] software node: Constify node_group in registration functions
@ 2025-08-14  6:03 Dmitry Torokhov
  2025-08-20 14:42 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Torokhov @ 2025-08-14  6:03 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Andy Shevchenko, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Rafael J. Wysocki, Danilo Krummrich, linux-acpi, linux-kernel

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>
---
 drivers/base/swnode.c    | 5 ++---
 include/linux/property.h | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
index deda7f35a059..be1e9e61a7bf 100644
--- a/drivers/base/swnode.c
+++ b/drivers/base/swnode.c
@@ -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;
 
diff --git a/include/linux/property.h b/include/linux/property.h
index f718dd4789e5..a8cc3e102f45 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -573,8 +573,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);
-- 
2.51.0.rc0.215.g125493bb4a-goog


-- 
Dmitry

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] software node: Constify node_group in registration functions
  2025-08-14  6:03 [PATCH] software node: Constify node_group in registration functions Dmitry Torokhov
@ 2025-08-20 14:42 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2025-08-20 14:42 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Greg Kroah-Hartman, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Rafael J. Wysocki, Danilo Krummrich, linux-acpi, linux-kernel

On Wed, Aug 13, 2025 at 11:03:52PM -0700, Dmitry Torokhov wrote:
> 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.

If it compiles and works, no objection from me from code perspective:
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-20 14:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-14  6:03 [PATCH] software node: Constify node_group in registration functions Dmitry Torokhov
2025-08-20 14:42 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).