[PATCH] x86/quirks: Cast PCI_D0 to u16 in apple_airport_reset()
From: Habil Eren Türker
Date: Wed Nov 18 2026 - 11:16:11 EST
PCI_D0 is defined as pci_power_t, whereas pmcsr & PCI_PM_CTRL_STATE_MASK
evaluates to a u16 integer.
This causes Sparse (make C=1) to report:
warning: restricted pci_power_t degrades to integer
Add (__force u16) casts on PCI_D0 to explicitly eliminate warnings.
Signed-off-by: Habil Eren Türker <habilerenturker@xxxxxxxxxxx>
---
arch/x86/kernel/early-quirks.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index 6b6f32f40cbe..7459a073c74d 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -644,13 +644,13 @@ static void __init apple_airport_reset(int bus, int slot, int func)
/* Card may have been put into PCI_D3hot by grub quirk */
pmcsr = read_pci_config_16(bus, slot, func, BCM4331_PM_CAP + PCI_PM_CTRL);
- if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0) {
+ if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != (__force u16)PCI_D0) {
pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
write_pci_config_16(bus, slot, func, BCM4331_PM_CAP + PCI_PM_CTRL, pmcsr);
mdelay(10);
pmcsr = read_pci_config_16(bus, slot, func, BCM4331_PM_CAP + PCI_PM_CTRL);
- if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0) {
+ if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != (__force u16)PCI_D0) {
pr_err("pci 0000:%02x:%02x.%d: Cannot power up Apple AirPort card\n",
bus, slot, func);
return;
--
2.47.3