PM: Use LIST_HEAD() to initialize on stack list head
Subsystems (4)
PATCH 1/1 PM: Use LIST_HEAD() to initialize on stack list head
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 <[email protected]>
--- drivers/base/power/clock_ops.c | 4 +--- drivers/base/power/main.c | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/base/power/clock_ops.c +1 -3
@@ -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)
drivers/base/power/main.c +1 -2
@@ -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);
Signature · 1 line
2.53.0
Rafael J. Wysocki
maintainerQuoted 14 lines · Jisheng Zhang
Use
LIST_HEADto initialize on stack list head. No intentional functional impact.Change generated with below coccinelle script:
@@
identifier name;
@@
- structlist_headname;
+LIST_HEAD(name);
... when != name
-INIT_LIST_HEAD(&name);
Quoted 1 line
Signed-off-by Jisheng Zhang <[email protected]>
I'd rather see two separate patches for these changes as they affect unrelated code.
Thanks!
Quoted 42 lines
--- drivers/base/power/clock_ops.c | 4 +--- drivers/base/power/main.c | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-)drivers/base/power/clock_ops.c +1
-3@@ -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)drivers/base/power/main.c +1
-3@@ -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); --