aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2010-02-26 09:04:42 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-28 03:43:32 -0500
commite1d5bdabb94da89bdb3c3f2ee105cf61fca88ec8 (patch)
treebc5b86b19bc49ace2df10ed9e7ba7d1ca2b74d33 /drivers/net/tg3.c
parentb55ac1b22690d2e5b02a61cf6d69c2d66969c79d (diff)
pci: Add VPD information field helper functions
This patch adds a preprocessor constant to describe the PCI VPD information field header size and an inline function to extract the size of the information field itself. 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.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 76ad141ab448..f59f36910e98 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -12604,9 +12604,9 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
12604 while (i < (block_end - 2)) { 12604 while (i < (block_end - 2)) {
12605 if (vpd_data[i + 0] == 'P' && 12605 if (vpd_data[i + 0] == 'P' &&
12606 vpd_data[i + 1] == 'N') { 12606 vpd_data[i + 1] == 'N') {
12607 int partno_len = vpd_data[i + 2]; 12607 int partno_len = pci_vpd_info_field_size(&vpd_data[i]);
12608 12608
12609 i += 3; 12609 i += PCI_VPD_INFO_FLD_HDR_SIZE;
12610 if (partno_len > TG3_BPN_SIZE || 12610 if (partno_len > TG3_BPN_SIZE ||
12611 (partno_len + i) > TG3_NVM_VPD_LEN) 12611 (partno_len + i) > TG3_NVM_VPD_LEN)
12612 goto out_not_found; 12612 goto out_not_found;
@@ -12617,7 +12617,8 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
12617 /* Success. */ 12617 /* Success. */
12618 return; 12618 return;
12619 } 12619 }
12620 i += 3 + vpd_data[i + 2]; 12620 i += PCI_VPD_INFO_FLD_HDR_SIZE +
12621 pci_vpd_info_field_size(&vpd_data[i]);
12621 } 12622 }
12622 12623
12623 /* Part number not found. */ 12624 /* Part number not found. */