Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <ben.widawsky@intel.com>
[djbw: kill cxl_pci_dvsec()]
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/163379788528.692348.11581080806976608802.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>

authored by

Ben Widawsky and committed by
Dan Williams
55006a2c ee122037

+2 -24
+2 -24
drivers/cxl/pci.c
··· 340 340 map->base = NULL; 341 341 } 342 342 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 - 366 343 static int cxl_probe_regs(struct pci_dev *pdev, struct cxl_register_map *map) 367 344 { 368 345 struct cxl_component_reg_map *comp_map; ··· 426 449 u32 regloc_size, regblocks; 427 450 int regloc, i; 428 451 429 - regloc = cxl_pci_dvsec(pdev, PCI_DVSEC_ID_CXL_REGLOC_DVSEC_ID); 452 + regloc = pci_find_dvsec_capability(pdev, PCI_DVSEC_VENDOR_ID_CXL, 453 + PCI_DVSEC_ID_CXL_REGLOC_DVSEC_ID); 430 454 if (!regloc) 431 455 return -ENXIO; 432 456