net: davinci: support of_get_mac_address new ERR_PTR error
There was NVMEM support added directly to of_get_mac_address, and it uses nvmem_get_mac_address under the hood, so we can remove it. As of_get_mac_address can now return ERR_PTR encoded error values, adjust to that as well. Signed-off-by: Petr Štetiar <ynezz@true.cz> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
541ddc66d6
commit
f7af25a6ca
@ -1700,7 +1700,7 @@ davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv)
|
|||||||
|
|
||||||
if (!is_valid_ether_addr(pdata->mac_addr)) {
|
if (!is_valid_ether_addr(pdata->mac_addr)) {
|
||||||
mac_addr = of_get_mac_address(np);
|
mac_addr = of_get_mac_address(np);
|
||||||
if (mac_addr)
|
if (!IS_ERR(mac_addr))
|
||||||
ether_addr_copy(pdata->mac_addr, mac_addr);
|
ether_addr_copy(pdata->mac_addr, mac_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1898,15 +1898,11 @@ static int davinci_emac_probe(struct platform_device *pdev)
|
|||||||
ether_addr_copy(ndev->dev_addr, priv->mac_addr);
|
ether_addr_copy(ndev->dev_addr, priv->mac_addr);
|
||||||
|
|
||||||
if (!is_valid_ether_addr(priv->mac_addr)) {
|
if (!is_valid_ether_addr(priv->mac_addr)) {
|
||||||
/* Try nvmem if MAC wasn't passed over pdata or DT. */
|
/* Use random MAC if still none obtained. */
|
||||||
rc = nvmem_get_mac_address(&pdev->dev, priv->mac_addr);
|
eth_hw_addr_random(ndev);
|
||||||
if (rc) {
|
memcpy(priv->mac_addr, ndev->dev_addr, ndev->addr_len);
|
||||||
/* Use random MAC if still none obtained. */
|
dev_warn(&pdev->dev, "using random MAC addr: %pM\n",
|
||||||
eth_hw_addr_random(ndev);
|
priv->mac_addr);
|
||||||
memcpy(priv->mac_addr, ndev->dev_addr, ndev->addr_len);
|
|
||||||
dev_warn(&pdev->dev, "using random MAC addr: %pM\n",
|
|
||||||
priv->mac_addr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ndev->netdev_ops = &emac_netdev_ops;
|
ndev->netdev_ops = &emac_netdev_ops;
|
||||||
|
Loading…
Reference in New Issue
Block a user