mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
ethernet: Extend device_get_mac_address() to use NVMEM
A lot of modern SoC have the ability to store MAC addresses in their NVMEM. So extend the generic function device_get_mac_address() to obtain the MAC address from an nvmem cell named 'mac-address' in case there is no firmware node which contains the MAC address directly. Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://patch.msgid.link/20250912140332.35395-3-wahrenst@gmx.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
c5b7509d3a
commit
d2d3f529e7
@@ -613,7 +613,10 @@ EXPORT_SYMBOL(fwnode_get_mac_address);
|
||||
*/
|
||||
int device_get_mac_address(struct device *dev, char *addr)
|
||||
{
|
||||
return fwnode_get_mac_address(dev_fwnode(dev), addr);
|
||||
if (!fwnode_get_mac_address(dev_fwnode(dev), addr))
|
||||
return 0;
|
||||
|
||||
return nvmem_get_mac_address(dev, addr);
|
||||
}
|
||||
EXPORT_SYMBOL(device_get_mac_address);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user