[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3d13c3b2-fdb8-4782-ada5-cf3f94e0e643@amd.com>
Date: Fri, 11 Aug 2023 07:40:08 -0500
From: "Limonciello, Mario" <mario.limonciello@....com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: "Rafael J . Wysocki" <rafael@...nel.org>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Bjorn Helgaas <helgaas@...nel.org>, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
Iain Lane <iain@...ngesquash.org.uk>,
Shyam-sundar S-k <Shyam-sundar.S-k@....com>
Subject: Re: [PATCH v11 8/9] PCI: Split PME state selection into a local
static function
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
Powered by blists - more mailing lists