Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b34296a9 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller
Browse files

net: ethoc: 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 avatarFlorian Fainelli <f.fainelli@gmail.com>
Reviewed-by: default avatarTobias Klauser <tklauser@distanz.ch>
Acked-by: default avatarThierry Reding <thierry.reding@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent abf7e53e
Loading
Loading
Loading
Loading
+3 −4
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@
#include <linux/sched.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/of.h>
#include <linux/of_net.h>
#include <linux/module.h>
#include <linux/module.h>
#include <net/ethoc.h>
#include <net/ethoc.h>


@@ -1158,11 +1159,9 @@ static int ethoc_probe(struct platform_device *pdev)
		memcpy(netdev->dev_addr, pdata->hwaddr, IFHWADDRLEN);
		memcpy(netdev->dev_addr, pdata->hwaddr, IFHWADDRLEN);
		priv->phy_id = pdata->phy_id;
		priv->phy_id = pdata->phy_id;
	} else {
	} else {
		const uint8_t *mac;
		const void *mac;


		mac = of_get_property(pdev->dev.of_node,
		mac = of_get_mac_address(pdev->dev.of_node);
				      "local-mac-address",
				      NULL);
		if (mac)
		if (mac)
			memcpy(netdev->dev_addr, mac, IFHWADDRLEN);
			memcpy(netdev->dev_addr, mac, IFHWADDRLEN);
		priv->phy_id = -1;
		priv->phy_id = -1;