Commit 4181b2c8 authored by Matt Carlson's avatar Matt Carlson Committed by David S. Miller

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: default avatarMatt Carlson <mcarlson@broadcom.com>
Acked-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent df25bc38
...@@ -12547,7 +12547,8 @@ static int __devinit tg3_phy_probe(struct tg3 *tp) ...@@ -12547,7 +12547,8 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)
static void __devinit tg3_read_partno(struct tg3 *tp) static void __devinit tg3_read_partno(struct tg3 *tp)
{ {
unsigned char vpd_data[TG3_NVM_VPD_LEN]; /* in little-endian format */ unsigned char vpd_data[TG3_NVM_VPD_LEN]; /* in little-endian format */
int i; unsigned int block_end, rosize, len;
int i = 0;
u32 magic; u32 magic;
if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) || if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) ||
...@@ -12569,7 +12570,7 @@ static void __devinit tg3_read_partno(struct tg3 *tp) ...@@ -12569,7 +12570,7 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
} }
} else { } else {
ssize_t cnt; ssize_t cnt;
unsigned int pos = 0, i = 0; unsigned int pos = 0;
for (; pos < TG3_NVM_VPD_LEN && i < 3; i++, pos += cnt) { for (; pos < TG3_NVM_VPD_LEN && i < 3; i++, pos += cnt) {
cnt = pci_read_vpd(tp->pdev, pos, cnt = pci_read_vpd(tp->pdev, pos,
...@@ -12584,40 +12585,33 @@ static void __devinit tg3_read_partno(struct tg3 *tp) ...@@ -12584,40 +12585,33 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
goto out_not_found; goto out_not_found;
} }
/* Now parse and find the part number. */ i = pci_vpd_find_tag(vpd_data, 0, TG3_NVM_VPD_LEN,
for (i = 0; i < TG3_NVM_VPD_LEN - 2; ) { PCI_VPD_LRDT_RO_DATA);
unsigned int block_end, rosize; if (i < 0)
goto out_not_found;
i = pci_vpd_find_tag(vpd_data, i, TG3_NVM_VPD_LEN, rosize = pci_vpd_lrdt_size(&vpd_data[i]);
PCI_VPD_LRDT_RO_DATA); block_end = i + PCI_VPD_LRDT_TAG_SIZE + rosize;
if (i < 0) i += PCI_VPD_LRDT_TAG_SIZE;
break;
rosize = pci_vpd_lrdt_size(&vpd_data[i]); if (block_end > TG3_NVM_VPD_LEN)
block_end = i + PCI_VPD_LRDT_TAG_SIZE + rosize; goto out_not_found;
i += PCI_VPD_LRDT_TAG_SIZE;
if (block_end > TG3_NVM_VPD_LEN) i = pci_vpd_find_info_keyword(vpd_data, i, rosize,
goto out_not_found; PCI_VPD_RO_KEYWORD_PARTNO);
if (i < 0)
goto out_not_found;
i = pci_vpd_find_info_keyword(vpd_data, i, rosize, len = pci_vpd_info_field_size(&vpd_data[i]);
PCI_VPD_RO_KEYWORD_PARTNO);
if (i > 0) {
u8 len = pci_vpd_info_field_size(&vpd_data[i]);
i += PCI_VPD_INFO_FLD_HDR_SIZE; i += PCI_VPD_INFO_FLD_HDR_SIZE;
if (len > TG3_BPN_SIZE || if (len > TG3_BPN_SIZE ||
(len + i) > TG3_NVM_VPD_LEN) (len + i) > TG3_NVM_VPD_LEN)
break; goto out_not_found;
memcpy(tp->board_part_number, &vpd_data[i], len);
return; memcpy(tp->board_part_number, &vpd_data[i], len);
}
/* Part number not found. */ return;
goto out_not_found;
}
out_not_found: out_not_found:
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment