From de8d28b16f5614aeb12bb69c8f9a38578b8d3ada Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 22 Jun 2006 16:18:54 -0700 Subject: [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 --- drivers/net/sunhme.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'drivers/net/sunhme.c') diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c index bd5d2668a362..b0d452733c9b 100644 --- a/drivers/net/sunhme.c +++ b/drivers/net/sunhme.c @@ -3013,7 +3013,6 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev) struct quattro *qp = NULL; #ifdef __sparc__ struct pcidev_cookie *pcp; - int node; #endif struct happy_meal *hp; struct net_device *dev; @@ -3026,13 +3025,12 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev) /* Now make sure pci_dev cookie is there. */ #ifdef __sparc__ pcp = pdev->sysdata; - if (pcp == NULL || pcp->prom_node == -1) { + if (pcp == NULL) { printk(KERN_ERR "happymeal(PCI): Some PCI device info missing\n"); return -ENODEV; } - node = pcp->prom_node; - prom_getstring(node, "name", prom_name, sizeof(prom_name)); + strcpy(prom_name, pcp->prom_node->name); #else if (is_quattro_p(pdev)) strcpy(prom_name, "SUNW,qfe"); @@ -3104,10 +3102,14 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev) macaddr[5]++; } else { #ifdef __sparc__ + unsigned char *addr; + int len; + if (qfe_slot != -1 && - prom_getproplen(node, "local-mac-address") == 6) { - prom_getproperty(node, "local-mac-address", - dev->dev_addr, 6); + (addr = of_get_property(pcp->prom_node, + "local-mac-address", &len)) != NULL + && len == 6) { + memcpy(dev->dev_addr, addr, 6); } else { memcpy(dev->dev_addr, idprom->id_ethaddr, 6); } @@ -3124,7 +3126,7 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev) hp->tcvregs = (hpreg_base + 0x7000UL); #ifdef __sparc__ - hp->hm_revision = prom_getintdefault(node, "hm-rev", 0xff); + hp->hm_revision = of_getintprop_default(pcp->prom_node, "hm-rev", 0xff); if (hp->hm_revision == 0xff) { unsigned char prev; -- cgit v1.2.1