Commit d86afb89 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by David S. Miller

net: thunderx: Use fwnode_get_mac_address()

Replace the custom implementation with fwnode_get_mac_address,
which works on both DT and ACPI platforms.

While here, replace memcpy() by ether_addr_copy().
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a261e379
...@@ -1381,24 +1381,18 @@ static int acpi_get_mac_address(struct device *dev, struct acpi_device *adev, ...@@ -1381,24 +1381,18 @@ static int acpi_get_mac_address(struct device *dev, struct acpi_device *adev,
u8 *dst) u8 *dst)
{ {
u8 mac[ETH_ALEN]; u8 mac[ETH_ALEN];
int ret; u8 *addr;
ret = fwnode_property_read_u8_array(acpi_fwnode_handle(adev), addr = fwnode_get_mac_address(acpi_fwnode_handle(adev), mac, ETH_ALEN);
"mac-address", mac, ETH_ALEN); if (!addr) {
if (ret)
goto out;
if (!is_valid_ether_addr(mac)) {
dev_err(dev, "MAC address invalid: %pM\n", mac); dev_err(dev, "MAC address invalid: %pM\n", mac);
ret = -EINVAL; return -EINVAL;
goto out;
} }
dev_info(dev, "MAC address set to: %pM\n", mac); dev_info(dev, "MAC address set to: %pM\n", mac);
memcpy(dst, mac, ETH_ALEN); ether_addr_copy(dst, mac);
out: return 0;
return ret;
} }
/* Currently only sets the MAC address. */ /* Currently only sets the MAC address. */
......
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