From: Tom Rix <trix@redhat.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Moritz Fischer <mdf@kernel.org>,
Matthew Gerlach <matthew.gerlach@linux.intel.com>,
linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Wu Hao <hao.wu@intel.com>, Xu Yilun <yilun.xu@intel.com>
Subject: Re: [PATCH v1 1/1] fpga: dfl: pci: Use pci_find_vsec_capability() when looking for DFL
Date: Tue, 9 Nov 2021 07:55:43 -0800 [thread overview]
Message-ID: <8ccc133a-fb47-4548-fee3-d57775a5166d@redhat.com> (raw)
In-Reply-To: <20211109154127.18455-1-andriy.shevchenko@linux.intel.com>
On 11/9/21 7:41 AM, Andy Shevchenko wrote:
> 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>
> ---
> drivers/fpga/dfl-pci.c | 17 +++++------------
> 1 file changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
> index 4d68719e608f..52b5e94db9c3 100644
> --- a/drivers/fpga/dfl-pci.c
> +++ b/drivers/fpga/dfl-pci.c
> @@ -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;
The later use of voff in pci_read_config_dword is of type 'int', it may
be better to keep voff as an int.
>
> - 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);
This may be a weakness in the origin code, but intel isn't the exclusive
user of DFL.
Tom
> if (!voff) {
> dev_dbg(&pcidev->dev, "%s no DFL VSEC found\n", __func__);
> return -ENODEV;
next prev parent reply other threads:[~2021-11-09 15:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-09 15:41 [PATCH v1 1/1] fpga: dfl: pci: Use pci_find_vsec_capability() when looking for DFL Andy Shevchenko
2021-11-09 15:55 ` Tom Rix [this message]
2021-11-09 18:05 ` Andy Shevchenko
2021-11-09 18:27 ` Tom Rix
2021-11-09 18:51 ` matthew.gerlach
2021-11-10 3:44 ` Xu Yilun
2021-11-10 3:51 ` Wu, Hao
2021-11-10 8:24 ` Andy Shevchenko
2021-11-10 12:27 ` Tom Rix
2021-11-10 16:59 ` Andy Shevchenko
2024-04-03 11:01 ` Andy Shevchenko
2024-04-03 15:10 ` Xu Yilun
2024-04-03 15:46 ` Andy Shevchenko
2021-11-12 4:25 ` kernel test robot
2021-11-13 6:47 ` kernel test robot
2021-11-15 6:39 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8ccc133a-fb47-4548-fee3-d57775a5166d@redhat.com \
--to=trix@redhat.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=hao.wu@intel.com \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.gerlach@linux.intel.com \
--cc=mdf@kernel.org \
--cc=yilun.xu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox