From e1d5bdabb94da89bdb3c3f2ee105cf61fca88ec8 Mon Sep 17 00:00:00 2001 From: Matt Carlson Date: Fri, 26 Feb 2010 14:04:42 +0000 Subject: 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 Signed-off-by: Michael Chan Acked-by: Jesse Barnes Signed-off-by: David S. Miller --- drivers/net/tg3.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/net/tg3.c') diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 76ad141ab44..f59f36910e9 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -12604,9 +12604,9 @@ static void __devinit tg3_read_partno(struct tg3 *tp) while (i < (block_end - 2)) { if (vpd_data[i + 0] == 'P' && vpd_data[i + 1] == 'N') { - int partno_len = vpd_data[i + 2]; + int partno_len = pci_vpd_info_field_size(&vpd_data[i]); - i += 3; + i += PCI_VPD_INFO_FLD_HDR_SIZE; if (partno_len > TG3_BPN_SIZE || (partno_len + i) > TG3_NVM_VPD_LEN) goto out_not_found; @@ -12617,7 +12617,8 @@ static void __devinit tg3_read_partno(struct tg3 *tp) /* Success. */ return; } - i += 3 + vpd_data[i + 2]; + i += PCI_VPD_INFO_FLD_HDR_SIZE + + pci_vpd_info_field_size(&vpd_data[i]); } /* Part number not found. */ -- cgit v1.2.3