From patchwork Thu Feb 25 18:19:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Carlson X-Patchwork-Id: 82087 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1PIKf95016184 for ; Thu, 25 Feb 2010 18:20:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932997Ab0BYSUd (ORCPT ); Thu, 25 Feb 2010 13:20:33 -0500 Received: from mms1.broadcom.com ([216.31.210.17]:1493 "EHLO mms1.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933244Ab0BYSUQ (ORCPT ); Thu, 25 Feb 2010 13:20:16 -0500 Received: from [10.9.200.133] by mms1.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.3.2)); Thu, 25 Feb 2010 10:20:06 -0800 X-Server-Uuid: 02CED230-5797-4B57-9875-D5D2FEE4708A Received: from mail-irva-12.broadcom.com (10.11.16.101) by IRVEXCHHUB02.corp.ad.broadcom.com (10.9.200.133) with Microsoft SMTP Server id 8.2.213.0; Thu, 25 Feb 2010 10:21:30 -0800 Received: from xw6200 (mcarlson.broadcom.com [10.12.148.101]) by mail-irva-12.broadcom.com (Postfix) with ESMTP id 2934869CB3; Thu, 25 Feb 2010 10:20:01 -0800 (PST) From: "Matt Carlson" To: jbarnes@virtuousgeek.org cc: linux-pci@vger.kernel.org, netdev@vger.kernel.org, andy@greyhouse.net, mcarlson@broadcom.com Subject: [PATCH 6/7] bnx2: Remove now useless VPD code Date: Thu, 25 Feb 2010 10:19:21 -0800 Message-ID: <1267121962-6077-7-git-send-email-mcarlson@broadcom.com> X-Mailer: git-send-email 1.6.4.4 MIME-Version: 1.0 X-WSS-ID: 679860DC20S40983370-01-01 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 25 Feb 2010 18:20:41 +0000 (UTC) diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index fa4dc85..f2f984a 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -7734,10 +7734,9 @@ bnx2_get_pci_speed(struct bnx2 *bp) static void __devinit bnx2_read_vpd_fw_ver(struct bnx2 *bp) { - int rc, i, v0_len = 0; + int rc, i, j; u8 *data; - u8 *v0_str = NULL; - bool mn_match = false; + unsigned int block_end, rosize, len; #define BNX2_VPD_NVRAM_OFFSET 0x300 #define BNX2_VPD_LEN 128 @@ -7759,57 +7758,42 @@ bnx2_read_vpd_fw_ver(struct bnx2 *bp) data[i + 3] = data[i + BNX2_VPD_LEN]; } - for (i = 0; i <= BNX2_VPD_LEN - 3; ) { - int j; - unsigned int block_end, rosize; - - i = pci_vpd_find_tag(data, i, BNX2_VPD_LEN, - PCI_VPD_LRDT_RO_DATA); - if (i < 0) - break; - - rosize = pci_vpd_lrdt_size(&data[i]); - block_end = i + PCI_VPD_LRDT_TAG_SIZE + rosize; - i += PCI_VPD_LRDT_TAG_SIZE; - - if (block_end > BNX2_VPD_LEN) - goto vpd_done; + i = pci_vpd_find_tag(data, 0, BNX2_VPD_LEN, PCI_VPD_LRDT_RO_DATA); + if (i < 0) + goto vpd_done; - j = pci_vpd_find_info_keyword(data, i, rosize, - PCI_VPD_RO_KEYWORD_MFR_ID); - if (j > 0) { - int len = pci_vpd_info_field_size(&data[j]); + rosize = pci_vpd_lrdt_size(&data[i]); + i += PCI_VPD_LRDT_TAG_SIZE; + block_end = i + rosize; - if (j + PCI_VPD_INFO_FLD_HDR_SIZE + len > block_end || - len != 4 || - memcmp(&data[j + PCI_VPD_INFO_FLD_HDR_SIZE], - "1028", 4)) - goto vpd_done; + if (block_end > BNX2_VPD_LEN) + goto vpd_done; - mn_match = true; - } + j = pci_vpd_find_info_keyword(data, i, rosize, + PCI_VPD_RO_KEYWORD_MFR_ID); + if (j < 0) + goto vpd_done; - j = pci_vpd_find_info_keyword(data, i, rosize, - PCI_VPD_RO_KEYWORD_VENDOR0); - if (j > 0) { - int len = pci_vpd_info_field_size(&data[j]); + len = pci_vpd_info_field_size(&data[j]); - j += PCI_VPD_INFO_FLD_HDR_SIZE; - if (j + len > block_end || len > BNX2_MAX_VER_SLEN) - goto vpd_done; + j += PCI_VPD_INFO_FLD_HDR_SIZE; + if (j + len > block_end || len != 4 || + memcmp(&data[j], "1028", 4)) + goto vpd_done; - v0_len = len; - v0_str = &data[j]; - } + j = pci_vpd_find_info_keyword(data, i, rosize, + PCI_VPD_RO_KEYWORD_VENDOR0); + if (j < 0) + goto vpd_done; - if (mn_match && v0_str) { - memcpy(bp->fw_version, v0_str, v0_len); - bp->fw_version[v0_len] = ' '; - goto vpd_done; - } + len = pci_vpd_info_field_size(&data[j]); + j += PCI_VPD_INFO_FLD_HDR_SIZE; + if (j + len > block_end || len > BNX2_MAX_VER_SLEN) goto vpd_done; - } + + memcpy(bp->fw_version, &data[j], len); + bp->fw_version[len] = ' '; vpd_done: kfree(data);