|
37 | 37 | #include <linux/of_device.h>
|
38 | 38 | #include <linux/of_irq.h>
|
39 | 39 | #include <linux/of_mdio.h>
|
| 40 | +#include <linux/of_net.h> |
40 | 41 | #include <linux/of_platform.h>
|
41 | 42 | #include <linux/of_address.h>
|
42 | 43 | #include <linux/skbuff.h>
|
@@ -332,7 +333,7 @@ static void temac_do_set_mac_address(struct net_device *ndev)
|
332 | 333 | mutex_unlock(&lp->indirect_mutex);
|
333 | 334 | }
|
334 | 335 |
|
335 |
| -static int temac_init_mac_address(struct net_device *ndev, void *address) |
| 336 | +static int temac_init_mac_address(struct net_device *ndev, const void *address) |
336 | 337 | {
|
337 | 338 | memcpy(ndev->dev_addr, address, ETH_ALEN);
|
338 | 339 | if (!is_valid_ether_addr(ndev->dev_addr))
|
@@ -982,7 +983,7 @@ static int temac_of_probe(struct platform_device *op)
|
982 | 983 | struct net_device *ndev;
|
983 | 984 | const void *addr;
|
984 | 985 | __be32 *p;
|
985 |
| - int size, rc = 0; |
| 986 | + int rc = 0; |
986 | 987 |
|
987 | 988 | /* Init network device structure */
|
988 | 989 | ndev = alloc_etherdev(sizeof(*lp));
|
@@ -1074,13 +1075,13 @@ static int temac_of_probe(struct platform_device *op)
|
1074 | 1075 |
|
1075 | 1076 |
|
1076 | 1077 | /* Retrieve the MAC address */
|
1077 |
| - addr = of_get_property(op->dev.of_node, "local-mac-address", &size); |
1078 |
| - if ((!addr) || (size != 6)) { |
| 1078 | + addr = of_get_mac_address(op->dev.of_node); |
| 1079 | + if (!addr) { |
1079 | 1080 | dev_err(&op->dev, "could not find MAC address\n");
|
1080 | 1081 | rc = -ENODEV;
|
1081 | 1082 | goto err_iounmap_2;
|
1082 | 1083 | }
|
1083 |
| - temac_init_mac_address(ndev, (void *)addr); |
| 1084 | + temac_init_mac_address(ndev, addr); |
1084 | 1085 |
|
1085 | 1086 | rc = temac_mdio_setup(lp, op->dev.of_node);
|
1086 | 1087 | if (rc)
|
|
0 commit comments