History

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.

Dongdong Zhang committed 1 year ago

Commit 188973e1 parent 816875a2 files · +3 −5Browse files

Unified · Split

2 files
  1. drivers/vfio/pci/vfio_pci_config.c +3 −2
  2. include/uapi/linux/pci_regs.h +0 −3
drivers/vfio/pci/vfio_pci_config.c+3−2
@@ -1389,11 +1389,12 @@ static int vfio_ext_cap_len(struct vfio_pci_core_device *vdev, u16 ecap, u16 epo · 1388 unmodified lines
1389 1389
1390 switch (ecap) {1390 switch (ecap) {
1391 case PCI_EXT_CAP_ID_VNDR:1391 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);
1393 if (ret)1394 if (ret)
1394 return pcibios_err_to_errno(ret);1395 return pcibios_err_to_errno(ret);
1395 1396
1396 return dword >> PCI_VSEC_HDR_LEN_SHIFT;1397 return PCI_VNDR_HEADER_LEN(dword);
1397 case PCI_EXT_CAP_ID_VC:1398 case PCI_EXT_CAP_ID_VC:
1398 case PCI_EXT_CAP_ID_VC9:1399 case PCI_EXT_CAP_ID_VC9:
1399 case PCI_EXT_CAP_ID_MFVC:1400 case PCI_EXT_CAP_ID_MFVC:
include/uapi/linux/pci_regs.h+0−3
@@ -1001,9 +1001,6 @@ · 1000 unmodified lines
1001#define PCI_ACS_CTRL 0x06 /* ACS Control Register */1001#define PCI_ACS_CTRL 0x06 /* ACS Control Register */
1002#define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */1002#define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */
1003 1003
1004#define PCI_VSEC_HDR 4 /* extended cap - vendor-specific */
1005#define PCI_VSEC_HDR_LEN_SHIFT 20 /* shift for length field */
1006
1007/* SATA capability */1004/* SATA capability */
1008#define PCI_SATA_REGS 4 /* SATA REGs specifier */1005#define PCI_SATA_REGS 4 /* SATA REGs specifier */
1009#define PCI_SATA_REGS_MASK 0xF /* location - BAR#/inline */1006#define PCI_SATA_REGS_MASK 0xF /* location - BAR#/inline */