aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2010-02-26 09:04:44 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-28 03:43:33 -0500
commitdf25bc38b5531aa79a20e34549ea9fedf5f3ae36 (patch)
treeb2569618411d4085de83c4c02361a767711740bd /drivers/net/bnx2.c
parent4067a8541d397e9d6b443dd2ce0ecb78bfd991db (diff)
bnx2: Remove now useless VPD code
Now that the VPD searching code is abstracted away, the outer loop used to detect the read-only large resource data type section is useless. Signed-off-by: Matt Carlson <mcarlson@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.c74
1 files changed, 29 insertions, 45 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index bc23bfb687c3..381887ba677c 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -7743,10 +7743,9 @@ bnx2_get_pci_speed(struct bnx2 *bp)
7743static void __devinit 7743static void __devinit
7744bnx2_read_vpd_fw_ver(struct bnx2 *bp) 7744bnx2_read_vpd_fw_ver(struct bnx2 *bp)
7745{ 7745{
7746 int rc, i, v0_len = 0; 7746 int rc, i, j;
7747 u8 *data; 7747 u8 *data;
7748 u8 *v0_str = NULL; 7748 unsigned int block_end, rosize, len;
7749 bool mn_match = false;
7750 7749
7751#define BNX2_VPD_NVRAM_OFFSET 0x300 7750#define BNX2_VPD_NVRAM_OFFSET 0x300
7752#define BNX2_VPD_LEN 128 7751#define BNX2_VPD_LEN 128
@@ -7768,57 +7767,42 @@ bnx2_read_vpd_fw_ver(struct bnx2 *bp)
7768 data[i + 3] = data[i + BNX2_VPD_LEN]; 7767 data[i + 3] = data[i + BNX2_VPD_LEN];
7769 } 7768 }
7770 7769
7771 for (i = 0; i <= BNX2_VPD_LEN - 3; ) { 7770 i = pci_vpd_find_tag(data, 0, BNX2_VPD_LEN, PCI_VPD_LRDT_RO_DATA);
7772 int j; 7771 if (i < 0)
7773 unsigned int block_end, rosize; 7772 goto vpd_done;
7774
7775 i = pci_vpd_find_tag(data, i, BNX2_VPD_LEN,
7776 PCI_VPD_LRDT_RO_DATA);
7777 if (i < 0)
7778 break;
7779
7780 rosize = pci_vpd_lrdt_size(&data[i]);
7781 block_end = i + PCI_VPD_LRDT_TAG_SIZE + rosize;
7782 i += PCI_VPD_LRDT_TAG_SIZE;
7783
7784 if (block_end > BNX2_VPD_LEN)
7785 goto vpd_done;
7786 7773
7787 j = pci_vpd_find_info_keyword(data, i, rosize, 7774 rosize = pci_vpd_lrdt_size(&data[i]);
7788 PCI_VPD_RO_KEYWORD_MFR_ID); 7775 i += PCI_VPD_LRDT_TAG_SIZE;
7789 if (j > 0) { 7776 block_end = i + rosize;
7790 int len = pci_vpd_info_field_size(&data[j]);
7791 7777
7792 if (j + PCI_VPD_INFO_FLD_HDR_SIZE + len > block_end || 7778 if (block_end > BNX2_VPD_LEN)
7793 len != 4 || 7779 goto vpd_done;
7794 memcmp(&data[j + PCI_VPD_INFO_FLD_HDR_SIZE],
7795 "1028", 4))
7796 goto vpd_done;
7797 7780
7798 mn_match = true; 7781 j = pci_vpd_find_info_keyword(data, i, rosize,
7799 } 7782 PCI_VPD_RO_KEYWORD_MFR_ID);
7783 if (j < 0)
7784 goto vpd_done;
7800 7785
7801 j = pci_vpd_find_info_keyword(data, i, rosize, 7786 len = pci_vpd_info_field_size(&data[j]);
7802 PCI_VPD_RO_KEYWORD_VENDOR0);
7803 if (j > 0) {
7804 int len = pci_vpd_info_field_size(&data[j]);
7805 7787
7806 j += PCI_VPD_INFO_FLD_HDR_SIZE; 7788 j += PCI_VPD_INFO_FLD_HDR_SIZE;
7807 if (j + len > block_end || len > BNX2_MAX_VER_SLEN) 7789 if (j + len > block_end || len != 4 ||
7808 goto vpd_done; 7790 memcmp(&data[j], "1028", 4))
7791 goto vpd_done;
7809 7792
7810 v0_len = len; 7793 j = pci_vpd_find_info_keyword(data, i, rosize,
7811 v0_str = &data[j]; 7794 PCI_VPD_RO_KEYWORD_VENDOR0);
7812 } 7795 if (j < 0)
7796 goto vpd_done;
7813 7797
7814 if (mn_match && v0_str) { 7798 len = pci_vpd_info_field_size(&data[j]);
7815 memcpy(bp->fw_version, v0_str, v0_len);
7816 bp->fw_version[v0_len] = ' ';
7817 goto vpd_done;
7818 }
7819 7799
7800 j += PCI_VPD_INFO_FLD_HDR_SIZE;
7801 if (j + len > block_end || len > BNX2_MAX_VER_SLEN)
7820 goto vpd_done; 7802 goto vpd_done;
7821 } 7803
7804 memcpy(bp->fw_version, &data[j], len);
7805 bp->fw_version[len] = ' ';
7822 7806
7823vpd_done: 7807vpd_done:
7824 kfree(data); 7808 kfree(data);