Skip to content
Permalink
Browse files
fpga: dfl: pci: Use pci_find_vsec_capability() when looking for DFL
Currently the find_dfls_by_vsec() opens code pci_find_vsec_capability().
Refactor the former to use the latter. No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  • Loading branch information
andy-shev authored and intel-lab-lkp committed Nov 9, 2021
1 parent d2f38a3 commit dfc10076ac7a63331954a33cabf94a1af3632210
Showing 1 changed file with 5 additions and 12 deletions.
@@ -27,7 +27,7 @@
#define DRV_VERSION "0.8"
#define DRV_NAME "dfl-pci"

#define PCI_VSEC_ID_INTEL_DFLS 0x43
#define PCI_VSEC_ID_INTEL_DFLS 0x0043 /* FPGA Device Feature List */

#define PCI_VNDR_DFLS_CNT 0x8
#define PCI_VNDR_DFLS_RES 0xc
@@ -138,19 +138,12 @@ static int *cci_pci_create_irq_table(struct pci_dev *pcidev, unsigned int nvec)

static int find_dfls_by_vsec(struct pci_dev *pcidev, struct dfl_fpga_enum_info *info)
{
u32 bir, offset, vndr_hdr, dfl_cnt, dfl_res;
int dfl_res_off, i, bars, voff = 0;
u32 bir, offset, dfl_cnt, dfl_res;
resource_size_t start, len;
int dfl_res_off, i, bars;
u16 voff;

while ((voff = pci_find_next_ext_capability(pcidev, voff, PCI_EXT_CAP_ID_VNDR))) {
vndr_hdr = 0;
pci_read_config_dword(pcidev, voff + PCI_VNDR_HEADER, &vndr_hdr);

if (PCI_VNDR_HEADER_ID(vndr_hdr) == PCI_VSEC_ID_INTEL_DFLS &&
pcidev->vendor == PCI_VENDOR_ID_INTEL)
break;
}

voff = pci_find_vsec_capability(dev, PCI_VENDOR_ID_INTEL, PCI_VSEC_ID_INTEL_DFLS);
if (!voff) {
dev_dbg(&pcidev->dev, "%s no DFL VSEC found\n", __func__);
return -ENODEV;

0 comments on commit dfc1007

Please sign in to comment.