net: mtk_star_emac: use of_get_ethdev_address
Subsystems (4)
PATCH 1/1 net: mtk_star_emac: use of_get_ethdev_address
The platform_ variant calls arch_get_platform_mac_address which is only implemented under SPARC.
Switch to the of variant as of functions are used in the surrounding code and to get EPROBE_DEFER support in order to handle NVMEM MAC address specifications.
--- drivers/net/ethernet/mediatek/mtk_star_emac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/mediatek/mtk_star_emac.c +3 -1
@@ -1640,7 +1640,9 @@ static int mtk_star_probe(struct platform_device *pdev)if (ret)return ret; - ret =platform_get_ethdev_address (dev, ndev); + ret =of_get_ethdev_address (of_node, ndev); +if (ret == -EPROBE_DEFER ) +return ret;if (ret || !is_valid_ether_addr (ndev->dev_addr))eth_hw_addr_random (ndev);
Signature · 1 line
2.54.0
Quoted 2 lines · Rosen Penev
The
platform_variant callsarch_get_platform_mac_addresswhich is only implemented under SPARC.
platform_get_ethdev_address() calls eth_platform_get_mac_address().
int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr)
{
unsigned char *addr;
int ret;
ret = of_get_mac_address(dev->of_node, mac_addr);
if (!ret)
return 0;
addr = arch_get_platform_mac_address();
if (!addr)
return -ENODEV;
ether_addr_copy(mac_addr, addr);
return 0;
}Quoted 3 lines
Switch to the of variant as of functions are used in the surrounding code and to get
EPROBE_DEFERsupport in order to handle NVMEM MAC address specifications.
So there is a call to of_get_mac_address(). And it calls arch_get_platform_mac_address() as well. If you only call of_get_mac_address(), don't you break SPARC?
If EPROBE_DEFER is what you are trying to get, please change eth_platform_get_mac_address() to actually return it, not break SPARC.
Andrew
---
pw-bot: cr