]> Git Repo - J-linux.git/commitdiff
cxl/pci: Use pci core's DVSEC functionality
authorBen Widawsky <[email protected]>
Sat, 9 Oct 2021 16:44:45 +0000 (09:44 -0700)
committerDan Williams <[email protected]>
Fri, 29 Oct 2021 18:53:52 +0000 (11:53 -0700)
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]>
drivers/cxl/pci.c

index 691a4e59ad8b797e54035c654d974d5b7bfad691..c734e21fb4e0e2c041ff428fbcf1bf911994e8ec 100644 (file)
@@ -340,29 +340,6 @@ static void cxl_unmap_regblock(struct pci_dev *pdev,
        map->base = NULL;
 }
 
-static int cxl_pci_dvsec(struct pci_dev *pdev, int dvsec)
-{
-       int pos;
-
-       pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_DVSEC);
-       if (!pos)
-               return 0;
-
-       while (pos) {
-               u16 vendor, id;
-
-               pci_read_config_word(pdev, pos + PCI_DVSEC_HEADER1, &vendor);
-               pci_read_config_word(pdev, pos + PCI_DVSEC_HEADER2, &id);
-               if (vendor == PCI_DVSEC_VENDOR_ID_CXL && dvsec == id)
-                       return pos;
-
-               pos = pci_find_next_ext_capability(pdev, pos,
-                                                  PCI_EXT_CAP_ID_DVSEC);
-       }
-
-       return 0;
-}
-
 static int cxl_probe_regs(struct pci_dev *pdev, struct cxl_register_map *map)
 {
        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,
        u32 regloc_size, regblocks;
        int regloc, i;
 
-       regloc = cxl_pci_dvsec(pdev, PCI_DVSEC_ID_CXL_REGLOC_DVSEC_ID);
+       regloc = pci_find_dvsec_capability(pdev, PCI_DVSEC_VENDOR_ID_CXL,
+                                          PCI_DVSEC_ID_CXL_REGLOC_DVSEC_ID);
        if (!regloc)
                return -ENXIO;
 
This page took 0.052447 seconds and 4 git commands to generate.