diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2021-08-26 20:56:22 +0200 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2021-08-31 23:09:38 +0200 |
commit | 24c521f81c305191a7c3938932ed7de1f157ff64 (patch) | |
tree | 07c5cc61ddda70911e554f2ddde729c581a3205c /drivers/net/ethernet/chelsio/cxgb4 | |
parent | PCI/VPD: Add pci_vpd_find_id_string() (diff) | |
download | linux-24c521f81c305191a7c3938932ed7de1f157ff64.tar.xz linux-24c521f81c305191a7c3938932ed7de1f157ff64.zip |
cxgb4: Use pci_vpd_find_id_string() to find VPD ID string
Use pci_vpd_find_id_string() to find the VPD ID string. This simplifies the
code and avoids the need for pci_vpd_lrdt_size().
Link: https://lore.kernel.org/r/19ea2e9b-6e94-288a-6612-88db01b1b417@gmail.com
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/net/ethernet/chelsio/cxgb4')
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index 5e8ac42ac6ab..64144b6171d7 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c @@ -2744,7 +2744,7 @@ int t4_seeprom_wp(struct adapter *adapter, bool enable) int t4_get_raw_vpd_params(struct adapter *adapter, struct vpd_params *p) { unsigned int id_len, pn_len, sn_len, na_len; - int sn, pn, na, addr, ret = 0; + int id, sn, pn, na, addr, ret = 0; u8 *vpd, base_val = 0; vpd = vmalloc(VPD_LEN); @@ -2764,13 +2764,10 @@ int t4_get_raw_vpd_params(struct adapter *adapter, struct vpd_params *p) if (ret < 0) goto out; - if (vpd[0] != PCI_VPD_LRDT_ID_STRING) { - dev_err(adapter->pdev_dev, "missing VPD ID string\n"); - ret = -EINVAL; + ret = pci_vpd_find_id_string(vpd, VPD_LEN, &id_len); + if (ret < 0) goto out; - } - - id_len = pci_vpd_lrdt_size(vpd); + id = ret; ret = pci_vpd_check_csum(vpd, VPD_LEN); if (ret) { @@ -2796,7 +2793,7 @@ int t4_get_raw_vpd_params(struct adapter *adapter, struct vpd_params *p) goto out; na = ret; - memcpy(p->id, vpd + PCI_VPD_LRDT_TAG_SIZE, min_t(int, id_len, ID_LEN)); + memcpy(p->id, vpd + id, min_t(int, id_len, ID_LEN)); strim(p->id); memcpy(p->sn, vpd + sn, min_t(int, sn_len, SERNUM_LEN)); strim(p->sn); |