RE: [Devel] Re: [PATCH] ACPICA: Use ARRAY_SIZE for 'fadt_info_table','fadt_pm_info_table'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 
Sent: Monday, November 25, 2019 10:11 AM
To: Colin Ian King <colin.king@xxxxxxxxxxxxx>; Moore, Robert <robert.moore@xxxxxxxxx>; zhengbin <zhengbin13@xxxxxxxxxx>; Wysocki, Rafael J <rafael.j.wysocki@xxxxxxxxx>; lenb@xxxxxxxxxx; linux-acpi@xxxxxxxxxxxxxxx; devel@xxxxxxxxxx
Subject: RE: [Devel] Re: [PATCH] ACPICA: Use ARRAY_SIZE for 'fadt_info_table','fadt_pm_info_table'



> -----Original Message-----
> From: linux-acpi-owner@xxxxxxxxxxxxxxx 
> <linux-acpi-owner@xxxxxxxxxxxxxxx>
> On Behalf Of Colin Ian King
> Sent: Friday, November 22, 2019 2:36 PM
> To: Moore, Robert <robert.moore@xxxxxxxxx>; zhengbin 
> <zhengbin13@xxxxxxxxxx>; Schmauss, Erik <erik.schmauss@xxxxxxxxx>; 
> Wysocki, Rafael J <rafael.j.wysocki@xxxxxxxxx>; lenb@xxxxxxxxxx; 
> linux- acpi@xxxxxxxxxxxxxxx; devel@xxxxxxxxxx
> Subject: Re: [Devel] Re: [PATCH] ACPICA: Use ARRAY_SIZE for 
> 'fadt_info_table','fadt_pm_info_table'
> 
> On 22/11/2019 21:49, Moore, Robert wrote:
> > 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

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
> 
> >
> >
> > -----Original Message-----
> > From: zhengbin <zhengbin13@xxxxxxxxxx>
> > Sent: Friday, November 22, 2019 1:33 AM
> > To: Moore, Robert <robert.moore@xxxxxxxxx>; Schmauss, Erik 
> > <erik.schmauss@xxxxxxxxx>; Wysocki, Rafael J 
> > <rafael.j.wysocki@xxxxxxxxx>; lenb@xxxxxxxxxx; 
> > linux-acpi@xxxxxxxxxxxxxxx; devel@xxxxxxxxxx
> > Cc: zhengbin13@xxxxxxxxxx
> > 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
> >
> > Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
> > Signed-off-by: zhengbin <zhengbin13@xxxxxxxxxx>
> > ---
> >  drivers/acpi/acpica/tbfadt.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/acpi/acpica/tbfadt.c 
> > b/drivers/acpi/acpica/tbfadt.c index 0041bfb..324a804 100644
> > --- a/drivers/acpi/acpica/tbfadt.c
> > +++ b/drivers/acpi/acpica/tbfadt.c
> > @@ -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@xxxxxxxxxx To unsubscribe send an email 
> > to devel-leave@xxxxxxxxxx 
> > %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
> >





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux