From patchwork Tue May 5 01:01:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Hung X-Patchwork-Id: 1283162 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49GLyt5bLgz9sSW; Tue, 5 May 2020 11:01:42 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1jVlxq-0007Rs-Vc; Tue, 05 May 2020 01:01:38 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jVlxo-0007RF-Hk for fwts-devel@lists.ubuntu.com; Tue, 05 May 2020 01:01:36 +0000 Received: from 2.general.alexhung.us.vpn ([10.172.65.255] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jVlxn-0006bY-Vr; Tue, 05 May 2020 01:01:36 +0000 From: Alex Hung To: fwts-devel@lists.ubuntu.com Subject: [PATCH] acpi/method: refactor with fwts_method_test_all_reference_package_return Date: Mon, 4 May 2020 19:01:33 -0600 Message-Id: <20200505010133.275857-1-alex.hung@canonical.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" This includes _EDL, _DEP, _PRL, _PMD, _PSL and _TZD Signed-off-by: Alex Hung Acked-by: Colin Ian King Acked-by: Ivan Hu --- src/acpi/method/method.c | 121 ++------------------------------------- 1 file changed, 6 insertions(+), 115 deletions(-) diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index 230717e5..3641f94e 100644 --- a/src/acpi/method/method.c +++ b/src/acpi/method/method.c @@ -1136,29 +1136,10 @@ static int method_test_CCA(fwts_framework *fw) /* * Section 6.3 Device Insertion, Removal and Status Objects */ -static void method_test_EDL_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_PACKAGE) != FWTS_OK) - return; - - if (fwts_method_package_elements_all_type(fw, name, "_EDL", - obj, ACPI_TYPE_LOCAL_REFERENCE) != FWTS_OK) - return; - - fwts_method_passed_sane(fw, name, "package"); -} - static int method_test_EDL(fwts_framework *fw) { return method_evaluate_method(fw, METHOD_OPTIONAL, - "_EDL", NULL, 0, method_test_EDL_return, NULL); + "_EDL", NULL, 0, fwts_method_test_all_reference_package_return, "_EDL"); } static int method_test_EJD(fwts_framework *fw) @@ -1261,28 +1242,10 @@ static int method_test_BDN(fwts_framework *fw) NULL, 0, fwts_method_test_integer_return, "_BDN"); } -static void method_test_DEP_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_PACKAGE) != FWTS_OK) - return; - - if (fwts_method_package_elements_all_type(fw, name, "_DEP", obj, ACPI_TYPE_LOCAL_REFERENCE) != FWTS_OK) - return; - - fwts_method_passed_sane(fw, name, "package"); -} - static int method_test_DEP(fwts_framework *fw) { return method_evaluate_method(fw, METHOD_OPTIONAL, - "_DEP", NULL, 0, method_test_DEP_return, NULL); + "_DEP", NULL, 0, fwts_method_test_all_reference_package_return, "_DEP"); } static int method_test_FIT(fwts_framework *fw) @@ -4467,28 +4430,10 @@ static int method_test_BMC(fwts_framework *fw) /* * Section 10.3 AC Adapters and Power Sources Objects */ -static void method_test_PRL_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_PACKAGE) != FWTS_OK) - return; - - if (fwts_method_package_elements_all_type(fw, name, "_PRL", obj, ACPI_TYPE_LOCAL_REFERENCE) != FWTS_OK) - return; - - fwts_method_passed_sane(fw, name, "package"); -} - static int method_test_PRL(fwts_framework *fw) { return method_evaluate_method(fw, METHOD_OPTIONAL, - "_PRL", NULL, 0, method_test_PRL_return, NULL); + "_PRL", NULL, 0, fwts_method_test_all_reference_package_return, "_PRL"); } static void method_test_PSR_return( @@ -4673,28 +4618,10 @@ static int method_test_PMC(fwts_framework *fw) "_PMC", NULL, 0, method_test_PMC_return, NULL); } -static void method_test_PMD_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_PACKAGE) != FWTS_OK) - return; - - if (fwts_method_package_elements_all_type(fw, name, "_PMD", obj, ACPI_TYPE_LOCAL_REFERENCE) != FWTS_OK) - return; - - fwts_method_passed_sane(fw, name, "package"); -} - static int method_test_PMD(fwts_framework *fw) { return method_evaluate_method(fw, METHOD_OPTIONAL, - "_PMD", NULL, 0, method_test_PMD_return, NULL); + "_PMD", NULL, 0, fwts_method_test_all_reference_package_return, "_PMD"); } static int method_test_PMM(fwts_framework *fw) @@ -5120,28 +5047,10 @@ static int method_test_ART(fwts_framework *fw) "_ART", NULL, 0, method_test_ART_return, "_ART"); } -static void method_test_PSL_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_PACKAGE) != FWTS_OK) - return; - - if (fwts_method_package_elements_all_type(fw, name, "_PSL", obj, ACPI_TYPE_LOCAL_REFERENCE) != FWTS_OK) - return; - - fwts_method_passed_sane(fw, name, "package"); -} - static int method_test_PSL(fwts_framework *fw) { return method_evaluate_method(fw, METHOD_OPTIONAL, - "_PSL", NULL, 0, method_test_PSL_return, "_PSL"); + "_PSL", NULL, 0, fwts_method_test_all_reference_package_return, "_PSL"); } static void method_test_TRT_return( @@ -5365,28 +5274,10 @@ static int method_test_TPT(fwts_framework *fw) "_TPT", arg, 1, fwts_method_test_NULL_return, NULL); } -static void method_test_TZD_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_PACKAGE) != FWTS_OK) - return; - - if (fwts_method_package_elements_all_type(fw, name, "_TZD", obj, ACPI_TYPE_LOCAL_REFERENCE) != FWTS_OK) - return; - - fwts_passed(fw, "%s returned a sane package of %" PRIu32 " references.", name, obj->Package.Count); -} - static int method_test_TZD(fwts_framework *fw) { return method_evaluate_method(fw, METHOD_OPTIONAL, - "_TZD", NULL, 0, method_test_TZD_return, "_TZD"); + "_TZD", NULL, 0, fwts_method_test_all_reference_package_return, "_TZD"); } static int method_test_TZM(fwts_framework *fw)