summaryrefslogtreecommitdiff
path: root/drivers/net/sungem.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-06-23 03:18:54 +0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-06-24 10:15:26 +0400
commitde8d28b16f5614aeb12bb69c8f9a38578b8d3ada (patch)
tree152f0930dc099606342e9cc6d9a3892cd9f3f192 /drivers/net/sungem.c
parent765b5f32730cfd2608291e679060b0391570c8b3 (diff)
downloadlinux-de8d28b16f5614aeb12bb69c8f9a38578b8d3ada.tar.xz
[SPARC64]: Convert sparc64 PCI layer to in-kernel device tree.
One thing this change pointed out was that we really should pull the "get 'local-mac-address' property" logic into a helper function all the network drivers can call. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sungem.c')
-rw-r--r--drivers/net/sungem.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 38cd30cb7c75..5248670d29f7 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -2880,17 +2880,20 @@ static int __devinit gem_get_device_address(struct gem *gp)
#if defined(__sparc__)
struct pci_dev *pdev = gp->pdev;
struct pcidev_cookie *pcp = pdev->sysdata;
- int node = -1;
+ int use_idprom = 1;
if (pcp != NULL) {
- node = pcp->prom_node;
- if (prom_getproplen(node, "local-mac-address") == 6)
- prom_getproperty(node, "local-mac-address",
- dev->dev_addr, 6);
- else
- node = -1;
+ unsigned char *addr;
+ int len;
+
+ addr = of_get_property(pcp->prom_node, "local-mac-address",
+ &len);
+ if (addr && len == 6) {
+ use_idprom = 0;
+ memcpy(dev->dev_addr, addr, 6);
+ }
}
- if (node == -1)
+ if (use_idprom)
memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
#elif defined(CONFIG_PPC_PMAC)
unsigned char *addr;