From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: tremyfr@gmail.com, tklauser@distanz.ch, davem@davemloft.net,
thierry.reding@gmail.com, andrew@lunn.ch,
Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH net-next 2/3] net: ethoc: Utilize of_get_mac_address()
Date: Sun, 4 Dec 2016 12:40:29 -0800 [thread overview]
Message-ID: <20161204204030.9853-3-f.fainelli@gmail.com> (raw)
In-Reply-To: <20161204204030.9853-1-f.fainelli@gmail.com>
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: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/ethoc.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index 877c02a36c85..8d0cb5ce87ee 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -23,6 +23,7 @@
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/of.h>
+#include <linux/of_net.h>
#include <linux/module.h>
#include <net/ethoc.h>
@@ -1158,11 +1159,9 @@ static int ethoc_probe(struct platform_device *pdev)
memcpy(netdev->dev_addr, pdata->hwaddr, IFHWADDRLEN);
priv->phy_id = pdata->phy_id;
} else {
- const uint8_t *mac;
+ const void *mac;
- mac = of_get_property(pdev->dev.of_node,
- "local-mac-address",
- NULL);
+ mac = of_get_mac_address(pdev->dev.of_node);
if (mac)
memcpy(netdev->dev_addr, mac, IFHWADDRLEN);
priv->phy_id = -1;
--
2.9.3
next prev parent reply other threads:[~2016-12-04 20:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-04 20:40 [PATCH net-next 0/3] net: ethoc: Misc improvements Florian Fainelli
2016-12-04 20:40 ` [PATCH net-next 1/3] net: ethoc: Account for duplex changes Florian Fainelli
2016-12-05 7:20 ` Tobias Klauser
2016-12-05 8:00 ` Thierry Reding
2016-12-04 20:40 ` Florian Fainelli [this message]
2016-12-05 7:20 ` [PATCH net-next 2/3] net: ethoc: Utilize of_get_mac_address() Tobias Klauser
2016-12-05 8:00 ` Thierry Reding
2016-12-04 20:40 ` [PATCH net-next 3/3] net: ethoc: Demote packet dropped error message to debug Florian Fainelli
2016-12-05 7:21 ` Tobias Klauser
2016-12-05 8:00 ` Thierry Reding
2016-12-05 20:30 ` [PATCH net-next 0/3] net: ethoc: Misc improvements David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161204204030.9853-3-f.fainelli@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=tklauser@distanz.ch \
--cc=tremyfr@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).