linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] ACPICA: Make acpi_protocol_lengths static
@ 2020-03-28  3:47 YueHaibing
  2020-03-28  9:14 ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: YueHaibing @ 2020-03-28  3:47 UTC (permalink / raw)
  To: robert.moore, erik.kaneda, rafael.j.wysocki, lenb
  Cc: linux-acpi, devel, linux-kernel, YueHaibing

Fix sparse warning:

drivers/acpi/acpica/exfield.c:25:10: warning:
 symbol 'acpi_protocol_lengths' was not declared. Should it be static?

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/acpi/acpica/exfield.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
index e85eb31e5075..3323a2ba6a31 100644
--- a/drivers/acpi/acpica/exfield.c
+++ b/drivers/acpi/acpica/exfield.c
@@ -22,7 +22,7 @@ ACPI_MODULE_NAME("exfield")
  */
 #define ACPI_INVALID_PROTOCOL_ID        0x80
 #define ACPI_MAX_PROTOCOL_ID            0x0F
-const u8 acpi_protocol_lengths[] = {
+static const u8 acpi_protocol_lengths[] = {
 	ACPI_INVALID_PROTOCOL_ID,	/* 0 - reserved */
 	ACPI_INVALID_PROTOCOL_ID,	/* 1 - reserved */
 	0x00,			/* 2 - ATTRIB_QUICK */
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] ACPICA: Make acpi_protocol_lengths static
  2020-03-28  3:47 [PATCH -next] ACPICA: Make acpi_protocol_lengths static YueHaibing
@ 2020-03-28  9:14 ` Rafael J. Wysocki
  2020-03-30 17:52   ` Kaneda, Erik
  0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2020-03-28  9:14 UTC (permalink / raw)
  To: YueHaibing, Robert Moore, Erik Kaneda
  Cc: Rafael Wysocki, Len Brown, ACPI Devel Maling List,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA),
	Linux Kernel Mailing List

On Sat, Mar 28, 2020 at 4:47 AM YueHaibing <yuehaibing@huawei.com> wrote:
>
> Fix sparse warning:
>
> drivers/acpi/acpica/exfield.c:25:10: warning:
>  symbol 'acpi_protocol_lengths' was not declared. Should it be static?
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Bob, Erik, I'm leaving this one to you.

> ---
>  drivers/acpi/acpica/exfield.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
> index e85eb31e5075..3323a2ba6a31 100644
> --- a/drivers/acpi/acpica/exfield.c
> +++ b/drivers/acpi/acpica/exfield.c
> @@ -22,7 +22,7 @@ ACPI_MODULE_NAME("exfield")
>   */
>  #define ACPI_INVALID_PROTOCOL_ID        0x80
>  #define ACPI_MAX_PROTOCOL_ID            0x0F
> -const u8 acpi_protocol_lengths[] = {
> +static const u8 acpi_protocol_lengths[] = {
>         ACPI_INVALID_PROTOCOL_ID,       /* 0 - reserved */
>         ACPI_INVALID_PROTOCOL_ID,       /* 1 - reserved */
>         0x00,                   /* 2 - ATTRIB_QUICK */
> --
> 2.17.1
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH -next] ACPICA: Make acpi_protocol_lengths static
  2020-03-28  9:14 ` Rafael J. Wysocki
@ 2020-03-30 17:52   ` Kaneda, Erik
  2020-03-31  3:29     ` Yuehaibing
  0 siblings, 1 reply; 5+ messages in thread
From: Kaneda, Erik @ 2020-03-30 17:52 UTC (permalink / raw)
  To: Rafael J. Wysocki, YueHaibing, Moore, Robert
  Cc: Wysocki, Rafael J, Len Brown, ACPI Devel Maling List,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA),
	Linux Kernel Mailing List



> -----Original Message-----
> From: linux-acpi-owner@vger.kernel.org <linux-acpi-
> owner@vger.kernel.org> On Behalf Of Rafael J. Wysocki
> Sent: Saturday, March 28, 2020 2:14 AM
> To: YueHaibing <yuehaibing@huawei.com>; Moore, Robert
> <robert.moore@intel.com>; Kaneda, Erik <erik.kaneda@intel.com>
> Cc: Wysocki, Rafael J <rafael.j.wysocki@intel.com>; Len Brown
> <lenb@kernel.org>; ACPI Devel Maling List <linux-acpi@vger.kernel.org>;
> open list:ACPI COMPONENT ARCHITECTURE (ACPICA) <devel@acpica.org>;
> Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
> Subject: Re: [PATCH -next] ACPICA: Make acpi_protocol_lengths static
> 
> On Sat, Mar 28, 2020 at 4:47 AM YueHaibing <yuehaibing@huawei.com>
> wrote:
> >
> > Fix sparse warning:
> >
> > drivers/acpi/acpica/exfield.c:25:10: warning:
> >  symbol 'acpi_protocol_lengths' was not declared. Should it be static?
 
I don’t understand what sparse is trying to say here. This variable is declared in exfield.c...
Could you provide more details on this sparse warning?

Erik

> >
> > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> 
> Bob, Erik, I'm leaving this one to you.
> 
> > ---
> >  drivers/acpi/acpica/exfield.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/acpi/acpica/exfield.c
> > b/drivers/acpi/acpica/exfield.c index e85eb31e5075..3323a2ba6a31
> > 100644
> > --- a/drivers/acpi/acpica/exfield.c
> > +++ b/drivers/acpi/acpica/exfield.c
> > @@ -22,7 +22,7 @@ ACPI_MODULE_NAME("exfield")
> >   */
> >  #define ACPI_INVALID_PROTOCOL_ID        0x80
> >  #define ACPI_MAX_PROTOCOL_ID            0x0F
> > -const u8 acpi_protocol_lengths[] = {
> > +static const u8 acpi_protocol_lengths[] = {
> >         ACPI_INVALID_PROTOCOL_ID,       /* 0 - reserved */
> >         ACPI_INVALID_PROTOCOL_ID,       /* 1 - reserved */
> >         0x00,                   /* 2 - ATTRIB_QUICK */
> > --
> > 2.17.1
> >
> >

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next] ACPICA: Make acpi_protocol_lengths static
  2020-03-30 17:52   ` Kaneda, Erik
@ 2020-03-31  3:29     ` Yuehaibing
  2020-03-31 17:34       ` Kaneda, Erik
  0 siblings, 1 reply; 5+ messages in thread
From: Yuehaibing @ 2020-03-31  3:29 UTC (permalink / raw)
  To: Kaneda, Erik, Rafael J. Wysocki, Moore, Robert
  Cc: Wysocki, Rafael J, Len Brown, ACPI Devel Maling List,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA),
	Linux Kernel Mailing List

On 2020/3/31 1:52, Kaneda, Erik wrote:
> 
> 
>> -----Original Message-----
>> From: linux-acpi-owner@vger.kernel.org <linux-acpi-
>> owner@vger.kernel.org> On Behalf Of Rafael J. Wysocki
>> Sent: Saturday, March 28, 2020 2:14 AM
>> To: YueHaibing <yuehaibing@huawei.com>; Moore, Robert
>> <robert.moore@intel.com>; Kaneda, Erik <erik.kaneda@intel.com>
>> Cc: Wysocki, Rafael J <rafael.j.wysocki@intel.com>; Len Brown
>> <lenb@kernel.org>; ACPI Devel Maling List <linux-acpi@vger.kernel.org>;
>> open list:ACPI COMPONENT ARCHITECTURE (ACPICA) <devel@acpica.org>;
>> Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
>> Subject: Re: [PATCH -next] ACPICA: Make acpi_protocol_lengths static
>>
>> On Sat, Mar 28, 2020 at 4:47 AM YueHaibing <yuehaibing@huawei.com>
>> wrote:
>>>
>>> Fix sparse warning:
>>>
>>> drivers/acpi/acpica/exfield.c:25:10: warning:
>>>  symbol 'acpi_protocol_lengths' was not declared. Should it be static?
>  
> I don’t understand what sparse is trying to say here. This variable is declared in exfield.c...
> Could you provide more details on this sparse warning?

This is sparse -Wdel option's job, see man manual:

       -Wdecl Warn about any non-static variable or function definition that
              has no previous declaration.

              Private symbols (functions and variables) internal to a given
              source file should use static, to allow additional compiler
              optimizations, allow detection of unused symbols, and prevent
              other code from relying on these internal symbols.  Public
              symbols used by other source files will need declarations
              visible to those other source files, such as in a header file.
              All declarations should fall into one of these two categories.
              Thus, with -Wdecl, Sparse warns about any symbol definition
              with neither static nor a declaration.  To fix this warning,
              declare private symbols static, and ensure that the files
              defining public symbols have the symbol declarations available
              first (such as by including the appropriate header file).

> 
> Erik
> 
>>>
>>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>>
>> Bob, Erik, I'm leaving this one to you.
>>
>>> ---
>>>  drivers/acpi/acpica/exfield.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/acpi/acpica/exfield.c
>>> b/drivers/acpi/acpica/exfield.c index e85eb31e5075..3323a2ba6a31
>>> 100644
>>> --- a/drivers/acpi/acpica/exfield.c
>>> +++ b/drivers/acpi/acpica/exfield.c
>>> @@ -22,7 +22,7 @@ ACPI_MODULE_NAME("exfield")
>>>   */
>>>  #define ACPI_INVALID_PROTOCOL_ID        0x80
>>>  #define ACPI_MAX_PROTOCOL_ID            0x0F
>>> -const u8 acpi_protocol_lengths[] = {
>>> +static const u8 acpi_protocol_lengths[] = {
>>>         ACPI_INVALID_PROTOCOL_ID,       /* 0 - reserved */
>>>         ACPI_INVALID_PROTOCOL_ID,       /* 1 - reserved */
>>>         0x00,                   /* 2 - ATTRIB_QUICK */
>>> --
>>> 2.17.1
>>>
>>>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH -next] ACPICA: Make acpi_protocol_lengths static
  2020-03-31  3:29     ` Yuehaibing
@ 2020-03-31 17:34       ` Kaneda, Erik
  0 siblings, 0 replies; 5+ messages in thread
From: Kaneda, Erik @ 2020-03-31 17:34 UTC (permalink / raw)
  To: Yuehaibing, Rafael J. Wysocki, Moore, Robert
  Cc: Wysocki, Rafael J, Len Brown, ACPI Devel Maling List,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA),
	Linux Kernel Mailing List



> -----Original Message-----
> From: linux-acpi-owner@vger.kernel.org <linux-acpi-
> owner@vger.kernel.org> On Behalf Of Yuehaibing
> Sent: Monday, March 30, 2020 8:29 PM
> To: Kaneda, Erik <erik.kaneda@intel.com>; Rafael J. Wysocki
> <rafael@kernel.org>; Moore, Robert <robert.moore@intel.com>
> Cc: Wysocki, Rafael J <rafael.j.wysocki@intel.com>; Len Brown
> <lenb@kernel.org>; ACPI Devel Maling List <linux-acpi@vger.kernel.org>;
> open list:ACPI COMPONENT ARCHITECTURE (ACPICA) <devel@acpica.org>;
> Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
> Subject: Re: [PATCH -next] ACPICA: Make acpi_protocol_lengths static
> 
> On 2020/3/31 1:52, Kaneda, Erik wrote:
> >
> >
> >> -----Original Message-----
> >> From: linux-acpi-owner@vger.kernel.org <linux-acpi-
> >> owner@vger.kernel.org> On Behalf Of Rafael J. Wysocki
> >> Sent: Saturday, March 28, 2020 2:14 AM
> >> To: YueHaibing <yuehaibing@huawei.com>; Moore, Robert
> >> <robert.moore@intel.com>; Kaneda, Erik <erik.kaneda@intel.com>
> >> Cc: Wysocki, Rafael J <rafael.j.wysocki@intel.com>; Len Brown
> >> <lenb@kernel.org>; ACPI Devel Maling List
> >> <linux-acpi@vger.kernel.org>; open list:ACPI COMPONENT
> ARCHITECTURE
> >> (ACPICA) <devel@acpica.org>; Linux Kernel Mailing List
> >> <linux-kernel@vger.kernel.org>
> >> Subject: Re: [PATCH -next] ACPICA: Make acpi_protocol_lengths static
> >>
> >> On Sat, Mar 28, 2020 at 4:47 AM YueHaibing <yuehaibing@huawei.com>
> >> wrote:
> >>>
> >>> Fix sparse warning:
> >>>
> >>> drivers/acpi/acpica/exfield.c:25:10: warning:
> >>>  symbol 'acpi_protocol_lengths' was not declared. Should it be static?
> >
> > I don’t understand what sparse is trying to say here. This variable is
> declared in exfield.c...
> > Could you provide more details on this sparse warning?
> 
> This is sparse -Wdel option's job, see man manual:
> 
>        -Wdecl Warn about any non-static variable or function definition that
>               has no previous declaration.
> 
>               Private symbols (functions and variables) internal to a given
>               source file should use static, to allow additional compiler
>               optimizations, allow detection of unused symbols, and prevent
>               other code from relying on these internal symbols.  Public
>               symbols used by other source files will need declarations
>               visible to those other source files, such as in a header file.
>               All declarations should fall into one of these two categories.
>               Thus, with -Wdecl, Sparse warns about any symbol definition
>               with neither static nor a declaration.  To fix this warning,
>               declare private symbols static, and ensure that the files
>               defining public symbols have the symbol declarations available
>               first (such as by including the appropriate header file).

Thanks for the info. I made a pull request to ACPICA codebase here: https://github.com/acpica/acpica/pull/581
I will send this to Linux upstream after the next ACPICA release (toward the end of this month)

Thanks,
Erik
> 
> >
> > Erik
> >
> >>>
> >>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> >>
> >> Bob, Erik, I'm leaving this one to you.
> >>
> >>> ---
> >>>  drivers/acpi/acpica/exfield.c | 2 +-
> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/drivers/acpi/acpica/exfield.c
> >>> b/drivers/acpi/acpica/exfield.c index e85eb31e5075..3323a2ba6a31
> >>> 100644
> >>> --- a/drivers/acpi/acpica/exfield.c
> >>> +++ b/drivers/acpi/acpica/exfield.c
> >>> @@ -22,7 +22,7 @@ ACPI_MODULE_NAME("exfield")
> >>>   */
> >>>  #define ACPI_INVALID_PROTOCOL_ID        0x80
> >>>  #define ACPI_MAX_PROTOCOL_ID            0x0F
> >>> -const u8 acpi_protocol_lengths[] = {
> >>> +static const u8 acpi_protocol_lengths[] = {
> >>>         ACPI_INVALID_PROTOCOL_ID,       /* 0 - reserved */
> >>>         ACPI_INVALID_PROTOCOL_ID,       /* 1 - reserved */
> >>>         0x00,                   /* 2 - ATTRIB_QUICK */
> >>> --
> >>> 2.17.1
> >>>
> >>>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-03-31 17:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-28  3:47 [PATCH -next] ACPICA: Make acpi_protocol_lengths static YueHaibing
2020-03-28  9:14 ` Rafael J. Wysocki
2020-03-30 17:52   ` Kaneda, Erik
2020-03-31  3:29     ` Yuehaibing
2020-03-31 17:34       ` Kaneda, Erik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).