aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2010-02-26 14:04:42 +0000
committerDavid S. Miller <davem@davemloft.net>2010-02-28 00:43:32 -0800
commite1d5bdabb94da89bdb3c3f2ee105cf61fca88ec8 (patch)
treebc5b86b19bc49ace2df10ed9e7ba7d1ca2b74d33 /drivers/net/bnx2.c
parentpci: Add helper to find a VPD resource data type (diff)
downloadlinux-dev-e1d5bdabb94da89bdb3c3f2ee105cf61fca88ec8.tar.xz
linux-dev-e1d5bdabb94da89bdb3c3f2ee105cf61fca88ec8.zip
pci: Add VPD information field helper functions
This patch adds a preprocessor constant to describe the PCI VPD information field header size and an inline function to extract the size of the information field itself. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2.c')
-rw-r--r--drivers/net/bnx2.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index fd43feb5a350..b808707f83ff 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -7784,14 +7784,15 @@ bnx2_read_vpd_fw_ver(struct bnx2 *bp)
goto vpd_done;
while (i < (block_end - 2)) {
- int len = data[i + 2];
+ int len = pci_vpd_info_field_size(&data[i]);
- if (i + 3 + len > block_end)
+ if (i + PCI_VPD_INFO_FLD_HDR_SIZE + len > block_end)
goto vpd_done;
if (data[i] == 'M' && data[i + 1] == 'N') {
if (len != 4 ||
- memcmp(&data[i + 3], "1028", 4))
+ memcmp(&data[i + PCI_VPD_INFO_FLD_HDR_SIZE],
+ "1028", 4))
goto vpd_done;
mn_match = true;
@@ -7800,9 +7801,9 @@ bnx2_read_vpd_fw_ver(struct bnx2 *bp)
goto vpd_done;
v0_len = len;
- v0_str = &data[i + 3];
+ v0_str = &data[i + PCI_VPD_INFO_FLD_HDR_SIZE];
}
- i += 3 + len;
+ i += PCI_VPD_INFO_FLD_HDR_SIZE + len;
if (mn_match && v0_str) {
memcpy(bp->fw_version, v0_str, v0_len);