According to the note of of_get_mac_address, simplify the usage related to it in axxia 55xx and 56xx ethernet driver.
Suggested-by: Mikael Beckius <mikael.beck...@windriver.com> Signed-off-by: Liwei Song <liwei.s...@windriver.com> --- drivers/net/ethernet/axxia/axxia_acp_net.c | 8 +++----- drivers/net/ethernet/intel/axxia/nemac.c | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/axxia/axxia_acp_net.c b/drivers/net/ethernet/axxia/axxia_acp_net.c index 039ee2eee84b..466a0a4b95ec 100644 --- a/drivers/net/ethernet/axxia/axxia_acp_net.c +++ b/drivers/net/ethernet/axxia/axxia_acp_net.c @@ -1575,7 +1575,6 @@ static int appnic_probe_config_dt(struct net_device *dev, struct device_node *np) { struct appnic_device *pdata = netdev_priv(dev); - u8 mac[ETH_ALEN]; struct device_node *gp_node; struct device *d = &dev->dev; int err; @@ -1598,13 +1597,12 @@ static int appnic_probe_config_dt(struct net_device *dev, pdata->rx_interrupt = irq_of_parse_and_map(np, 1); pdata->dma_interrupt = irq_of_parse_and_map(np, 2); - err = of_get_mac_address(np, mac); + err = of_get_mac_address(np, dev->dev_addr); if (err) goto device_tree_failed; - memcpy(&pdata->mac_addr[0], mac, ETH_ALEN); - memcpy(dev->dev_addr, mac, ETH_ALEN); - memcpy(dev->perm_addr, mac, ETH_ALEN); + memcpy(&pdata->mac_addr[0], dev->dev_addr, ETH_ALEN); + memcpy(dev->perm_addr, dev->dev_addr, ETH_ALEN); return 0; diff --git a/drivers/net/ethernet/intel/axxia/nemac.c b/drivers/net/ethernet/intel/axxia/nemac.c index 3e355af17033..e45107391f4d 100644 --- a/drivers/net/ethernet/intel/axxia/nemac.c +++ b/drivers/net/ethernet/intel/axxia/nemac.c @@ -1309,11 +1309,9 @@ nemac_probe(struct platform_device *pdev) * randomized address. */ - ret = of_get_mac_address(dn, macaddr_dt); - if (!ret && is_valid_ether_addr(macaddr_dt)) { - ether_addr_copy(ndev->dev_addr, macaddr_dt); - } else { - random_ether_addr(ndev->dev_addr); + ret = of_get_mac_address(dn, ndev->dev_addr); + if (ret) { + eth_hw_addr_random(ndev); dev_info(dev, "Using random address %pM\n", ndev->dev_addr); } -- 2.36.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12150): https://lists.yoctoproject.org/g/linux-yocto/message/12150 Mute This Topic: https://lists.yoctoproject.org/mt/96802516/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-