summaryrefslogtreecommitdiff
path: root/drivers/fpga/dfl-pci.c
diff options
context:
space:
mode:
authorXiongfeng Wang <wangxiongfeng2@huawei.com>2023-08-02 11:07:26 +0300
committerXu Yilun <yilun.xu@intel.com>2023-08-07 13:21:40 +0300
commit8607d9c1bd57da0a2d5f8ab2ec32b6ef7d85e66a (patch)
treeb83b974108bd5bb08bab492c131016fd3f3b6d47 /drivers/fpga/dfl-pci.c
parent3969f6458f783d2b4b8b15bef1eeab674eaa34bd (diff)
downloadlinux-8607d9c1bd57da0a2d5f8ab2ec32b6ef7d85e66a.tar.xz
fpga: dfl-pci: Use pci_find_vsec_capability() to simplify the code
PCI core add pci_find_vsec_capability() to query VSEC. We can use that core API to simplify the code. Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com> Acked-by: Xu Yilun <yilun.xu@intel.com> Link: https://lore.kernel.org/r/20230802080726.178194-1-wangxiongfeng2@huawei.com Signed-off-by: Xu Yilun <yilun.xu@intel.com>
Diffstat (limited to 'drivers/fpga/dfl-pci.c')
-rw-r--r--drivers/fpga/dfl-pci.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
index 1bc04378118c..98b8fd16183e 100644
--- a/drivers/fpga/dfl-pci.c
+++ b/drivers/fpga/dfl-pci.c
@@ -156,19 +156,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;
+ int dfl_res_off, i, bars, voff;
resource_size_t start, len;
- 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(pcidev, PCI_VENDOR_ID_INTEL,
+ PCI_VSEC_ID_INTEL_DFLS);
if (!voff) {
dev_dbg(&pcidev->dev, "%s no DFL VSEC found\n", __func__);
return -ENODEV;