Message ID | 20211030174111.1432663-1-chunkeey@gmail.com (mailing list archive) |
---|---|
State | RFC |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [RFC,net-next/wireless-next,v1,1/2] ethernet: check nvmem cells for mac-address | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Single patches do not need cover letters |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 3 maintainers not CCed: alobakin@pm.me vladimir.oltean@nxp.com mchehab+huawei@kernel.org |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 1 this patch: 1 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | No Fixes tag |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 18 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 1 this patch: 1 |
netdev/header_inline | success | No static functions without inline keyword in header files |
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index c7d9e08107cb..5e55b08577b1 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -602,7 +602,9 @@ static int fwnode_get_mac_addr(struct fwnode_handle *fwnode, * checked first, because that is supposed to contain to "most recent" MAC * address. If that isn't set, then 'local-mac-address' is checked next, * because that is the default address. If that isn't set, then the obsolete - * 'address' is checked, just in case we're using an old device tree. + * 'address' is checked, just in case we're using an old device tree. If any + * of the above isn't set, then try to get MAC address from nvmem cell named + * 'mac-address'. * * Note that the 'address' property is supposed to contain a virtual address of * the register set, but some DTS files have redefined that property to be the @@ -622,7 +624,7 @@ int fwnode_get_mac_address(struct fwnode_handle *fwnode, char *addr) !fwnode_get_mac_addr(fwnode, "address", addr)) return 0; - return -ENOENT; + return nvmem_get_mac_address(fwnode->dev, addr); } EXPORT_SYMBOL(fwnode_get_mac_address);
of_get_mac_address() gained this function with commit d01f449c008a ("of_net: add NVMEM support to of_get_mac_address") with the following justification: "Many embedded devices have information such as MAC addresses stored inside NVMEMs like EEPROMs and so on. [...] Adding support for NVMEM into every other driver would mean adding a lot of repetitive code. This patch allows us to configure MAC addresses in various devices like ethernet and wireless adapters directly [...]." the common device_/fwnode_get_mac_address could use the same functionality by just a few adjustments. Signed-off-by: Christian Lamparter <chunkeey@gmail.com> --- net/ethernet/eth.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)