Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] PM: Use LIST_HEAD() to initialize on stack list head
@ 2026-05-19  5:59 Jisheng Zhang
  0 siblings, 0 replies; only message in thread
From: Jisheng Zhang @ 2026-05-19  5:59 UTC (permalink / raw)
  To: Rafael J . Wysocki, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich
  Cc: linux-pm, driver-core, linux-kernel

Use LIST_HEAD to initialize on stack list head. No intentional
functional impact.

Change generated with below coccinelle script:

@@
identifier name;
@@
- struct list_head name;
+ LIST_HEAD(name);
... when != name
- INIT_LIST_HEAD(&name);

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
 drivers/base/power/clock_ops.c | 4 +---
 drivers/base/power/main.c      | 3 +--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c
index 59bb37e8244c..1f708e10e711 100644
--- a/drivers/base/power/clock_ops.c
+++ b/drivers/base/power/clock_ops.c
@@ -422,13 +422,11 @@ void pm_clk_destroy(struct device *dev)
 {
 	struct pm_subsys_data *psd = dev_to_psd(dev);
 	struct pm_clock_entry *ce, *c;
-	struct list_head list;
+	LIST_HEAD(list);
 
 	if (!psd)
 		return;
 
-	INIT_LIST_HEAD(&list);
-
 	pm_clk_list_lock(psd);
 
 	list_for_each_entry_safe_reverse(ce, c, &psd->clock_list, node)
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index e1b550664bab..d0c7b1d4101e 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1257,11 +1257,10 @@ static void device_complete(struct device *dev, pm_message_t state)
  */
 void dpm_complete(pm_message_t state)
 {
-	struct list_head list;
+	LIST_HEAD(list);
 
 	trace_suspend_resume(TPS("dpm_complete"), state.event, true);
 
-	INIT_LIST_HEAD(&list);
 	mutex_lock(&dpm_list_mtx);
 	while (!list_empty(&dpm_prepared_list)) {
 		struct device *dev = to_device(dpm_prepared_list.prev);
-- 
2.53.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-05-19  6:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-19  5:59 [PATCH] PM: Use LIST_HEAD() to initialize on stack list head Jisheng Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox