Commit 726bceca authored by Tobias Klauser's avatar Tobias Klauser Committed by David S. Miller

net: greth: Utilize of_get_mac_address()

Do not open code getting the MAC address exclusively from the
"local-mac-address" property, but instead use of_get_mac_address() which
looks up the MAC address using the 3 typical property names.
Signed-off-by: default avatarTobias Klauser <tklauser@distanz.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 58ad3198
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <linux/crc32.h> #include <linux/crc32.h>
#include <linux/mii.h> #include <linux/mii.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_net.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
...@@ -1454,11 +1455,10 @@ static int greth_of_probe(struct platform_device *ofdev) ...@@ -1454,11 +1455,10 @@ static int greth_of_probe(struct platform_device *ofdev)
break; break;
} }
if (i == 6) { if (i == 6) {
const unsigned char *addr; const u8 *addr;
int len;
addr = of_get_property(ofdev->dev.of_node, "local-mac-address", addr = of_get_mac_address(ofdev->dev.of_node);
&len); if (addr) {
if (addr != NULL && len == 6) {
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
macaddr[i] = (unsigned int) addr[i]; macaddr[i] = (unsigned int) addr[i];
} else { } else {
......
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