[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <94F2FBAB4432B54E8AACC7DFDE6C92E3C68A849E@ORSMSX108.amr.corp.intel.com>
Date: Tue, 14 Apr 2020 20:22:40 +0000
From: "Moore, Robert" <robert.moore@...el.com>
To: Jason Yan <yanaijie@...wei.com>,
"Kaneda, Erik" <erik.kaneda@...el.com>,
"Wysocki, Rafael J" <rafael.j.wysocki@...el.com>,
"lenb@...nel.org" <lenb@...nel.org>,
"linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
"devel@...ica.org" <devel@...ica.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] ACPICA: Use ARRAY_SIZE instead of hardcoded siz
I think we've discussed this in the past. ARRAY_SIZE is not standard, and will get in the way of portability:
On gcc v7.4.0:
../../../source/components/resources/rsdumpinfo.c:335:25: note: in expansion of macro 'ACPI_RSD_TABLE_SIZE'
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpGenericReg), "Generic Register", NULL},
../../../source/components/resources/rsdumpinfo.c:166:37: error: initializer element is not constant
#define ACPI_RSD_TABLE_SIZE(name) ARRAY_SIZE (name)
And, on MSVC 2017:
Severity Code Description Project File Line Suppression State
Warning C4013 'ARRAY_SIZE' undefined; assuming extern returning int AcpiExec c:\acpica\source\components\resources\rsdumpinfo.c 179
-----Original Message-----
From: Jason Yan <yanaijie@...wei.com>
Sent: Monday, April 13, 2020 7:32 AM
To: Moore, Robert <robert.moore@...el.com>; Kaneda, Erik <erik.kaneda@...el.com>; Wysocki, Rafael J <rafael.j.wysocki@...el.com>; lenb@...nel.org; linux-acpi@...r.kernel.org; devel@...ica.org; linux-kernel@...r.kernel.org
Cc: Jason Yan <yanaijie@...wei.com>
Subject: [PATCH] ACPICA: Use ARRAY_SIZE instead of hardcoded siz
Fix the following coccicheck warning:
./drivers/acpi/acpica/rsdumpinfo.c:18:48-49: WARNING: Use ARRAY_SIZE
./drivers/acpi/acpica/rsdumpinfo.c:18:48-49: WARNING: Use ARRAY_SIZE
./drivers/acpi/acpica/rsdumpinfo.c:18:48-49: WARNING: Use ARRAY_SIZE
./drivers/acpi/acpica/rsdumpinfo.c:18:48-49: WARNING: Use ARRAY_SIZE
./drivers/acpi/acpica/rsdumpinfo.c:18:48-49: WARNING: Use ARRAY_SIZE
./drivers/acpi/acpica/rsdumpinfo.c:18:48-49: WARNING: Use ARRAY_SIZE
./drivers/acpi/acpica/rsdumpinfo.c:18:48-49: WARNING: Use ARRAY_SIZE
Signed-off-by: Jason Yan <yanaijie@...wei.com>
---
drivers/acpi/acpica/rsdumpinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/acpica/rsdumpinfo.c b/drivers/acpi/acpica/rsdumpinfo.c
index cafa8134b4c6..f1ba4cd8080f 100644
--- a/drivers/acpi/acpica/rsdumpinfo.c
+++ b/drivers/acpi/acpica/rsdumpinfo.c
@@ -15,7 +15,7 @@ ACPI_MODULE_NAME("rsdumpinfo") #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUGGER)
#define ACPI_RSD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_resource_data,f)
#define ACPI_PRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_pci_routing_table,f)
-#define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_rsdump_info))
+#define ACPI_RSD_TABLE_SIZE(name) ARRAY_SIZE(name)
/*******************************************************************************
*
* Resource Descriptor info tables
--
2.21.1
Powered by blists - more mailing lists