ACPICA: Use ARRAY_SIZE for 'fadt_info_table','fadt_pm_info_table'
Subsystems (2)
PATCH 1/1 ACPICA: Use ARRAY_SIZE for 'fadt_info_table','fadt_pm_info_table'
Fixes coccicheck warning:
drivers/acpi/acpica/tbfadt.c:107:27-28: WARNING: Use ARRAY_SIZE drivers/acpi/acpica/tbfadt.c:137:30-31: WARNING: Use ARRAY_SIZE
--- drivers/acpi/acpica/tbfadt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/acpi/acpica/tbfadt.c +2 -4
@@ -103,8 +103,7 @@ static struct acpi_fadt_info fadt_info_table[] = { ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER} }; -#define ACPI_FADT_INFO_ENTRIES \ - (sizeof (fadt_info_table) / sizeof (struct acpi_fadt_info)) +#define ACPI_FADT_INFO_ENTRIES (ARRAY_SIZE(fadt_info_table))/* Table used to split Event Blocks into separate status/enable registers */
@@ -133,8 +132,7 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = { 1} }; -#define ACPI_FADT_PM_INFO_ENTRIES \ - (sizeof (fadt_pm_info_table) / sizeof (struct acpi_fadt_pm_info)) +#define ACPI_FADT_PM_INFO_ENTRIES (ARRAY_SIZE(fadt_pm_info_table))/******************************************************************************* *
--
2.7.4
Moore
[Devel] Re: [PATCH] ACPICA: Use ARRAY_SIZE for 'fadt_info_table', 'fadt_pm_info_table'
Where does "ARRAY_SIZE" come from? It's not a part of ACPICA. Bob
-----Original Message-----
From: zhengbin <zhengbin13(a)huawei.com>
Sent: Friday, November 22, 2019 1:33 AM
To: Moore, Robert <robert.moore(a)intel.com>; Schmauss, Erik <erik.schmauss(a)intel.com>; Wysocki, Rafael J <rafael.j.wysocki(a)intel.com>; lenb(a)kernel.org; linux-acpi(a)vger.kernel.org; devel(a)acpica.org
Cc: zhengbin13(a)huawei.com
Subject: [PATCH] ACPICA: Use ARRAY_SIZE for 'fadt_info_table','fadt_pm_info_table'
Fixes coccicheck warning:
drivers/acpi/acpica/tbfadt.c:107:27-28: WARNING: Use ARRAY_SIZE drivers/acpi/acpica/tbfadt.c:137:30-31: WARNING: Use ARRAY_SIZE
--- drivers/acpi/acpica/tbfadt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/acpi/acpica/tbfadt.c +2 -4
@@ -103,8 +103,7 @@ static struct acpi_fadt_info fadt_info_table[] = { ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER} }; -#define ACPI_FADT_INFO_ENTRIES \ - (sizeof (fadt_info_table) / sizeof (struct acpi_fadt_info)) +#define ACPI_FADT_INFO_ENTRIES (ARRAY_SIZE(fadt_info_table))/* Table used to split Event Blocks into separate status/enable registers */
@@ -133,8 +132,7 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = { 1} }; -#define ACPI_FADT_PM_INFO_ENTRIES \ - (sizeof (fadt_pm_info_table) / sizeof (struct acpi_fadt_pm_info)) +#define ACPI_FADT_PM_INFO_ENTRIES (ARRAY_SIZE(fadt_pm_info_table))/******************************************************************************* *
--
2.7.4
Colin Ian King
[Devel] Re: [PATCH] ACPICA: Use ARRAY_SIZE for 'fadt_info_table', 'fadt_pm_info_table'
Quoted 2 lines · Robert
Where does "
ARRAY_SIZE" come from? It's not a part of ACPICA. Bob
It's definitely not part of ACPICA, it's defined in linux/kernel.h
Quoted 49 lines
-----Original Message-----
From: zhengbin <zhengbin13(a)huawei.com>
Sent: Friday, November 22, 2019 1:33 AM
To: Moore, Robert <robert.moore(a)intel.com>; Schmauss, Erik <erik.schmauss(a)intel.com>; Wysocki, Rafael J <rafael.j.wysocki(a)intel.com>; lenb(a)kernel.org; linux-acpi(a)vger.kernel.org; devel(a)acpica.org
Cc: zhengbin13(a)huawei.com
Subject: [PATCH] ACPICA: UseARRAY_SIZEfor 'fadt_info_table','fadt_pm_info_table'Fixes coccicheck warning:
drivers/acpi/acpica/tbfadt.c:107:27-28: WARNING: Use
ARRAY_SIZEdrivers/acpi/acpica/tbfadt.c:137:30-31: WARNING: UseARRAY_SIZEReported-by Hulk Robot <hulkci(a)huawei.com>Signed-off-by zhengbin <zhengbin13(a)huawei.com>--- drivers/acpi/acpica/tbfadt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/acpi/acpica/tbfadt.c +2
-5@@ -103,8 +103,7 @@ static struct acpi_fadt_info fadt_info_table[] = { ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER} }; -#define ACPI_FADT_INFO_ENTRIES \ - (sizeof (fadt_info_table) / sizeof (struct acpi_fadt_info)) +#define ACPI_FADT_INFO_ENTRIES (ARRAY_SIZE(fadt_info_table))/* Table used to split Event Blocks into separate status/enable registers */ @@ -133,8 +132,7 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = { 1} }; -#define ACPI_FADT_PM_INFO_ENTRIES \ - (sizeof (fadt_pm_info_table) / sizeof (struct acpi_fadt_pm_info)) +#define ACPI_FADT_PM_INFO_ENTRIES (ARRAY_SIZE(fadt_pm_info_table))/******************************************************************************* * -- 2.7.4
_______________________________________________
Devel mailing list -- devel(a)acpica.org
To unsubscribe send an email to devel-leave(a)acpica.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
Schmauss
[Devel] Re: [PATCH] ACPICA: Use ARRAY_SIZE for 'fadt_info_table', 'fadt_pm_info_table'
Quoted 13 lines
-----Original Message-----
From: linux-acpi-owner(a)vger.kernel.org <linux-acpi-owner(a)vger.kernel.org> On Behalf Of Colin Ian King
Sent: Friday, November 22, 2019 2:36 PM
To: Moore, Robert <robert.moore(a)intel.com>; zhengbin <zhengbin13(a)huawei.com>; Schmauss, Erik <erik.schmauss(a)intel.com>; Wysocki, Rafael J <rafael.j.wysocki(a)intel.com>; lenb(a)kernel.org; linux- acpi(a)vger.kernel.org; devel(a)acpica.org
Subject: Re: [Devel] Re: [PATCH] ACPICA: UseARRAY_SIZEfor 'fadt_info_table','fadt_pm_info_table'
Quoted 5 lines
Quoted 2 lines · Robert
Where does "
ARRAY_SIZE" come from? It's not a part of ACPICA. BobIt's definitely not part of ACPICA, it's defined in
linux/kernel.h
ACPICA codebase must work across multiple operating systems. Since ARRAY_SIZE macro is specific to linux, we cannot take this change as it stands..
Erik
Quoted 61 lines
Quoted 12 lines
-----Original Message-----
From: zhengbin <zhengbin13(a)huawei.com>
Sent: Friday, November 22, 2019 1:33 AM
To: Moore, Robert <robert.moore(a)intel.com>; Schmauss, Erik <erik.schmauss(a)intel.com>; Wysocki, Rafael J <rafael.j.wysocki(a)intel.com>; lenb(a)kernel.org; linux-acpi(a)vger.kernel.org; devel(a)acpica.org
Cc: zhengbin13(a)huawei.com
Subject: [PATCH] ACPICA: UseARRAY_SIZEfor'fadt_info_table','fadt_pm_info_table'
Quoted 17 lines
Fixes coccicheck warning:
drivers/acpi/acpica/tbfadt.c:107:27-28: WARNING: Use
ARRAY_SIZEdrivers/acpi/acpica/tbfadt.c:137:30-31: WARNING: UseARRAY_SIZEReported-by Hulk Robot <hulkci(a)huawei.com>Signed-off-by zhengbin <zhengbin13(a)huawei.com>--- drivers/acpi/acpica/tbfadt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)(quoted diff) +0
-0
b/drivers/acpi/acpica/tbfadt.cindex 0041bfb..324a804 100644drivers/acpi/acpica/tbfadt.c static struct acpi_fadt_info fadt_info_table[] = { · line 106
Quoted 4 lines
drivers/acpi/acpica/tbfadt.c +0
-2@@ -103,8 +103,7 @@ static struct acpi_fadt_info fadt_info_table[] = { ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER} }; -#define ACPI_FADT_INFO_ENTRIES \ - (sizeof (fadt_info_table) / sizeof (struct
acpi_fadt_info))drivers/acpi/acpica/tbfadt.c static struct acpi_fadt_pm_info fadt_pm_info_table[]
Quoted 6 lines
drivers/acpi/acpica/tbfadt.c +1
-0+#define ACPI_FADT_INFO_ENTRIES (ARRAY_SIZE(fadt_info_table))/* Table used to split Event Blocks into separate status/enable registers */
drivers/acpi/acpica/tbfadt.c +0
-0@@ -133,8 +132,7 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[]= {
drivers/acpi/acpica/tbfadt.c static struct acpi_fadt_pm_info fadt_pm_info_table[] = {
Quoted 5 lines
drivers/acpi/acpica/tbfadt.c +0
-21} }; -#define ACPI_FADT_PM_INFO_ENTRIES \ - (sizeof (fadt_pm_info_table) / sizeof (struct
acpi_fadt_pm_info))drivers/acpi/acpica/tbfadt.c static struct acpi_fadt_pm_info fadt_pm_info_table[] = {
Quoted 3 lines
drivers/acpi/acpica/tbfadt.c +1
-0+#define ACPI_FADT_PM_INFO_ENTRIES (ARRAY_SIZE(fadt_pm_info_table))/******************************************************************
*************Quoted 8 lines
drivers/acpi/acpica/tbfadt.c +0
-1* --2.7.4
_______________________________________________
Devel mailing list -- devel(a)acpica.org To unsubscribe send an email to devel-leave(a)acpica.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
Moore
[Devel] Re: [PATCH] ACPICA: Use ARRAY_SIZE for 'fadt_info_table', 'fadt_pm_info_table'
However, ACPICA has an "ACPI_ARRAY_LENGTH" macro which could possibly be used. It's defined like this:
#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
-----Original Message-----
From: Schmauss, Erik <erik.schmauss(a)intel.com>
Sent: Monday, November 25, 2019 10:11 AM
To: Colin Ian King <colin.king(a)canonical.com>; Moore, Robert <robert.moore(a)intel.com>; zhengbin <zhengbin13(a)huawei.com>; Wysocki, Rafael J <rafael.j.wysocki(a)intel.com>; lenb(a)kernel.org; linux-acpi(a)vger.kernel.org; devel(a)acpica.org
Subject: RE: [Devel] Re: [PATCH] ACPICA: Use ARRAY_SIZE for 'fadt_info_table','fadt_pm_info_table'
Quoted 12 lines
-----Original Message-----
From: linux-acpi-owner(a)vger.kernel.org <linux-acpi-owner(a)vger.kernel.org>
On Behalf Of Colin Ian King
Sent: Friday, November 22, 2019 2:36 PM
To: Moore, Robert <robert.moore(a)intel.com>; zhengbin <zhengbin13(a)huawei.com>; Schmauss, Erik <erik.schmauss(a)intel.com>; Wysocki, Rafael J <rafael.j.wysocki(a)intel.com>; lenb(a)kernel.org; linux- acpi(a)vger.kernel.org; devel(a)acpica.org
Subject: Re: [Devel] Re: [PATCH] ACPICA: UseARRAY_SIZEfor 'fadt_info_table','fadt_pm_info_table'
Quoted 5 lines
Quoted 2 lines · Robert
Where does "
ARRAY_SIZE" come from? It's not a part of ACPICA. BobIt's definitely not part of ACPICA, it's defined in
linux/kernel.h
ACPICA codebase must work across multiple operating systems. Since ARRAY_SIZE macro is specific to linux, we cannot take this change as it stands..
Erik
Quoted 62 lines
Quoted 12 lines
-----Original Message-----
From: zhengbin <zhengbin13(a)huawei.com>
Sent: Friday, November 22, 2019 1:33 AM
To: Moore, Robert <robert.moore(a)intel.com>; Schmauss, Erik <erik.schmauss(a)intel.com>; Wysocki, Rafael J <rafael.j.wysocki(a)intel.com>; lenb(a)kernel.org; linux-acpi(a)vger.kernel.org; devel(a)acpica.org
Cc: zhengbin13(a)huawei.com
Subject: [PATCH] ACPICA: UseARRAY_SIZEfor'fadt_info_table','fadt_pm_info_table'
Quoted 17 lines
Fixes coccicheck warning:
drivers/acpi/acpica/tbfadt.c:107:27-28: WARNING: Use
ARRAY_SIZEdrivers/acpi/acpica/tbfadt.c:137:30-31: WARNING: UseARRAY_SIZEReported-by Hulk Robot <hulkci(a)huawei.com>Signed-off-by zhengbin <zhengbin13(a)huawei.com>--- drivers/acpi/acpica/tbfadt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)(quoted diff) +0
-0
b/drivers/acpi/acpica/tbfadt.cindex 0041bfb..324a804 100644drivers/acpi/acpica/tbfadt.c static struct acpi_fadt_info fadt_info_table[] = { · line 106
Quoted 4 lines
drivers/acpi/acpica/tbfadt.c +0
-2@@ -103,8 +103,7 @@ static struct acpi_fadt_info fadt_info_table[] = { ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER} }; -#define ACPI_FADT_INFO_ENTRIES \ - (sizeof (fadt_info_table) / sizeof (struct
acpi_fadt_info))Quoted 7 lines
drivers/acpi/acpica/tbfadt.c +1
-0+#define ACPI_FADT_INFO_ENTRIES (ARRAY_SIZE(fadt_info_table))/* Table used to split Event Blocks into separate status/enable registers */
drivers/acpi/acpica/tbfadt.c +0
-0@@ -133,8 +132,7 @@ static struct acpi_fadt_pm_infofadt_pm_info_table[]
= {
drivers/acpi/acpica/tbfadt.c static struct acpi_fadt_pm_info fadt_pm_info_table[] = {
Quoted 5 lines
drivers/acpi/acpica/tbfadt.c +0
-21} }; -#define ACPI_FADT_PM_INFO_ENTRIES \ - (sizeof (fadt_pm_info_table) / sizeof (struct
acpi_fadt_pm_info))Quoted 3 lines
+#define
ACPI_FADT_PM_INFO_ENTRIES(ARRAY_SIZE(fadt_pm_info_table))/******************************************************************
*************Quoted 8 lines
*
--
2.7.4
_______________________________________________
Devel mailing list -- devel(a)acpica.org To unsubscribe send an email to devel-leave(a)acpica.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s