diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-06-22 19:18:54 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-06-24 02:15:26 -0400 |
commit | de8d28b16f5614aeb12bb69c8f9a38578b8d3ada (patch) | |
tree | 152f0930dc099606342e9cc6d9a3892cd9f3f192 /drivers/net/sunhme.c | |
parent | 765b5f32730cfd2608291e679060b0391570c8b3 (diff) |
[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/sunhme.c')
-rw-r--r-- | drivers/net/sunhme.c | 18 |
1 files changed, 10 insertions, 8 deletions
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) | |||
3013 | struct quattro *qp = NULL; | 3013 | struct quattro *qp = NULL; |
3014 | #ifdef __sparc__ | 3014 | #ifdef __sparc__ |
3015 | struct pcidev_cookie *pcp; | 3015 | struct pcidev_cookie *pcp; |
3016 | int node; | ||
3017 | #endif | 3016 | #endif |
3018 | struct happy_meal *hp; | 3017 | struct happy_meal *hp; |
3019 | struct net_device *dev; | 3018 | struct net_device *dev; |
@@ -3026,13 +3025,12 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev) | |||
3026 | /* Now make sure pci_dev cookie is there. */ | 3025 | /* Now make sure pci_dev cookie is there. */ |
3027 | #ifdef __sparc__ | 3026 | #ifdef __sparc__ |
3028 | pcp = pdev->sysdata; | 3027 | pcp = pdev->sysdata; |
3029 | if (pcp == NULL || pcp->prom_node == -1) { | 3028 | if (pcp == NULL) { |
3030 | printk(KERN_ERR "happymeal(PCI): Some PCI device info missing\n"); | 3029 | printk(KERN_ERR "happymeal(PCI): Some PCI device info missing\n"); |
3031 | return -ENODEV; | 3030 | return -ENODEV; |
3032 | } | 3031 | } |
3033 | node = pcp->prom_node; | ||
3034 | 3032 | ||
3035 | prom_getstring(node, "name", prom_name, sizeof(prom_name)); | 3033 | strcpy(prom_name, pcp->prom_node->name); |
3036 | #else | 3034 | #else |
3037 | if (is_quattro_p(pdev)) | 3035 | if (is_quattro_p(pdev)) |
3038 | strcpy(prom_name, "SUNW,qfe"); | 3036 | strcpy(prom_name, "SUNW,qfe"); |
@@ -3104,10 +3102,14 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev) | |||
3104 | macaddr[5]++; | 3102 | macaddr[5]++; |
3105 | } else { | 3103 | } else { |
3106 | #ifdef __sparc__ | 3104 | #ifdef __sparc__ |
3105 | unsigned char *addr; | ||
3106 | int len; | ||
3107 | |||
3107 | if (qfe_slot != -1 && | 3108 | if (qfe_slot != -1 && |
3108 | prom_getproplen(node, "local-mac-address") == 6) { | 3109 | (addr = of_get_property(pcp->prom_node, |
3109 | prom_getproperty(node, "local-mac-address", | 3110 | "local-mac-address", &len)) != NULL |
3110 | dev->dev_addr, 6); | 3111 | && len == 6) { |
3112 | memcpy(dev->dev_addr, addr, 6); | ||
3111 | } else { | 3113 | } else { |
3112 | memcpy(dev->dev_addr, idprom->id_ethaddr, 6); | 3114 | memcpy(dev->dev_addr, idprom->id_ethaddr, 6); |
3113 | } | 3115 | } |
@@ -3124,7 +3126,7 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev) | |||
3124 | hp->tcvregs = (hpreg_base + 0x7000UL); | 3126 | hp->tcvregs = (hpreg_base + 0x7000UL); |
3125 | 3127 | ||
3126 | #ifdef __sparc__ | 3128 | #ifdef __sparc__ |
3127 | hp->hm_revision = prom_getintdefault(node, "hm-rev", 0xff); | 3129 | hp->hm_revision = of_getintprop_default(pcp->prom_node, "hm-rev", 0xff); |
3128 | if (hp->hm_revision == 0xff) { | 3130 | if (hp->hm_revision == 0xff) { |
3129 | unsigned char prev; | 3131 | unsigned char prev; |
3130 | 3132 | ||