summaryrefslogtreecommitdiff
path: root/drivers/pci/vpd.c
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2021-04-01 18:44:15 +0200
committerBjorn Helgaas <bhelgaas@google.com>2021-04-30 14:38:32 -0500
commit0a08bc07610e172972985d6322fd671cff76c928 (patch)
tree8b2a6932b51288561d0423791c816f5126fff505 /drivers/pci/vpd.c
parent4cf0abbce69bde3d07757dfa9be6420407fdbc45 (diff)
PCI/VPD: Remove pci_vpd_find_tag() SRDT handling
Only SRDT tag is the end tag, and no caller is interested in it. This allows to remove all SRDT tag handling. Link: https://lore.kernel.org/r/3f63f06f-734f-8fff-9518-27fe1faf903d@gmail.com Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/vpd.c')
-rw-r--r--drivers/pci/vpd.c31
1 files changed, 6 insertions, 25 deletions
diff --git a/drivers/pci/vpd.c b/drivers/pci/vpd.c
index 79d4313c91a3..562d79b597b3 100644
--- a/drivers/pci/vpd.c
+++ b/drivers/pci/vpd.c
@@ -412,33 +412,14 @@ void pcie_vpd_remove_sysfs_dev_files(struct pci_dev *dev)
int pci_vpd_find_tag(const u8 *buf, unsigned int len, u8 rdt)
{
- int i;
-
- for (i = 0; i < len; ) {
- u8 val = buf[i];
-
- if (val & PCI_VPD_LRDT) {
- /* Don't return success of the tag isn't complete */
- if (i + PCI_VPD_LRDT_TAG_SIZE > len)
- break;
+ int i = 0;
- if (val == rdt)
- return i;
-
- i += PCI_VPD_LRDT_TAG_SIZE +
- pci_vpd_lrdt_size(&buf[i]);
- } else {
- u8 tag = val & ~PCI_VPD_SRDT_LEN_MASK;
-
- if (tag == rdt)
- return i;
-
- if (tag == PCI_VPD_SRDT_END)
- break;
+ /* look for LRDT tags only, end tag is the only SRDT tag */
+ while (i + PCI_VPD_LRDT_TAG_SIZE <= len && buf[i] & PCI_VPD_LRDT) {
+ if (buf[i] == rdt)
+ return i;
- i += PCI_VPD_SRDT_TAG_SIZE +
- pci_vpd_srdt_size(&buf[i]);
- }
+ i += PCI_VPD_LRDT_TAG_SIZE + pci_vpd_lrdt_size(buf + i);
}
return -ENOENT;