From 07761a4cd43c1d32918e20254236eb96007b1d6c Mon Sep 17 00:00:00 2001 From: chenqiwu Date: Sun, 23 Feb 2020 14:08:22 +0800 Subject: ACPI: list_for_each_safe() -> list_for_each_entry_safe() Replace list_for_each_safe() and open-coded list entry address computations with list_for_each_entry_safe() in several places to simplify code. Signed-off-by: chenqiwu [ rjw: Subject & changelog ] Signed-off-by: Rafael J. Wysocki --- drivers/acpi/proc.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'drivers/acpi/proc.c') diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c index 0e62ef265ce4..7892980b3ce4 100644 --- a/drivers/acpi/proc.c +++ b/drivers/acpi/proc.c @@ -22,14 +22,13 @@ ACPI_MODULE_NAME("sleep") static int acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) { - struct list_head *node, *next; + struct acpi_device *dev, *tmp; seq_printf(seq, "Device\tS-state\t Status Sysfs node\n"); mutex_lock(&acpi_device_lock); - list_for_each_safe(node, next, &acpi_wakeup_device_list) { - struct acpi_device *dev = - container_of(node, struct acpi_device, wakeup_list); + list_for_each_entry_safe(dev, tmp, &acpi_wakeup_device_list, + wakeup_list) { struct acpi_device_physical_node *entry; if (!dev->wakeup.flags.valid) @@ -96,7 +95,7 @@ acpi_system_write_wakeup_device(struct file *file, const char __user * buffer, size_t count, loff_t * ppos) { - struct list_head *node, *next; + struct acpi_device *dev, *tmp; char strbuf[5]; char str[5] = ""; @@ -109,9 +108,8 @@ acpi_system_write_wakeup_device(struct file *file, sscanf(strbuf, "%s", str); mutex_lock(&acpi_device_lock); - list_for_each_safe(node, next, &acpi_wakeup_device_list) { - struct acpi_device *dev = - container_of(node, struct acpi_device, wakeup_list); + list_for_each_entry_safe(dev, tmp, &acpi_wakeup_device_list, + wakeup_list) { if (!dev->wakeup.flags.valid) continue; -- cgit v1.2.3