[PATCH] acpi/method: remove duplicated code in _PSR test

Alex Hung alex.hung at canonical.com
Fri May 15 23:59:51 UTC 2020


fwts_method_test_passed_failed_return is used since _PSR returns 0 or 1
only.

Signed-off-by: Alex Hung <alex.hung at canonical.com>
---
 src/acpi/method/method.c | 24 +-----------------------
 1 file changed, 1 insertion(+), 23 deletions(-)

diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
index 11e230ea..b2029412 100644
--- a/src/acpi/method/method.c
+++ b/src/acpi/method/method.c
@@ -4212,32 +4212,10 @@ static int method_test_PRL(fwts_framework *fw)
 		"_PRL", NULL, 0, fwts_method_test_all_reference_package_return, "_PRL");
 }
 
-static void method_test_PSR_return(
-	fwts_framework *fw,
-	char *name,
-	ACPI_BUFFER *buf,
-	ACPI_OBJECT *obj,
-	void *private)
-{
-	FWTS_UNUSED(private);
-
-	if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_INTEGER) != FWTS_OK)
-		return;
-
-	if (obj->Integer.Value > 2) {
-		fwts_failed(fw, LOG_LEVEL_MEDIUM,
-			"Method_PSRZeroOrOne",
-			"%s returned 0x%8.8" PRIx64 ", expected 0 "
-			"(offline) or 1 (online)",
-			name, (uint64_t)obj->Integer.Value);
-	} else
-		fwts_method_passed_sane_uint64(fw, name, obj->Integer.Value);
-}
-
 static int method_test_PSR(fwts_framework *fw)
 {
 	return method_evaluate_method(fw, METHOD_OPTIONAL,
-		"_PSR", NULL, 0, method_test_PSR_return, NULL);
+		"_PSR", NULL, 0, fwts_method_test_passed_failed_return, "_PSR");
 }
 
 static void method_test_PIF_return(
-- 
2.25.1




More information about the fwts-devel mailing list