Skip to content

Commit 188973e

Browse files
Dunky-Zbjorn-helgaas
authored andcommitted
PCI: Remove redundant PCI_VSEC_HDR and PCI_VSEC_HDR_LEN_SHIFT
Remove duplicate macro PCI_VSEC_HDR and its related macro PCI_VSEC_HDR_LEN_SHIFT from pci_regs.h to avoid redundancy and inconsistencies. Update VFIO PCI code to use PCI_VNDR_HEADER and PCI_VNDR_HEADER_LEN() for consistent naming and functionality. These changes aim to streamline header handling while minimizing impact, given the niche usage of these macros in userspace. Link: https://lore.kernel.org/r/20241216013536.4487-1-zhangdongdong@eswincomputing.com Signed-off-by: Dongdong Zhang <zhangdongdong@eswincomputing.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Alex Williamson <alex.williamson@redhat.com>
1 parent 816875a commit 188973e

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

drivers/vfio/pci/vfio_pci_config.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,11 +1389,12 @@ static int vfio_ext_cap_len(struct vfio_pci_core_device *vdev, u16 ecap, u16 epo
13891389

13901390
switch (ecap) {
13911391
case PCI_EXT_CAP_ID_VNDR:
1392-
ret = pci_read_config_dword(pdev, epos + PCI_VSEC_HDR, &dword);
1392+
ret = pci_read_config_dword(pdev, epos + PCI_VNDR_HEADER,
1393+
&dword);
13931394
if (ret)
13941395
return pcibios_err_to_errno(ret);
13951396

1396-
return dword >> PCI_VSEC_HDR_LEN_SHIFT;
1397+
return PCI_VNDR_HEADER_LEN(dword);
13971398
case PCI_EXT_CAP_ID_VC:
13981399
case PCI_EXT_CAP_ID_VC9:
13991400
case PCI_EXT_CAP_ID_MFVC:

include/uapi/linux/pci_regs.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,9 +1001,6 @@
10011001
#define PCI_ACS_CTRL 0x06 /* ACS Control Register */
10021002
#define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */
10031003

1004-
#define PCI_VSEC_HDR 4 /* extended cap - vendor-specific */
1005-
#define PCI_VSEC_HDR_LEN_SHIFT 20 /* shift for length field */
1006-
10071004
/* SATA capability */
10081005
#define PCI_SATA_REGS 4 /* SATA REGs specifier */
10091006
#define PCI_SATA_REGS_MASK 0xF /* location - BAR#/inline */

0 commit comments

Comments
 (0)