]> Git Repo - linux.git/commit
net: moxa: MAC address reading, generating, validity checking
authorSergei Antonov <[email protected]>
Thu, 18 Aug 2022 09:23:17 +0000 (12:23 +0300)
committerJakub Kicinski <[email protected]>
Thu, 18 Aug 2022 18:08:54 +0000 (11:08 -0700)
commitf4693b81ea3802d2c28c868e1639e580d0da2d1f
treea6b859439522fc6b64f90c3cb380d568941354c7
parent267ef48e06ca3fa3a2e6381e7b20475265c2dfce
net: moxa: MAC address reading, generating, validity checking

This device does not remember its MAC address, so add a possibility
to get it from the platform. If it fails, generate a random address.
This will provide a MAC address early during boot without user space
being involved.

Also remove extra calls to is_valid_ether_addr().

Made after suggestions by Andrew Lunn:
1) Use eth_hw_addr_random() to assign a random MAC address during probe.
2) Remove is_valid_ether_addr() from moxart_mac_open()
3) Add a call to platform_get_ethdev_address() during probe
4) Remove is_valid_ether_addr() from moxart_set_mac_address(). The core does this

v1 -> v2:
Handle EPROBE_DEFER returned from platform_get_ethdev_address().
Move MAC reading code to the beginning of the probe function.

Signed-off-by: Sergei Antonov <[email protected]>
Suggested-by: Andrew Lunn <[email protected]>
CC: Yang Yingliang <[email protected]>
CC: Pavel Skripkin <[email protected]>
CC: Guobin Huang <[email protected]>
CC: Yang Wei <[email protected]>
CC: Christophe JAILLET <[email protected]>
Reviewed-by: Andrew Lunn <[email protected]>
Reviewed-by: Vladimir Oltean <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
drivers/net/ethernet/moxa/moxart_ether.c
This page took 0.055305 seconds and 4 git commands to generate.