From patchwork Tue May 5 21:44:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Hung X-Patchwork-Id: 1283967 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 49GtYs3XW2z9sRY; Wed, 6 May 2020 07:45:20 +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 1jW5NN-0007e7-H0; Tue, 05 May 2020 21:45:17 +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 1jW5NL-0007dz-NV for fwts-devel@lists.ubuntu.com; Tue, 05 May 2020 21:45:15 +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 1jW5Mt-00056q-Hs; Tue, 05 May 2020 21:44:48 +0000 From: Alex Hung To: fwts-devel@lists.ubuntu.com Subject: [PATCH][V2] acpi/method/battery: replace hardcoded array length by FWTS_ARRAY_SIZE Date: Tue, 5 May 2020 15:44:45 -0600 Message-Id: <20200505214445.69288-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" There are no functional changes. Signed-off-by: Alex Hung Acked-by: Colin Ian King Acked-by: Ivan Hu --- src/acpi/devices/battery/battery.c | 6 +++--- src/acpi/method/method.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/acpi/devices/battery/battery.c b/src/acpi/devices/battery/battery.c index 630c07f1..74565169 100644 --- a/src/acpi/devices/battery/battery.c +++ b/src/acpi/devices/battery/battery.c @@ -545,7 +545,7 @@ static int method_test_BTP(fwts_framework *fw) ACPI_STATUS status; uint8_t i; - for (i = 0; i < sizeof(values) / sizeof(int); i++) { + for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) { ACPI_OBJECT arg[1]; arg[0].Type = ACPI_TYPE_INTEGER; arg[0].Integer.Value = values[i]; @@ -626,7 +626,7 @@ static int method_test_BTM(fwts_framework *fw) ACPI_STATUS status; uint8_t i; - for (i = 0; i < sizeof(values) / sizeof(int); i++) { + for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) { ACPI_OBJECT arg[1]; arg[0].Type = ACPI_TYPE_INTEGER; arg[0].Integer.Value = values[i]; @@ -686,7 +686,7 @@ static int method_test_BMC(fwts_framework *fw) ACPI_STATUS status; uint8_t i; - for (i = 0; i < sizeof(values) / sizeof(int); i++) { + for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) { ACPI_OBJECT arg[1]; arg[0].Type = ACPI_TYPE_INTEGER; arg[0].Integer.Value = values[i]; diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index cd4d15c7..68973847 100644 --- a/src/acpi/method/method.c +++ b/src/acpi/method/method.c @@ -4354,7 +4354,7 @@ static int method_test_BTP(fwts_framework *fw) static const int values[] = { 0, 1, 100, 200, 0x7fffffff }; int i; - for (i = 0; i < 5; i++) { + for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) { ACPI_OBJECT arg[1]; arg[0].Type = ACPI_TYPE_INTEGER; arg[0].Integer.Value = values[i]; @@ -4394,7 +4394,7 @@ static int method_test_BTM(fwts_framework *fw) static const int values[] = { 0, 1, 100, 200, 0x7fffffff }; int i; - for (i = 0 ; i < 5; i++) { + for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) { ACPI_OBJECT arg[1]; arg[0].Type = ACPI_TYPE_INTEGER; arg[0].Integer.Value = values[i]; @@ -4440,7 +4440,7 @@ static int method_test_BMC(fwts_framework *fw) static const int values[] = { 0, 1, 2, 4 }; int i; - for (i = 0; i < 4; i++) { + for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) { ACPI_OBJECT arg[1]; arg[0].Type = ACPI_TYPE_INTEGER; arg[0].Integer.Value = values[i];