diff mbox series

[net-next,v1] net: ethernet: emac: utilize of_net's of_get_mac_address()

Message ID 20210926095648.244445-1-chunkeey@gmail.com (mailing list archive)
State Accepted
Commit 584351c31d19a1d101696f85007cd0c851ec202d
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v1] net: ethernet: emac: utilize of_net's of_get_mac_address() | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 4 maintainers not CCed: arnd@arndb.de jgg@ziepe.ca robh@kernel.org gregkh@linuxfoundation.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 25 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Christian Lamparter Sept. 26, 2021, 9:56 a.m. UTC
of_get_mac_address() reads the same "local-mac-address" property.
... But goes above and beyond by checking the MAC value properly.

printk+message seems outdated too,
so let's put dev_err in the queue.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
---
 drivers/net/ethernet/ibm/emac/core.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Comments

Andrew Lunn Sept. 26, 2021, 2:35 p.m. UTC | #1
> +	err = of_get_mac_address(np, dev->ndev->dev_addr);
> +	if (err) {
> +		if (err != -EPROBE_DEFER)
> +			dev_err(&dev->ofdev->dev, "Can't get valid [local-]mac-address from OF !\n");
> +		return err;

I think there is a helper which does the if (err != -EPRODE_DEFER)
then print, but i cannot remember its name. Probably the script kids
will come along and convert it for you.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
patchwork-bot+netdevbpf@kernel.org Sept. 27, 2021, 12:30 p.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Sun, 26 Sep 2021 11:56:48 +0200 you wrote:
> of_get_mac_address() reads the same "local-mac-address" property.
> ... But goes above and beyond by checking the MAC value properly.
> 
> printk+message seems outdated too,
> so let's put dev_err in the queue.
> 
> Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
> 
> [...]

Here is the summary with links:
  - [net-next,v1] net: ethernet: emac: utilize of_net's of_get_mac_address()
    https://git.kernel.org/netdev/net-next/c/584351c31d19

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
index 3fae7f943df1..43a29c66d5cc 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -2967,7 +2967,6 @@  static int emac_init_phy(struct emac_instance *dev)
 static int emac_init_config(struct emac_instance *dev)
 {
 	struct device_node *np = dev->ofdev->dev.of_node;
-	const void *p;
 	int err;
 
 	/* Read config from device-tree */
@@ -3099,13 +3098,12 @@  static int emac_init_config(struct emac_instance *dev)
 	}
 
 	/* Read MAC-address */
-	p = of_get_property(np, "local-mac-address", NULL);
-	if (p == NULL) {
-		printk(KERN_ERR "%pOF: Can't find local-mac-address property\n",
-		       np);
-		return -ENXIO;
+	err = of_get_mac_address(np, dev->ndev->dev_addr);
+	if (err) {
+		if (err != -EPROBE_DEFER)
+			dev_err(&dev->ofdev->dev, "Can't get valid [local-]mac-address from OF !\n");
+		return err;
 	}
-	memcpy(dev->ndev->dev_addr, p, ETH_ALEN);
 
 	/* IAHT and GAHT filter parameterization */
 	if (emac_has_feature(dev, EMAC_FTR_EMAC4SYNC)) {