Skip to contentSkip to conversation

Revert "ACPI / resources: Use AE_CTRL_TERMINATE to terminate resources walks"

PATCH Applied Daniel Scally 2 participants 2 messages Dec 5, 2020 – Dec 7, 2020 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Revert "ACPI / resources: Use AE_CTRL_TERMINATE to terminate resources walks"

This reverts commit 8a66790b7850a6669129af078768a1d42076a0ef.

Switching this function to AE_CTRL_TERMINATE broke the documented behaviour of acpi_dev_get_resources() - AE_CTRL_TERMINATE does not, in fact, terminate the resource walk because acpi_walk_resource_buffer() ignores it (specifically converting it to AE_OK), referring to that value as "an OK termination by the user function". This means that acpi_dev_get_resources() does not abort processing when the preproc function returns a negative value.

---
 drivers/acpi/resource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/resource.c +1 -1
index ad04824ca3ba..f2f5f1dc7c61 100644
@@ -541,7 +541,7 @@ static acpi_status acpi_dev_process_resource(struct acpi_resource *ares,
 		ret = c->preproc(ares, c->preproc_data);
 		if (ret < 0) {
 			c->error = ret;
-			return AE_CTRL_TERMINATE;
+			return AE_ABORT_METHOD;
 		} else if (ret > 0) {
 			return AE_OK;
 		}
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 21 lines · Daniel Scally

This reverts commit 8a66790b7850a6669129af078768a1d42076a0ef.

Switching this function to AE_CTRL_TERMINATE broke the documented behaviour of acpi_dev_get_resources() - AE_CTRL_TERMINATE does not, in fact, terminate the resource walk because acpi_walk_resource_buffer() ignores it (specifically converting it to AE_OK), referring to that value as "an OK termination by the user function". This means that acpi_dev_get_resources() does not abort processing when the preproc function returns a negative value.

---
 drivers/acpi/resource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/resource.c +0 -0
index ad04824ca3ba..f2f5f1dc7c61 100644

drivers/acpi/resource.c static acpi_status acpi_dev_process_resource(struct acpi_resource *ares,

Quoted 9 lines
drivers/acpi/resource.c +1 -2
@@ -541,7 +541,7 @@ static acpi_status acpi_dev_process_resource(struct acpi_resource *ares,
                ret = c->preproc(ares, c->preproc_data);
                if (ret < 0) {
                        c->error = ret;
-                       return AE_CTRL_TERMINATE;
+                       return AE_ABORT_METHOD;
                } else if (ret > 0) {
                        return AE_OK;
                }
--

Applied as 5.11 material, thanks!