Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 56427
b: refs/heads/master
c: 1af7f05
h: refs/heads/master
i:
  56425: 922bbf3
  56423: bd9ee39
v: v3
  • Loading branch information
olof@lixom.net authored and Jeff Garzik committed May 15, 2007
1 parent cf992f7 commit 37ce92a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 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: fd17825480b2de3076727c677f8e257623705963
refs/heads/master: 1af7f05628fab81fdf4412d757676412ba5db660
17 changes: 14 additions & 3 deletions trunk/drivers/net/pasemi_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
{
struct pci_dev *pdev = mac->pdev;
struct device_node *dn = pci_device_to_OF_node(pdev);
int len;
const u8 *maddr;
u8 addr[6];

Expand All @@ -94,9 +95,17 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
return -ENOENT;
}

maddr = of_get_property(dn, "local-mac-address", NULL);
maddr = of_get_property(dn, "local-mac-address", &len);

if (maddr && len == 6) {
memcpy(mac->mac_addr, maddr, 6);
return 0;
}

/* Some old versions of firmware mistakenly uses mac-address
* (and as a string) instead of a byte array in local-mac-address.
*/

/* Fall back to mac-address for older firmware */
if (maddr == NULL)
maddr = of_get_property(dn, "mac-address", NULL);

Expand All @@ -106,14 +115,16 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
return -ENOENT;
}


if (sscanf(maddr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &addr[0],
&addr[1], &addr[2], &addr[3], &addr[4], &addr[5]) != 6) {
dev_warn(&pdev->dev,
"can't parse mac address, not configuring\n");
return -EINVAL;
}

memcpy(mac->mac_addr, addr, sizeof(addr));
memcpy(mac->mac_addr, addr, 6);

return 0;
}

Expand Down

0 comments on commit 37ce92a

Please sign in to comment.