Re: [PATCH -next] ACPICA: Make acpi_protocol_lengths static

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

 



On 2020/3/31 1:52, Kaneda, Erik wrote:
> 
> 
>> -----Original Message-----
>> From: linux-acpi-owner@xxxxxxxxxxxxxxx <linux-acpi-
>> owner@xxxxxxxxxxxxxxx> On Behalf Of Rafael J. Wysocki
>> Sent: Saturday, March 28, 2020 2:14 AM
>> To: YueHaibing <yuehaibing@xxxxxxxxxx>; Moore, Robert
>> <robert.moore@xxxxxxxxx>; Kaneda, Erik <erik.kaneda@xxxxxxxxx>
>> Cc: Wysocki, Rafael J <rafael.j.wysocki@xxxxxxxxx>; Len Brown
>> <lenb@xxxxxxxxxx>; ACPI Devel Maling List <linux-acpi@xxxxxxxxxxxxxxx>;
>> open list:ACPI COMPONENT ARCHITECTURE (ACPICA) <devel@xxxxxxxxxx>;
>> Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>
>> Subject: Re: [PATCH -next] ACPICA: Make acpi_protocol_lengths static
>>
>> On Sat, Mar 28, 2020 at 4:47 AM YueHaibing <yuehaibing@xxxxxxxxxx>
>> 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@xxxxxxxxxx>
>>
>> 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
>>>
>>>




[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