Commit 94c982bd authored by Matt Carlson's avatar Matt Carlson Committed by David S. Miller

tg3: Use pci_read_vpd() instead of private method

If the driver needs to use PCI configuration space to read the VPD data,
the accesses could collide with the pci_read_vpd() function.  This patch
converts the driver to use pci_read_vpd() to avoid any potential
collisions.
Signed-off-by: default avatarMatt Carlson <mcarlson@broadcom.com>
Reviewed-by: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 141518c9
...@@ -12455,31 +12455,20 @@ static void __devinit tg3_read_partno(struct tg3 *tp) ...@@ -12455,31 +12455,20 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
memcpy(&vpd_data[i], &tmp, sizeof(tmp)); memcpy(&vpd_data[i], &tmp, sizeof(tmp));
} }
} else { } else {
int vpd_cap; ssize_t cnt;
unsigned int pos = 0, i = 0;
vpd_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_VPD);
for (i = 0; i < TG3_NVM_VPD_LEN; i += 4) { for (; pos < TG3_NVM_VPD_LEN && i < 3; i++, pos += cnt) {
u32 tmp, j = 0; cnt = pci_read_vpd(tp->pdev, pos,
__le32 v; TG3_NVM_VPD_LEN - pos,
u16 tmp16; &vpd_data[pos]);
if (cnt == -ETIMEDOUT || -EINTR)
pci_write_config_word(tp->pdev, vpd_cap + PCI_VPD_ADDR, cnt = 0;
i); else if (cnt < 0)
while (j++ < 100) {
pci_read_config_word(tp->pdev, vpd_cap +
PCI_VPD_ADDR, &tmp16);
if (tmp16 & 0x8000)
break;
msleep(1);
}
if (!(tmp16 & 0x8000))
goto out_not_found; 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. */ /* Now parse and find the part number. */
......
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