Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 172138
b: refs/heads/master
c: 94c982b
h: refs/heads/master
v: v3
  • Loading branch information
Matt Carlson authored and David S. Miller committed Dec 3, 2009
1 parent d016ba7 commit e70bc57
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 141518c95870228da4e050fbe31a8f0c9df82c72
refs/heads/master: 94c982bd9f07b801f03cebe32b20f893b4ad6d27
35 changes: 12 additions & 23 deletions trunk/drivers/net/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -12455,31 +12455,20 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
memcpy(&vpd_data[i], &tmp, sizeof(tmp));
}
} else {
int vpd_cap;

vpd_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_VPD);
for (i = 0; i < TG3_NVM_VPD_LEN; i += 4) {
u32 tmp, j = 0;
__le32 v;
u16 tmp16;

pci_write_config_word(tp->pdev, vpd_cap + PCI_VPD_ADDR,
i);
while (j++ < 100) {
pci_read_config_word(tp->pdev, vpd_cap +
PCI_VPD_ADDR, &tmp16);
if (tmp16 & 0x8000)
break;
msleep(1);
}
if (!(tmp16 & 0x8000))
ssize_t cnt;
unsigned int pos = 0, i = 0;

for (; pos < TG3_NVM_VPD_LEN && i < 3; i++, pos += cnt) {
cnt = pci_read_vpd(tp->pdev, pos,
TG3_NVM_VPD_LEN - pos,
&vpd_data[pos]);
if (cnt == -ETIMEDOUT || -EINTR)
cnt = 0;
else if (cnt < 0)
goto out_not_found;

pci_read_config_dword(tp->pdev, vpd_cap + PCI_VPD_DATA,
&tmp);
v = cpu_to_le32(tmp);
memcpy(&vpd_data[i], &v, sizeof(v));
}
if (pos != TG3_NVM_VPD_LEN)
goto out_not_found;
}

/* Now parse and find the part number. */
Expand Down

0 comments on commit e70bc57

Please sign in to comment.