[PATCH v3 0/4] PCI: Add pci_power_t helper functions

From: Habil Eren Türker

Date: Sat Nov 21 2026 - 07:59:25 EST


This series introduces helper functions for accessing PCI power
states in the Power Management Control/Status register and
converts existing PMCSR accesses to use these helpers.

The helpers provide typed access to the PCI power state field,
including extraction, setting, and comparison operations.
The series also updates the Apple Airport reset quirk to use
the new comparison helper.

This follows the discussion with Andy Shevchenko and
Bjorn Helgaas in response to "x86/quirks: Cast PCI_D0
to u16 in apple_airport_reset()" [1].

Changes in v2:
- Add helpers for comparing PCI power states.
- Convert PCI core and quirk code to use the new helpers.
- Address review feedback.

Changes in v3:
- Move helpers' positions to upper lines of the pci.h with
header include.
- Fix indentation in pci.c.
- Rename function `pci_power_eq()` to `pci_power_t_eq()` for
API name consistency.
- Rewrite pci_power_t_eq() parameters for comparison of
two `pci_power_t` type variables.
- Modify `pci_power_t_set` to use `u16 *csr` instead of
u32.
- Use `FIELD_MODIFY()` in `pci_power_t_set()`.
- Remove `pci_power_gt` and `pci_power_lt`.
- Add resolved Sparse warnings to commit messages.
- Link to v2: https://lore.kernel.org/lkml/cover.1795097970.git.habilerenturker@xxxxxxxxxxx/

Link: https://lore.kernel.org/lkml/20261118161559.63617-1-habilerenturker@xxxxxxxxxxx/ [1]

Note: LLM assistance was used for editing the cover letter and
commit descriptions. ALl changes were reviewed by the submitter.

Habil Eren Türker (4):
PCI: Add pci_power_t helper functions
PCI: Convert pci.c to pci_power_t helpers
PCI: Convert quirks.c to pci_power_t helpers
x86/quirks: Use pci_power_t_eq() in apple_airport_reset()

arch/x86/kernel/early-quirks.c | 6 +++---
drivers/pci/pci.c | 28 ++++++++++++----------------
drivers/pci/quirks.c | 2 +-
include/linux/pci.h | 17 +++++++++++++++++
4 files changed, 33 insertions(+), 20 deletions(-)

--
2.47.3