From patchwork Wed Jan 13 18:22:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Hung X-Patchwork-Id: 1425955 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 4DGG5W4kp0z9sVn for ; Thu, 14 Jan 2021 05:22:53 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1kzknA-000143-Qt; Wed, 13 Jan 2021 18:22:48 +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 1kzkn8-00013x-Tv for fwts-devel@lists.ubuntu.com; Wed, 13 Jan 2021 18:22:46 +0000 Received: from 1.general.alexhung.us.vpn ([10.172.65.254] 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 1kzkn8-0006DF-60; Wed, 13 Jan 2021 18:22:46 +0000 From: Alex Hung To: fwts-devel@lists.ubuntu.com Subject: [PATCH][V2] acpi: method: replace _GPE test by fwts_method_package_elements_type Date: Wed, 13 Jan 2021 11:22:43 -0700 Message-Id: <20210113182243.234812-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" Signed-off-by: Alex Hung Acked-by: Colin Ian King Acked-by: Ivan Hu --- src/acpi/method/method.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index cf994343..a6a06338 100644 --- a/src/acpi/method/method.c +++ b/src/acpi/method/method.c @@ -4669,7 +4669,11 @@ static void method_test_GPE_return( { FWTS_UNUSED(private); FWTS_UNUSED(buf); - bool failed = false; + + static const fwts_package_element elem[] = { + { ACPI_TYPE_LOCAL_REFERENCE, "GPE block device" }, + { ACPI_TYPE_INTEGER, "SCI interrupt" }, + }; switch (obj->Type) { case ACPI_TYPE_INTEGER: @@ -4683,19 +4687,7 @@ static void method_test_GPE_return( name, (uint64_t)obj->Integer.Value); break; case ACPI_TYPE_PACKAGE: - if (obj->Package.Elements[0].Type != ACPI_TYPE_LOCAL_REFERENCE) { - failed = true; - fwts_failed(fw, LOG_LEVEL_HIGH, "Method_GPEBadSubPackageReturnType", - "%s sub-package element 0 is not a reference.", name); - } - - if (obj->Package.Elements[1].Type != ACPI_TYPE_INTEGER) { - failed = true; - fwts_failed(fw, LOG_LEVEL_HIGH, "Method_GPEBadSubPackageReturnType", - "%s sub-package element 1 is not an integer.", name); - } - - if (!failed) + if (fwts_method_package_elements_type(fw, name, "_GPE", obj, elem, FWTS_ARRAY_SIZE(elem)) == FWTS_OK) fwts_method_passed_sane(fw, name, "package"); break;