Thread (6 messages) flat view 6 messages, 3 authors, 2014-03-05

Re: [PATCH] net: sky2: allow mac to come from dt

From: Tim Harvey <tharvey@gateworks.com>
Date: 2014-03-05 15:38:01
Also in: netdev

On Tue, Mar 4, 2014 at 10:32 PM, Rob Herring [off-list ref] wrote:
<snip>
quoted
@@ -4805,8 +4808,27 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port,

        dev->features |= dev->hw_features;

+       /* try to get mac address in the following order:
+        * 1) from device tree data
+        * 2) from internal registers set by bootloader
+        */
+       iap = NULL;
+       if (IS_ENABLED(CONFIG_OF)) {
This shouldn't be needed.
quoted
+               struct device_node *np = hw->pdev->dev.of_node;
+               if (np)
+                       iap = (unsigned char *) of_get_mac_address(np);
+       }
This should all just be 1 line. of_get_mac_address should just return
NULL if !CONFIG_OF or np == NULL.
agreed - I verified this is true
quoted
+
+       /* 2) mac registers set by bootloader
+        */
+       if (!iap || !is_valid_ether_addr(iap)) {
Perhaps is_valid_ether_addr check should also be moved into of_get_mac_address.
looks like it already does that - I'll simplify the above
Rob
Thanks for the review!

Tim
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help