Linux-ACPI Archive on lore.kernel.org
 help / color / Atom feed
From: "Moore, Robert" <robert.moore@intel.com>
To: "Kaneda, Erik" <erik.kaneda@intel.com>,
	Colin Ian King <colin.king@canonical.com>,
	zhengbin <zhengbin13@huawei.com>,
	"Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
	"lenb@kernel.org" <lenb@kernel.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"devel@acpica.org" <devel@acpica.org>
Subject: RE: [Devel] Re: [PATCH] ACPICA: Use ARRAY_SIZE for 'fadt_info_table','fadt_pm_info_table'
Date: Tue, 3 Dec 2019 15:23:20 +0000
Message-ID: <94F2FBAB4432B54E8AACC7DFDE6C92E3B96B311D@ORSMSX110.amr.corp.intel.com> (raw)
In-Reply-To: <CF6A88132359CE47947DB4C6E1709ED53C688958@ORSMSX122.amr.corp.intel.com>

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



> -----Original Message-----
> From: linux-acpi-owner@vger.kernel.org 
> <linux-acpi-owner@vger.kernel.org>
> On Behalf Of Colin Ian King
> Sent: Friday, November 22, 2019 2:36 PM
> To: Moore, Robert <robert.moore@intel.com>; zhengbin 
> <zhengbin13@huawei.com>; Schmauss, Erik <erik.schmauss@intel.com>; 
> Wysocki, Rafael J <rafael.j.wysocki@intel.com>; lenb@kernel.org; 
> linux- acpi@vger.kernel.org; devel@acpica.org
> 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@huawei.com>
> > Sent: Friday, November 22, 2019 1:33 AM
> > To: Moore, Robert <robert.moore@intel.com>; Schmauss, Erik 
> > <erik.schmauss@intel.com>; Wysocki, Rafael J 
> > <rafael.j.wysocki@intel.com>; lenb@kernel.org; 
> > linux-acpi@vger.kernel.org; devel@acpica.org
> > Cc: zhengbin13@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
> >
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: zhengbin <zhengbin13@huawei.com>
> > ---
> >  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@acpica.org To unsubscribe send an email 
> > to devel-leave@acpica.org 
> > %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
> >


      reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-22  9:33 zhengbin
2019-11-22 21:49 ` Moore, Robert
2019-11-22 22:36   ` [Devel] " Colin Ian King
2019-11-25 18:10     ` Schmauss, Erik
2019-12-03 15:23       ` Moore, Robert [this message]

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=94F2FBAB4432B54E8AACC7DFDE6C92E3B96B311D@ORSMSX110.amr.corp.intel.com \
    --to=robert.moore@intel.com \
    --cc=colin.king@canonical.com \
    --cc=devel@acpica.org \
    --cc=erik.kaneda@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=zhengbin13@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-ACPI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-acpi/0 linux-acpi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-acpi linux-acpi/ https://lore.kernel.org/linux-acpi \
		linux-acpi@vger.kernel.org
	public-inbox-index linux-acpi

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-acpi


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git