Merge branch 'non-platform-devices-of_get_mac_address'
authorDavid S. Miller <davem@davemloft.net>
Tue, 13 Apr 2021 21:35:02 +0000 (14:35 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 Apr 2021 21:35:02 +0000 (14:35 -0700)
Michael Walle says:

====================
of: net: support non-platform devices in of_get_mac_address()

of_get_mac_address() is commonly used to fetch the MAC address
from the device tree. It also supports reading it from a NVMEM
provider. But the latter is only possible for platform devices,
because only platform devices are searched for a matching device
node.

Add a second method to fetch the NVMEM cell by a device tree node
instead of a "struct device".

Moreover, the NVMEM subsystem will return dynamically allocated
data which has to be freed after use. Currently, this is handled
by allocating a device resource manged buffer to store the MAC
address. of_get_mac_address() then returns a pointer to this
buffer. Without a device, this trick is not possible anymore.
Thus, change the of_get_mac_address() API to have the caller
supply a buffer.

It was considered to use the network device to attach the buffer
to, but then the order matters and netdev_register() has to be
called before of_get_mac_address(). No driver does it this way.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

Trivial merge