From patchwork Wed Apr 24 09:21:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 239090 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 73F252C00C8 for ; Wed, 24 Apr 2013 19:21:04 +1000 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1UUvss-00038W-0Z; Wed, 24 Apr 2013 09:21:02 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1UUvsr-00038R-2m for fwts-devel@lists.ubuntu.com; Wed, 24 Apr 2013 09:21:01 +0000 Received: from faun.canonical.com ([91.189.93.182] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1UUvsr-0003bE-1W for fwts-devel@lists.ubuntu.com; Wed, 24 Apr 2013 09:21:01 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] apic: apicedge: minor code tidy-up Date: Wed, 24 Apr 2013 10:21:00 +0100 Message-Id: <1366795260-4314-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.8.1.2 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: fwts-devel-bounces@lists.ubuntu.com From: Colin Ian King Minor code tidy-up, reformatted, etc. No significant change. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Keng-Yu Lin > --- src/apic/apicedge/apicedge.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/apic/apicedge/apicedge.c b/src/apic/apicedge/apicedge.c index e22080c..9737fa4 100644 --- a/src/apic/apicedge/apicedge.c +++ b/src/apic/apicedge/apicedge.c @@ -33,9 +33,9 @@ /* * This test sanity checks apic irq information * rule of thumb: - * interrupts <16 should be EDGE - * interrupts >16 should be LEVEL - * acpi interrupt should be LEVEL + * interrupts <16 should be EDGE + * interrupts >16 should be LEVEL + * acpi interrupt should be LEVEL */ static int apicedge_test1(fwts_framework *fw) @@ -54,11 +54,11 @@ static int apicedge_test1(fwts_framework *fw) int edge = -1; int irq = 0; - memset(line, 0, 4096); - if (fgets(line, 4095, file) == NULL) + memset(line, 0, sizeof(line)); + if (fgets(line, sizeof(line) - 1, file) == NULL) break; - if (! (line[0]==' ' || (line[0]>='0' && line[0]<='9')) ) + if (! (line[0] == ' ' || (line[0] >= '0' && line[0] <= '9')) ) continue; irq = strtoul(line, &c, 10); @@ -77,13 +77,17 @@ static int apicedge_test1(fwts_framework *fw) if (strstr(line,"acpi")) { if (edge == 1) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "ACPIIRQEdgeTrig", "ACPI Interrupt is incorrectly edge triggered."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "ACPIIRQEdgeTrig", + "ACPI Interrupt is incorrectly edge triggered."); fwts_tag_failed(fw, FWTS_TAG_BIOS_IRQ); } continue; } if ((irq < 15) && (edge == 0)) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "LegacyIRQLevelTrig", "Legacy interrupt %i is incorrectly level triggered.", irq); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "LegacyIRQLevelTrig", + "Legacy interrupt %i is incorrectly level triggered.", irq); fwts_tag_failed(fw, FWTS_TAG_BIOS_IRQ); } if ((irq < 15) && (edge == -1)) {