diff options
author | Matt Carlson <mcarlson@broadcom.com> | 2010-02-26 09:04:45 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-28 03:43:34 -0500 |
commit | 4181b2c8bc29bb756ac1816678104b528377b656 (patch) | |
tree | a886d2a9a49c17f4e3b84376ef41c4421bb4aa5a /drivers/net | |
parent | df25bc38b5531aa79a20e34549ea9fedf5f3ae36 (diff) |
tg3: 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')
-rw-r--r-- | drivers/net/tg3.c | 52 |
1 files changed, 23 insertions, 29 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 204c565caa5a..0fa7688ab483 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -12547,7 +12547,8 @@ skip_phy_reset: | |||
12547 | static void __devinit tg3_read_partno(struct tg3 *tp) | 12547 | static void __devinit tg3_read_partno(struct tg3 *tp) |
12548 | { | 12548 | { |
12549 | unsigned char vpd_data[TG3_NVM_VPD_LEN]; /* in little-endian format */ | 12549 | unsigned char vpd_data[TG3_NVM_VPD_LEN]; /* in little-endian format */ |
12550 | int i; | 12550 | unsigned int block_end, rosize, len; |
12551 | int i = 0; | ||
12551 | u32 magic; | 12552 | u32 magic; |
12552 | 12553 | ||
12553 | if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) || | 12554 | if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) || |
@@ -12569,7 +12570,7 @@ static void __devinit tg3_read_partno(struct tg3 *tp) | |||
12569 | } | 12570 | } |
12570 | } else { | 12571 | } else { |
12571 | ssize_t cnt; | 12572 | ssize_t cnt; |
12572 | unsigned int pos = 0, i = 0; | 12573 | unsigned int pos = 0; |
12573 | 12574 | ||
12574 | for (; pos < TG3_NVM_VPD_LEN && i < 3; i++, pos += cnt) { | 12575 | for (; pos < TG3_NVM_VPD_LEN && i < 3; i++, pos += cnt) { |
12575 | cnt = pci_read_vpd(tp->pdev, pos, | 12576 | cnt = pci_read_vpd(tp->pdev, pos, |
@@ -12584,40 +12585,33 @@ static void __devinit tg3_read_partno(struct tg3 *tp) | |||
12584 | goto out_not_found; | 12585 | goto out_not_found; |
12585 | } | 12586 | } |
12586 | 12587 | ||
12587 | /* Now parse and find the part number. */ | 12588 | i = pci_vpd_find_tag(vpd_data, 0, TG3_NVM_VPD_LEN, |
12588 | for (i = 0; i < TG3_NVM_VPD_LEN - 2; ) { | 12589 | PCI_VPD_LRDT_RO_DATA); |
12589 | unsigned int block_end, rosize; | 12590 | if (i < 0) |
12591 | goto out_not_found; | ||
12590 | 12592 | ||
12591 | i = pci_vpd_find_tag(vpd_data, i, TG3_NVM_VPD_LEN, | 12593 | rosize = pci_vpd_lrdt_size(&vpd_data[i]); |
12592 | PCI_VPD_LRDT_RO_DATA); | 12594 | block_end = i + PCI_VPD_LRDT_TAG_SIZE + rosize; |
12593 | if (i < 0) | 12595 | i += PCI_VPD_LRDT_TAG_SIZE; |
12594 | break; | ||
12595 | 12596 | ||
12596 | rosize = pci_vpd_lrdt_size(&vpd_data[i]); | 12597 | if (block_end > TG3_NVM_VPD_LEN) |
12597 | block_end = i + PCI_VPD_LRDT_TAG_SIZE + rosize; | 12598 | goto out_not_found; |
12598 | i += PCI_VPD_LRDT_TAG_SIZE; | ||
12599 | 12599 | ||
12600 | if (block_end > TG3_NVM_VPD_LEN) | 12600 | i = pci_vpd_find_info_keyword(vpd_data, i, rosize, |
12601 | goto out_not_found; | 12601 | PCI_VPD_RO_KEYWORD_PARTNO); |
12602 | if (i < 0) | ||
12603 | goto out_not_found; | ||
12602 | 12604 | ||
12603 | i = pci_vpd_find_info_keyword(vpd_data, i, rosize, | 12605 | len = pci_vpd_info_field_size(&vpd_data[i]); |
12604 | PCI_VPD_RO_KEYWORD_PARTNO); | ||
12605 | if (i > 0) { | ||
12606 | u8 len = pci_vpd_info_field_size(&vpd_data[i]); | ||
12607 | 12606 | ||
12608 | i += PCI_VPD_INFO_FLD_HDR_SIZE; | 12607 | i += PCI_VPD_INFO_FLD_HDR_SIZE; |
12609 | if (len > TG3_BPN_SIZE || | 12608 | if (len > TG3_BPN_SIZE || |
12610 | (len + i) > TG3_NVM_VPD_LEN) | 12609 | (len + i) > TG3_NVM_VPD_LEN) |
12611 | break; | 12610 | goto out_not_found; |
12612 | |||
12613 | memcpy(tp->board_part_number, &vpd_data[i], len); | ||
12614 | 12611 | ||
12615 | return; | 12612 | memcpy(tp->board_part_number, &vpd_data[i], len); |
12616 | } | ||
12617 | 12613 | ||
12618 | /* Part number not found. */ | 12614 | return; |
12619 | goto out_not_found; | ||
12620 | } | ||
12621 | 12615 | ||
12622 | out_not_found: | 12616 | out_not_found: |
12623 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) | 12617 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) |