linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Bjorn Helgaas <bhelgaas@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	David Miller <davem@davemloft.net>,
	Raju Rangoju <rajur@chelsio.com>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: [PATCH 2/5] PCI/VPD: Use pci_read_vpd_any() in pci_vpd_size()
Date: Fri, 10 Sep 2021 08:22:49 +0200	[thread overview]
Message-ID: <049fa71c-c7af-9c69-51c0-05c1bc2bf660@gmail.com> (raw)
In-Reply-To: <ba0b18a3-64d8-d72f-9e9f-ad3e4d7ae3b8@gmail.com>

Use new function pci_read_vpd_any() to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/pci/vpd.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/vpd.c b/drivers/pci/vpd.c
index 286cad2a6..517789205 100644
--- a/drivers/pci/vpd.c
+++ b/drivers/pci/vpd.c
@@ -57,10 +57,7 @@ static size_t pci_vpd_size(struct pci_dev *dev)
 	size_t off = 0, size;
 	unsigned char tag, header[1+2];	/* 1 byte tag, 2 bytes length */
 
-	/* Otherwise the following reads would fail. */
-	dev->vpd.len = PCI_VPD_MAX_SIZE;
-
-	while (pci_read_vpd(dev, off, 1, header) == 1) {
+	while (pci_read_vpd_any(dev, off, 1, header) == 1) {
 		size = 0;
 
 		if (off == 0 && (header[0] == 0x00 || header[0] == 0xff))
@@ -68,7 +65,7 @@ static size_t pci_vpd_size(struct pci_dev *dev)
 
 		if (header[0] & PCI_VPD_LRDT) {
 			/* Large Resource Data Type Tag */
-			if (pci_read_vpd(dev, off + 1, 2, &header[1]) != 2) {
+			if (pci_read_vpd_any(dev, off + 1, 2, &header[1]) != 2) {
 				pci_warn(dev, "failed VPD read at offset %zu\n",
 					 off + 1);
 				return off ?: PCI_VPD_SZ_INVALID;
-- 
2.33.0



  parent reply	other threads:[~2021-09-10  6:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10  6:20 [PATCH 0/5] PCI/VPD: Add and use pci_read/write_vpd_any() Heiner Kallweit
2021-09-10  6:22 ` [PATCH 1/5] PCI/VPD: Add pci_read/write_vpd_any() Heiner Kallweit
2021-10-12 18:59   ` Qian Cai
2021-10-12 20:26     ` Heiner Kallweit
2021-10-13 14:22       ` Qian Cai
2021-10-13 18:08         ` Heiner Kallweit
2021-09-10  6:22 ` Heiner Kallweit [this message]
2021-10-27 11:01   ` [PATCH 2/5] PCI/VPD: Use pci_read_vpd_any() in pci_vpd_size() Jon Hunter
2021-10-27 11:32     ` Heiner Kallweit
2021-10-28  8:45       ` Jon Hunter
2021-09-10  6:24 ` [PATCH 3/5] cxgb3: Remove t3_seeprom_read and use VPD API Heiner Kallweit
2021-09-10  6:25 ` [PATCH 4/5] cxgb3: Use VPD API in t3_seeprom_wp() Heiner Kallweit
2021-09-10  6:27 ` [PATCH 5/5] cxgb3: Remove seeprom_write and use VPD API Heiner Kallweit
2021-10-08 22:53 ` [PATCH 0/5] PCI/VPD: Add and use pci_read/write_vpd_any() Bjorn Helgaas
2021-10-08 23:42   ` Jakub Kicinski
2021-10-11 20:43     ` Bjorn Helgaas

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=049fa71c-c7af-9c69-51c0-05c1bc2bf660@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rajur@chelsio.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;
as well as URLs for NNTP newsgroup(s).