Commit 9593dc35 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'of_get_mac_address-fixes'



Petr Štetiar says:

====================
of_get_mac_address fixes

this patch series is hopefuly the last series of the fixes which are related
to the introduction of NVMEM support into of_get_mac_address.

First patch is removing `nvmem-mac-address` property which was wrong idea as
I've allocated the property with devm_kzalloc and then added it to DT, so then
2 entities would be refcounting the allocation.  So if the driver unbinds, the
buffer is freed, but DT code would be still referencing that memory.

Second patch fixes some unwanted references to the Linux API in the DT
bindings documentation.

Patches 3-5 should hopefully make compilers and thus kbuild test robot happy.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 0655f994 1b9705d9
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -139,9 +139,9 @@ Optional properties:
			sub-module attached to this interface.

The MAC address will be determined using the optional properties defined in
ethernet.txt, as provided by the of_get_mac_address API and only if efuse-mac
is set to 0. If any of the optional MAC address properties are not present,
then the driver will use random MAC address.
ethernet.txt and only if efuse-mac is set to 0. If all of the optional MAC
address properties are not present, then the driver will use a random MAC
address.

Example binding:

+2 −2
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@ Optional properties:
- ieee80211-freq-limit: See ieee80211.txt
- mediatek,mtd-eeprom: Specify a MTD partition + offset containing EEPROM data

The driver is using of_get_mac_address API, so the MAC address can be as well
be set with corresponding optional properties defined in net/ethernet.txt.
The MAC address can as well be set with corresponding optional properties
defined in net/ethernet.txt.

Optional nodes:
- led: Properties for a connected LED
+2 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include <linux/irq.h>
#include <linux/export.h>
#include <linux/device.h>
#include <linux/etherdevice.h>
#include <linux/platform_device.h>
#include <linux/of_net.h>
#include <asm/tsi108.h>
@@ -106,7 +107,7 @@ static int __init tsi108_eth_of_init(void)

		mac_addr = of_get_mac_address(np);
		if (!IS_ERR(mac_addr))
			memcpy(tsi_eth_data.mac_addr, mac_addr, 6);
			ether_addr_copy(tsi_eth_data.mac_addr, mac_addr);

		ph = of_get_property(np, "mdio-handle", NULL);
		mdio = of_find_node_by_phandle(*ph);
+1 −1
Original line number Diff line number Diff line
@@ -871,7 +871,7 @@ static int emac_probe(struct platform_device *pdev)
	/* Read MAC-address from DT */
	mac_addr = of_get_mac_address(np);
	if (!IS_ERR(mac_addr))
		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
		ether_addr_copy(ndev->dev_addr, mac_addr);

	/* Check if the MAC address is valid, if not get a random one */
	if (!is_valid_ether_addr(ndev->dev_addr)) {
+1 −1
Original line number Diff line number Diff line
@@ -961,7 +961,7 @@ int arc_emac_probe(struct net_device *ndev, int interface)
	mac_addr = of_get_mac_address(dev->of_node);

	if (!IS_ERR(mac_addr))
		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
		ether_addr_copy(ndev->dev_addr, mac_addr);
	else
		eth_hw_addr_random(ndev);

Loading