ACPI: remove unnecessary INIT_LIST_HEAD
PATCH 1/1 ACPI: remove unnecessary INIT_LIST_HEAD
There is no need to initialize the node before appending it to the list.
--- drivers/acpi/resource.c | 1 - 1 file changed, 1 deletion(-)
drivers/acpi/resource.c +0 -1
@@ -426,7 +426,6 @@ static acpi_status acpi_dev_new_resource_entry(struct resource *r, c->error = -ENOMEM ;return AE_NO_MEMORY ; } -INIT_LIST_HEAD (&rentry->node); rentry->res = *r;list_add_tail (&rentry->node, c->list); c->count++;
Signature · 1 line
1.7.10.4
Quoted 1 line · Andy Shevchenko
There is no need to initialize the node before appending it to the list.
I might be missing something but why do we then have macros like:list_del_init() etc?
Quoted 20 lines
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/acpi/resource.c | 1 - 1 file changed, 1 deletion(-)drivers/acpi/resource.c +0
-1@@ -426,7 +426,6 @@ static acpi_status acpi_dev_new_resource_entry(struct resource *r, c->error = -ENOMEM ;return AE_NO_MEMORY ; } -INIT_LIST_HEAD (&rentry->node); rentry->res = *r;list_add_tail (&rentry->node, c->list); c->count++;Signature · 1 line
1.7.10.4
Quoted 5 lines · Mika
Quoted 1 line · Andy Shevchenko
There is no need to initialize the node before appending it to the list.
I might be missing something but why do we then have macros like:
list_del_init()etc?
list_del_init(&list->node) allows to reuse &list->node as a new list. I guess the often use case of that when you extract the leaf node from the list of lists and create a new list based on it.
In our case we just add a node to the existed list.
Quoted 20 lines
Quoted 20 lines
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/acpi/resource.c | 1 - 1 file changed, 1 deletion(-)drivers/acpi/resource.c +0
-1@@ -426,7 +426,6 @@ static acpi_status acpi_dev_new_resource_entry(struct resource *r, c->error = -ENOMEM ;return AE_NO_MEMORY ; } -INIT_LIST_HEAD (&rentry->node); rentry->res = *r;list_add_tail (&rentry->node, c->list); c->count++;Signature · 1 line
1.7.10.4
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Westerberg, Mika
Reviewed-by Mika WesterbergQuoted 4 lines · Andy Shevchenko
Quoted 3 lines · Mika
Quoted 1 line · Andy Shevchenko
There is no need to initialize the node before appending it to the list.
Quoted 8 lines
Quoted 2 lines
I might be missing something but why do we then have macros like:
list_del_init()etc?
list_del_init(&list->node)allows to reuse&list->nodeas a new list. I guess the often use case of that when you extract the leaf node from the list of lists and create a new list based on it.In our case we just add a node to the existed list.
OK. Thanks for the explanation.
Rafael J. Wysocki
AppliedQuoted 12 lines · Mika
Quoted 11 lines · Andy Shevchenko
Quoted 5 lines · Mika
Quoted 1 line · Andy Shevchenko
There is no need to initialize the node before appending it to the list.
I might be missing something but why do we then have macros like:
list_del_init()etc?
list_del_init(&list->node)allows to reuse&list->nodeas a new list. I guess the often use case of that when you extract the leaf node from the list of lists and create a new list based on it.
Quoted 5 lines
Quoted 1 line
In our case we just add a node to the existed list.
OK. Thanks for the explanation.
Reviewed-by Mika Westerberg <[email protected]>
Applied.
Thanks,
Rafael
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.