Commit 49b6e95f authored by David S. Miller's avatar David S. Miller

[TG3]: Use pci_device_to_OF_node() on sparc.

And use CONFIG_SPARC instead of CONFIG_SPARC64 as the
test.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6f85a859
...@@ -46,10 +46,9 @@ ...@@ -46,10 +46,9 @@
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#ifdef CONFIG_SPARC64 #ifdef CONFIG_SPARC
#include <asm/idprom.h> #include <asm/idprom.h>
#include <asm/oplib.h> #include <asm/prom.h>
#include <asm/pbm.h>
#endif #endif
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
...@@ -10988,25 +10987,21 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) ...@@ -10988,25 +10987,21 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
return err; return err;
} }
#ifdef CONFIG_SPARC64 #ifdef CONFIG_SPARC
static int __devinit tg3_get_macaddr_sparc(struct tg3 *tp) static int __devinit tg3_get_macaddr_sparc(struct tg3 *tp)
{ {
struct net_device *dev = tp->dev; struct net_device *dev = tp->dev;
struct pci_dev *pdev = tp->pdev; struct pci_dev *pdev = tp->pdev;
struct pcidev_cookie *pcp = pdev->sysdata; struct device_node *dp = pci_device_to_OF_node(pdev);
unsigned char *addr;
if (pcp != NULL) {
const unsigned char *addr;
int len; int len;
addr = of_get_property(pcp->prom_node, "local-mac-address", addr = of_get_property(dp, "local-mac-address", &len);
&len);
if (addr && len == 6) { if (addr && len == 6) {
memcpy(dev->dev_addr, addr, 6); memcpy(dev->dev_addr, addr, 6);
memcpy(dev->perm_addr, dev->dev_addr, 6); memcpy(dev->perm_addr, dev->dev_addr, 6);
return 0; return 0;
} }
}
return -ENODEV; return -ENODEV;
} }
...@@ -11026,7 +11021,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp) ...@@ -11026,7 +11021,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp)
u32 hi, lo, mac_offset; u32 hi, lo, mac_offset;
int addr_ok = 0; int addr_ok = 0;
#ifdef CONFIG_SPARC64 #ifdef CONFIG_SPARC
if (!tg3_get_macaddr_sparc(tp)) if (!tg3_get_macaddr_sparc(tp))
return 0; return 0;
#endif #endif
......
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