mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/quirks: Cast PCI_D0 to u16 in apple_airport_reset()
@ 2026-11-18 16:16 Habil Eren Türker
  2026-11-18 18:14 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Habil Eren Türker @ 2026-11-18 16:16 UTC (permalink / raw)
  To: Bjorn Helgaas, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86
  Cc: H . Peter Anvin, linux-pci, linux-kernel, Habil Eren Türker

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@hotmail.com>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-18 18:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 16:16 [PATCH] x86/quirks: Cast PCI_D0 to u16 in apple_airport_reset() Habil Eren Türker
2026-11-18 18:14 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®