diff mbox series

[4/4] net: davinci_emac: Drop nvmem_get_mac_address usage

Message ID 1556320002-26213-5-git-send-email-ynezz@true.cz
State Changes Requested
Delegated to: David Miller
Headers show
Series of_net: Add NVMEM support to of_get_mac_address | expand

Commit Message

Petr Štetiar April 26, 2019, 11:06 p.m. UTC
of_get_mac_address now uses NVMEM under the hood, so it's not necessary
to call it manually anymore.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 drivers/net/ethernet/ti/davinci_emac.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

Comments

Andrew Lunn April 27, 2019, 4:54 p.m. UTC | #1
On Sat, Apr 27, 2019 at 01:06:42AM +0200, Petr Štetiar wrote:
> of_get_mac_address now uses NVMEM under the hood, so it's not necessary
> to call it manually anymore.
> 
> Signed-off-by: Petr Štetiar <ynezz@true.cz>
> ---
>  drivers/net/ethernet/ti/davinci_emac.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
> index 57450b1..c1a5526 100644
> --- a/drivers/net/ethernet/ti/davinci_emac.c
> +++ b/drivers/net/ethernet/ti/davinci_emac.c
> @@ -1912,15 +1912,11 @@ static int davinci_emac_probe(struct platform_device *pdev)
>  		ether_addr_copy(ndev->dev_addr, priv->mac_addr);
>  
>  	if (!is_valid_ether_addr(priv->mac_addr)) {
> -		/* Try nvmem if MAC wasn't passed over pdata or DT. */
> -		rc = nvmem_get_mac_address(&pdev->dev, priv->mac_addr);
> -		if (rc) {
> -			/* Use random MAC if still none obtained. */
> -			eth_hw_addr_random(ndev);
> -			memcpy(priv->mac_addr, ndev->dev_addr, ndev->addr_len);
> -			dev_warn(&pdev->dev, "using random MAC addr: %pM\n",
> -				 priv->mac_addr);
> -		}
> +		/* Use random MAC if still none obtained. */
> +		eth_hw_addr_random(ndev);
> +		memcpy(priv->mac_addr, ndev->dev_addr, ndev->addr_len);
> +		dev_warn(&pdev->dev, "using random MAC addr: %pM\n",
> +			 priv->mac_addr);

Hi Petr

There is the same ordering issue here as with the previous patch.

      Andrew
diff mbox series

Patch

diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 57450b1..c1a5526 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1912,15 +1912,11 @@  static int davinci_emac_probe(struct platform_device *pdev)
 		ether_addr_copy(ndev->dev_addr, priv->mac_addr);
 
 	if (!is_valid_ether_addr(priv->mac_addr)) {
-		/* Try nvmem if MAC wasn't passed over pdata or DT. */
-		rc = nvmem_get_mac_address(&pdev->dev, priv->mac_addr);
-		if (rc) {
-			/* Use random MAC if still none obtained. */
-			eth_hw_addr_random(ndev);
-			memcpy(priv->mac_addr, ndev->dev_addr, ndev->addr_len);
-			dev_warn(&pdev->dev, "using random MAC addr: %pM\n",
-				 priv->mac_addr);
-		}
+		/* Use random MAC if still none obtained. */
+		eth_hw_addr_random(ndev);
+		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;