[PATCH v2 16/16] ACPI: bus: Drop unused list heads from struct acpi_device

From: Rafael J. Wysocki
Date: Mon Jun 13 2022 - 16:06:25 EST


From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>

Drop the children and node list heads that have no more users
from struct acpi_device and the code manipulating them from
__acpi_device_add() and acpi_device_del().

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---

v1 -> v2:
* Add R-by from Andy.

---
drivers/acpi/scan.c | 11 +----------
include/acpi/acpi_bus.h | 2 --
2 files changed, 1 insertion(+), 12 deletions(-)

Index: linux-pm/include/acpi/acpi_bus.h
===================================================================
--- linux-pm.orig/include/acpi/acpi_bus.h
+++ linux-pm/include/acpi/acpi_bus.h
@@ -365,8 +365,6 @@ struct acpi_device {
acpi_handle handle; /* no handle for fixed hardware */
struct fwnode_handle fwnode;
struct acpi_device *parent;
- struct list_head children;
- struct list_head node;
struct list_head wakeup_list;
struct list_head del_list;
struct acpi_device_status status;
Index: linux-pm/drivers/acpi/scan.c
===================================================================
--- linux-pm.orig/drivers/acpi/scan.c
+++ linux-pm/drivers/acpi/scan.c
@@ -465,8 +465,6 @@ static void acpi_device_del(struct acpi_
struct acpi_device_bus_id *acpi_device_bus_id;

mutex_lock(&acpi_device_lock);
- if (device->parent)
- list_del(&device->node);

list_for_each_entry(acpi_device_bus_id, &acpi_bus_id_list, node)
if (!strcmp(acpi_device_bus_id->bus_id,
@@ -482,6 +480,7 @@ static void acpi_device_del(struct acpi_
}

list_del(&device->wakeup_list);
+
mutex_unlock(&acpi_device_lock);

acpi_power_add_remove_device(device, false);
@@ -674,8 +673,6 @@ static int __acpi_device_add(struct acpi
* -------
* Link this device to its parent and siblings.
*/
- INIT_LIST_HEAD(&device->children);
- INIT_LIST_HEAD(&device->node);
INIT_LIST_HEAD(&device->wakeup_list);
INIT_LIST_HEAD(&device->physical_node_list);
INIT_LIST_HEAD(&device->del_list);
@@ -715,9 +712,6 @@ static int __acpi_device_add(struct acpi
list_add_tail(&acpi_device_bus_id->node, &acpi_bus_id_list);
}

- if (device->parent)
- list_add_tail(&device->node, &device->parent->children);
-
if (device->wakeup.flags.valid)
list_add_tail(&device->wakeup_list, &acpi_wakeup_device_list);

@@ -746,9 +740,6 @@ static int __acpi_device_add(struct acpi
err:
mutex_lock(&acpi_device_lock);

- if (device->parent)
- list_del(&device->node);
-
list_del(&device->wakeup_list);

err_unlock: