From patchwork Tue Dec 18 00:00:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 207012 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 089092C007E for ; Tue, 18 Dec 2012 11:00:38 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Tkkbs-0007Qy-F0; Tue, 18 Dec 2012 00:00:36 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Tkkbi-0007Qb-2e for fwts-devel@lists.ubuntu.com; Tue, 18 Dec 2012 00:00:26 +0000 Received: from cpc3-craw6-2-0-cust180.croy.cable.virginmedia.com ([77.100.248.181] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Tkkbh-0002Qz-Vs for fwts-devel@lists.ubuntu.com; Tue, 18 Dec 2012 00:00:26 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] acpi: acpidump: use offsetof macro from stddef.h rather than define our own Date: Tue, 18 Dec 2012 00:00:25 +0000 Message-Id: <1355788825-17804-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.8.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: fwts-devel-bounces@lists.ubuntu.com Errors-To: fwts-devel-bounces@lists.ubuntu.com From: Colin Ian King Replace OFFSET() macro with the stddef.h equivalent offsetof() macro. Signed-off-by: Colin Ian King Acked-by: Keng-Yu Lin Acked-by: Alex Hung --- src/acpi/acpidump/acpidump.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/acpi/acpidump/acpidump.c b/src/acpi/acpidump/acpidump.c index 6cbbf85..7b6d4df 100644 --- a/src/acpi/acpidump/acpidump.c +++ b/src/acpi/acpidump/acpidump.c @@ -15,6 +15,7 @@ */ #include #include +#include #include #include #include @@ -41,14 +42,11 @@ typedef struct fwts_acpidump_field { fwts_acpidump_str_func str_func; } fwts_acpidump_field; -#define OFFSET(type, field) \ - ((void*)&(((type*)(0))->field) - (void*)0) - #define FIELD(text, type, field, func, bit_field_nbits, bit_field_shift, strings, strings_len, str_func) \ { \ text, \ sizeof(((type*)0)->field), \ - OFFSET(type, field), \ + offsetof(type, field), \ func, \ bit_field_nbits, \ bit_field_shift, \ @@ -459,7 +457,7 @@ static void acpidump_erst(fwts_framework *fw, fwts_acpi_table_info *table) "BEGIN_CLEAR_OPERATION", "END_OPERATION", - "SET_RECORD_OFFSET", + "SET_RECORD_offsetof", "EXECUTE_OPERATION", "CHECK_BUSY_STATUS", "GET_COMMAND_STATUS", @@ -708,7 +706,7 @@ static void acpidump_rsdt(fwts_framework *fw, fwts_acpi_table_info *table) char *name = table == NULL ? "unknown" : table->name; snprintf(label, sizeof(label), "Entry %2.2d %s", i, name); fwts_log_info_verbatum(fw, "%s 0x%8.8x", - acpi_dump_field_info(label, sizeof(rsdt->entries[i]), OFFSET(fwts_acpi_table_rsdt, entries[i])), + acpi_dump_field_info(label, sizeof(rsdt->entries[i]), offsetof(fwts_acpi_table_rsdt, entries[i])), rsdt->entries[i]); } } @@ -746,7 +744,7 @@ static void acpidump_xsdt(fwts_framework *fw, fwts_acpi_table_info *table) char *name = table == NULL ? "unknown" : table->name; snprintf(label, sizeof(label), "Entry %2.2d %s", i, name); fwts_log_info_verbatum(fw, "%s 0x%16.16" PRIx64, - acpi_dump_field_info(label, sizeof(xsdt->entries[i]), OFFSET(fwts_acpi_table_xsdt, entries[i])), + acpi_dump_field_info(label, sizeof(xsdt->entries[i]), offsetof(fwts_acpi_table_xsdt, entries[i])), xsdt->entries[i]); } }