diff mbox series

[net-next] net: ftmac100: add an opportunity to get ethaddr from the platform

Message ID 20220824151724.2698107-1-saproj@gmail.com (mailing list archive)
State Accepted
Commit f7650d82e7dc501dfc5920c698bcc0591791a57c
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: ftmac100: add an opportunity to get ethaddr from the platform | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 100 this patch: 100
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 17 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Sergei Antonov Aug. 24, 2022, 3:17 p.m. UTC
This driver always generated a random ethernet address. Leave it as a
fallback solution, but add a call to platform_get_ethdev_address().
Handle EPROBE_DEFER returned from platform_get_ethdev_address() to
retry when EEPROM is ready.

Signed-off-by: Sergei Antonov <saproj@gmail.com>
---
 drivers/net/ethernet/faraday/ftmac100.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Andrew Lunn Aug. 24, 2022, 3:32 p.m. UTC | #1
On Wed, Aug 24, 2022 at 06:17:24PM +0300, Sergei Antonov wrote:
> This driver always generated a random ethernet address. Leave it as a
> fallback solution, but add a call to platform_get_ethdev_address().
> Handle EPROBE_DEFER returned from platform_get_ethdev_address() to
> retry when EEPROM is ready.

Hi Sergei

This is version 2 correct, you added -EPROBE_DEFER handling?

Please add a v2 into the Subject "[PATCH v2 net-next]" so we can keep
track of the different versions.

Also, list briefly under the --- what you changed with each version.

It is worth reading:

https://www.kernel.org/doc/html/latest/process/submitting-patches.html

and

https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html#netdev-faq

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

    Andrew
Sergei Antonov Aug. 24, 2022, 3:40 p.m. UTC | #2
On Wed, 24 Aug 2022 at 18:32, Andrew Lunn <andrew@lunn.ch> wrote:
>
> On Wed, Aug 24, 2022 at 06:17:24PM +0300, Sergei Antonov wrote:
> > This driver always generated a random ethernet address. Leave it as a
> > fallback solution, but add a call to platform_get_ethdev_address().
> > Handle EPROBE_DEFER returned from platform_get_ethdev_address() to
> > retry when EEPROM is ready.
>
> Hi Sergei
>
> This is version 2 correct, you added -EPROBE_DEFER handling?

No, that's v1 for drivers/net/ethernet/moxa/ftmac100.c driver and
-EPROBE_DEFER handling is present from the start.
I previously submitted an analogous patch for another driver:
drivers/net/ethernet/moxa/moxart_ether.c. And yes, there were v1 and
v2.
Andrew Lunn Aug. 24, 2022, 4:14 p.m. UTC | #3
On Wed, Aug 24, 2022 at 06:40:44PM +0300, Sergei Antonov wrote:
> On Wed, 24 Aug 2022 at 18:32, Andrew Lunn <andrew@lunn.ch> wrote:
> >
> > On Wed, Aug 24, 2022 at 06:17:24PM +0300, Sergei Antonov wrote:
> > > This driver always generated a random ethernet address. Leave it as a
> > > fallback solution, but add a call to platform_get_ethdev_address().
> > > Handle EPROBE_DEFER returned from platform_get_ethdev_address() to
> > > retry when EEPROM is ready.
> >
> > Hi Sergei
> >
> > This is version 2 correct, you added -EPROBE_DEFER handling?
> 
> No, that's v1 for drivers/net/ethernet/moxa/ftmac100.c driver and
> -EPROBE_DEFER handling is present from the start.
> I previously submitted an analogous patch for another driver:
> drivers/net/ethernet/moxa/moxart_ether.c. And yes, there were v1 and
> v2.

Ah, sorry. Getting the different moxa drivers mixed up.

    Andrew
patchwork-bot+netdevbpf@kernel.org Aug. 27, 2022, 2:40 a.m. UTC | #4
Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 24 Aug 2022 18:17:24 +0300 you wrote:
> This driver always generated a random ethernet address. Leave it as a
> fallback solution, but add a call to platform_get_ethdev_address().
> Handle EPROBE_DEFER returned from platform_get_ethdev_address() to
> retry when EEPROM is ready.
> 
> Signed-off-by: Sergei Antonov <saproj@gmail.com>
> 
> [...]

Here is the summary with links:
  - [net-next] net: ftmac100: add an opportunity to get ethaddr from the platform
    https://git.kernel.org/netdev/net-next/c/f7650d82e7dc

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/faraday/ftmac100.c b/drivers/net/ethernet/faraday/ftmac100.c
index 2e6524009b19..a9af5b4c45b6 100644
--- a/drivers/net/ethernet/faraday/ftmac100.c
+++ b/drivers/net/ethernet/faraday/ftmac100.c
@@ -1077,6 +1077,10 @@  static int ftmac100_probe(struct platform_device *pdev)
 	netdev->netdev_ops = &ftmac100_netdev_ops;
 	netdev->max_mtu = MAX_PKT_SIZE;
 
+	err = platform_get_ethdev_address(&pdev->dev, netdev);
+	if (err == -EPROBE_DEFER)
+		goto defer_get_mac;
+
 	platform_set_drvdata(pdev, netdev);
 
 	/* setup private data */
@@ -1138,6 +1142,7 @@  static int ftmac100_probe(struct platform_device *pdev)
 	release_resource(priv->res);
 err_req_mem:
 	netif_napi_del(&priv->napi);
+defer_get_mac:
 	free_netdev(netdev);
 err_alloc_etherdev:
 	return err;