lkml.org 
[lkml]   [2023]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v11 8/9] PCI: Split PME state selection into a local static function
From


On 8/11/2023 3:55 AM, Andy Shevchenko wrote:
> On Thu, Aug 10, 2023 at 11:29:49AM -0500, Limonciello, Mario wrote:
>> On 8/10/2023 11:21 AM, Andy Shevchenko wrote:
>>> On Wed, Aug 09, 2023 at 01:54:52PM -0500, Mario Limonciello wrote:
>
> ...
>
>>>> +static inline pci_power_t pci_get_wake_pme_state(struct pci_dev *dev)
>>>> +{
>>>> + pci_power_t state = PCI_D3hot;
>>>> +
>>>> + while (state && !(dev->pme_support & (1 << state)))
>>>> + state--;
>>>> +
>>>> + return state;
>>>
>>> Sparse won't be happy about this code (with CF=-D__CHECK_ENDIAN__).
>>>
>>> Basically it's something like
>>>
>>> return (__force pci_power_t)fls(dev->pme_support & GENMASK(PCI_D3hot, 0));
>>>
>>> (but double check and test the logic).
>>>
>>>> +}
>>>
>>> ...
>>>
>>> Yeah, I see that is the existing code, perhaps amend it first?
>>>
>>
>> Are you sure?
>
> Yes.
>
> Just the original code
>
> drivers/pci/pci.c:2711:60: warning: restricted pci_power_t degrades to integer
> drivers/pci/pci.c:2712:30: warning: restricted pci_power_t degrades to integer
>
> /*
> * Find the deepest state from which the device can generate
> * PME#.
> */
> 2711 ==> while (state && !(dev->pme_support & (1 << state)))
> 2712 ==> state--;
>
> How is yours different?
>
>> I actually double checked the sparse output using this
>> command before I sent it.
>>
>> make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' drivers/pci/pci.o
>>
>> I didn't see anything related to the line numbers for this function.
>
> Just in case...
>
> $ gcc --version
> gcc (Debian 12.3.0-5) 12.3.0
>
> $ sparse --version
> 0.6.4 (Debian: 0.6.4-3)
>
> $ make --version
> GNU Make 4.3
> Built for x86_64-pc-linux-gnu
>

Oh, I see why I wasn't observing it now. Because it's inline code it's
processed separately and isn't with the rest of the grouped output from
2416 through 2922.

drivers/pci/pci.c:2679:52: sparse: warning: restricted pci_power_t
degrades to integer
drivers/pci/pci.c:2680:22: sparse: warning: restricted pci_power_t
degrades to integer

\
 
 \ /
  Last update: 2023-08-11 14:40    [W:0.058 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site