Skip to content

Commit 55006a2

Browse files
Ben Widawskydjbw
authored andcommitted
cxl/pci: Use pci core's DVSEC functionality
Reduce maintenance burden of DVSEC query implementation by using the centralized PCI core implementation. Signed-off-by: Ben Widawsky <[email protected]> [djbw: kill cxl_pci_dvsec()] Reviewed-by: Jonathan Cameron <[email protected]> Link: https://lore.kernel.org/r/163379788528.692348.11581080806976608802.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams <[email protected]>
1 parent ee12203 commit 55006a2

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

drivers/cxl/pci.c

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -340,29 +340,6 @@ static void cxl_unmap_regblock(struct pci_dev *pdev,
340340
map->base = NULL;
341341
}
342342

343-
static int cxl_pci_dvsec(struct pci_dev *pdev, int dvsec)
344-
{
345-
int pos;
346-
347-
pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_DVSEC);
348-
if (!pos)
349-
return 0;
350-
351-
while (pos) {
352-
u16 vendor, id;
353-
354-
pci_read_config_word(pdev, pos + PCI_DVSEC_HEADER1, &vendor);
355-
pci_read_config_word(pdev, pos + PCI_DVSEC_HEADER2, &id);
356-
if (vendor == PCI_DVSEC_VENDOR_ID_CXL && dvsec == id)
357-
return pos;
358-
359-
pos = pci_find_next_ext_capability(pdev, pos,
360-
PCI_EXT_CAP_ID_DVSEC);
361-
}
362-
363-
return 0;
364-
}
365-
366343
static int cxl_probe_regs(struct pci_dev *pdev, struct cxl_register_map *map)
367344
{
368345
struct cxl_component_reg_map *comp_map;
@@ -449,7 +426,8 @@ static int cxl_find_regblock(struct pci_dev *pdev, enum cxl_regloc_type type,
449426
u32 regloc_size, regblocks;
450427
int regloc, i;
451428

452-
regloc = cxl_pci_dvsec(pdev, PCI_DVSEC_ID_CXL_REGLOC_DVSEC_ID);
429+
regloc = pci_find_dvsec_capability(pdev, PCI_DVSEC_VENDOR_ID_CXL,
430+
PCI_DVSEC_ID_CXL_REGLOC_DVSEC_ID);
453431
if (!regloc)
454432
return -ENXIO;
455433

0 commit comments

Comments
 (0)