summaryrefslogtreecommitdiff
path: root/net/ethernet
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2021-10-06 18:06:59 -0700
committerDavid S. Miller <davem@davemloft.net>2021-10-07 13:39:51 +0100
commit0a14501ed818ff51eed237bbe5009d0d784e4450 (patch)
tree38ecb48669d93876eb747ec0b2e27c2f52563364 /net/ethernet
parent8017c4d8173cfe086420dc5710d631cabd03ef67 (diff)
eth: fwnode: remove the addr len from mac helpers
All callers pass in ETH_ALEN and the function itself will return -EINVAL for any other address length. Just assume it's ETH_ALEN like all other mac address helpers (nvm, of, platform). Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ethernet')
-rw-r--r--net/ethernet/eth.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 70692f5b514c..29447a61d3ec 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -561,14 +561,11 @@ int nvmem_get_mac_address(struct device *dev, void *addrbuf)
EXPORT_SYMBOL(nvmem_get_mac_address);
static int fwnode_get_mac_addr(struct fwnode_handle *fwnode,
- const char *name, char *addr, int alen)
+ const char *name, char *addr)
{
int ret;
- if (alen != ETH_ALEN)
- return -EINVAL;
-
- ret = fwnode_property_read_u8_array(fwnode, name, addr, alen);
+ ret = fwnode_property_read_u8_array(fwnode, name, addr, ETH_ALEN);
if (ret)
return ret;
@@ -581,7 +578,6 @@ static int fwnode_get_mac_addr(struct fwnode_handle *fwnode,
* fwnode_get_mac_address - Get the MAC from the firmware node
* @fwnode: Pointer to the firmware node
* @addr: Address of buffer to store the MAC in
- * @alen: Length of the buffer pointed to by addr, should be ETH_ALEN
*
* Search the firmware node for the best MAC address to use. 'mac-address' is
* checked first, because that is supposed to contain to "most recent" MAC
@@ -600,11 +596,11 @@ static int fwnode_get_mac_addr(struct fwnode_handle *fwnode,
* In this case, the real MAC is in 'local-mac-address', and 'mac-address'
* exists but is all zeros.
*/
-int fwnode_get_mac_address(struct fwnode_handle *fwnode, char *addr, int alen)
+int fwnode_get_mac_address(struct fwnode_handle *fwnode, char *addr)
{
- if (!fwnode_get_mac_addr(fwnode, "mac-address", addr, alen) ||
- !fwnode_get_mac_addr(fwnode, "local-mac-address", addr, alen) ||
- !fwnode_get_mac_addr(fwnode, "address", addr, alen))
+ if (!fwnode_get_mac_addr(fwnode, "mac-address", addr) ||
+ !fwnode_get_mac_addr(fwnode, "local-mac-address", addr) ||
+ !fwnode_get_mac_addr(fwnode, "address", addr))
return 0;
return -ENOENT;
@@ -615,10 +611,9 @@ EXPORT_SYMBOL(fwnode_get_mac_address);
* device_get_mac_address - Get the MAC for a given device
* @dev: Pointer to the device
* @addr: Address of buffer to store the MAC in
- * @alen: Length of the buffer pointed to by addr, should be ETH_ALEN
*/
-int device_get_mac_address(struct device *dev, char *addr, int alen)
+int device_get_mac_address(struct device *dev, char *addr)
{
- return fwnode_get_mac_address(dev_fwnode(dev), addr, alen);
+ return fwnode_get_mac_address(dev_fwnode(dev), addr);
}
EXPORT_SYMBOL(device_get_mac_address);