summaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2010-02-26 15:04:41 +0100
committerDavid S. Miller <davem@davemloft.net>2010-02-28 09:43:32 +0100
commitb55ac1b22690d2e5b02a61cf6d69c2d66969c79d (patch)
treed336b38719dba482e2734f2091f5a60dfcb134b4 /drivers/net/tg3.c
parentpci: Add large and small resource data type code (diff)
downloadlinux-b55ac1b22690d2e5b02a61cf6d69c2d66969c79d.tar.xz
linux-b55ac1b22690d2e5b02a61cf6d69c2d66969c79d.zip
pci: Add helper to find a VPD resource data type
This patch adds the pci_vpd_find_tag() helper function to find VPD resource data types in a buffer. 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/tg3.c')
-rw-r--r--drivers/net/tg3.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index ed57a62b3ac8..76ad141ab448 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -12547,7 +12547,7 @@ skip_phy_reset:
static void __devinit tg3_read_partno(struct tg3 *tp)
{
unsigned char vpd_data[TG3_NVM_VPD_LEN]; /* in little-endian format */
- unsigned int i;
+ int i;
u32 magic;
if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) ||
@@ -12586,28 +12586,12 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
/* Now parse and find the part number. */
for (i = 0; i < TG3_NVM_VPD_LEN - 2; ) {
- unsigned char val = vpd_data[i];
unsigned int block_end;
- if (val & PCI_VPD_LRDT) {
- if (i + PCI_VPD_LRDT_TAG_SIZE > TG3_NVM_VPD_LEN)
- break;
-
- if (val != PCI_VPD_LRDT_RO_DATA) {
- i += PCI_VPD_LRDT_TAG_SIZE +
- pci_vpd_lrdt_size(&vpd_data[i]);
-
- continue;
- }
- } else {
- if ((val & PCI_VPD_SRDT_TIN_MASK) == PCI_VPD_STIN_END)
- break;
-
- i += PCI_VPD_SRDT_TAG_SIZE +
- pci_vpd_srdt_size(&vpd_data[i]);
-
- continue;
- }
+ i = pci_vpd_find_tag(vpd_data, i, TG3_NVM_VPD_LEN,
+ PCI_VPD_LRDT_RO_DATA);
+ if (i < 0)
+ break;
block_end = i + PCI_VPD_LRDT_TAG_SIZE +
pci_vpd_lrdt_size(&vpd_data[i]);