Thread (11 messages) 11 messages, 5 authors, 2016-01-13

Re: [PATCH v2] net: Add eth_platform_get_mac_address() helper.

flat view

From: David Miller <davem@davemloft.net>
Date: 2016-01-07 00:01:16

From: Joe Perches <joe@perches.com>
Date: Wed, 06 Jan 2016 15:32:24 -0800
On Thu, 2016-01-07 at 00:26 +0100, Bjørn Mork wrote:
quoted
Joe Perches [off-list ref] writes:
quoted
On Wed, 2016-01-06 at 16:33 -0500, David Miller wrote:
quoted
A repeating pattern in drivers has become to use OF node information
and, if not found, platform specific host information to extract the
ethernet address for a given device.
[]
quoted
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
[]
quoted
@@ -485,3 +487,32 @@ static int __init eth_offload_init(void)
 }
 
 fs_initcall(eth_offload_init);
+
+unsigned char * __weak arch_get_platform_mac_address(void)
+{
+       return NULL;
WARN_ON_ONCE ?
That would prevent a driver from using this with additional fallback
methods.  For what reason?
It's declared __weak and should be overridden by
an arch specific function.

A NULL address would cause a fault when using
a function like copy_ether_addr.
The caller checks for NULL, and this is the default implementation
doing precisely what it is meant to do.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help