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