PCI/ASPM: Consolidate link state defines
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 22 Mar 2024 12:39:51 +0000 (14:39 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 2 May 2024 21:58:11 +0000 (16:58 -0500)
commitb478e162f227d17d6a29f40ffd464af358334971
tree8163b44acc250c0bbaed43987ce32ce3805ed818
parent4cece764965020c22cff7665b18a012006359095
PCI/ASPM: Consolidate link state defines

The linux/pci.h and aspm.c files define their own sets of link state
related defines which are almost the same.

Consolidate the use of defines into those defined by linux/pci.h and expand
PCIE_LINK_STATE_L0S to match earlier ASPM_STATE_L0S that includes both
upstream and downstream bits. Rename also the defines that are internal to
aspm.c to start with PCIE_LINK_STATE for consistency.

While the PCIE_LINK_STATE_L0S BIT(0) -> (BIT(0) | BIT(1)) transformation is
not 1:1, in practice aspm.c already used ASPM_STATE_L0S that has both bits
enabled except during mapping.

While at it, place the PCIE_LINK_STATE_CLKPM define last to have more
logical grouping.

Use static_assert() to ensure PCIE_LINK_STATE_L0S is strictly equal to the
combination of PCIE_LINK_STATE_L0S_UP/DW.

Link: https://lore.kernel.org/r/20240322123952.6384-2-ilpo.jarvinen@linux.intel.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pcie/aspm.c
include/linux/pci.h